Removed UNUSED() macro and simplified some headers

This commit is contained in:
Michaël Lemaire 2013-11-17 23:02:36 +01:00
parent 0ae9fe94b2
commit 6436428eeb
14 changed files with 32 additions and 160 deletions

View file

@ -490,10 +490,9 @@ typedef struct
Texture4D* mie;
} Inscatter1Params;
static int _inscatter1Worker(ParallelWork* work, int layer, void* data)
static int _inscatter1Worker(ParallelWork*, int layer, void* data)
{
Inscatter1Params* params = (Inscatter1Params*)data;
UNUSED(work);
double r;
Color dhdH;
@ -630,10 +629,9 @@ typedef struct
int first;
} jParams;
static int _jWorker(ParallelWork* work, int layer, void* data)
static int _jWorker(ParallelWork*, int layer, void* data)
{
jParams* params = (jParams*)data;
UNUSED(work);
double r;
Color dhdH;
@ -753,10 +751,8 @@ static Color _inscatterN(Texture4D* deltaJ, double r, double mu, double muS, dou
return raymie;
}
static int _inscatterNWorker(ParallelWork* work, int layer, void* data)
static int _inscatterNWorker(ParallelWork*, int layer, void* data)
{
UNUSED(work);
InscatterNParams* params = (InscatterNParams*)data;
double r;
@ -787,10 +783,9 @@ typedef struct
Texture4D* destination;
} CopyInscatterNParams;
static int _copyInscatterNWorker(ParallelWork* work, int layer, void* data)
static int _copyInscatterNWorker(ParallelWork*, int layer, void* data)
{
CopyInscatterNParams* params = (CopyInscatterNParams*)data;
UNUSED(work);
double r;
Color dhdH;
@ -1156,10 +1151,8 @@ int brunetonInit()
static const int _init = brunetonInit();
AtmosphereResult brunetonGetSkyColor(Renderer* renderer, Vector3 eye, Vector3 direction, Vector3 sun_position, Color base)
AtmosphereResult brunetonGetSkyColor(Renderer* renderer, Vector3 eye, Vector3 direction, Vector3 sun_position, Color)
{
UNUSED(base);
double yoffset = GROUND_OFFSET - renderer->water->getHeightInfo(renderer).base_height;
eye.y += yoffset;
if (eye.y < 0.0)
@ -1240,11 +1233,8 @@ AtmosphereResult brunetonApplyAerialPerspective(Renderer* renderer, Vector3 loca
return result;
}
void brunetonGetLightingStatus(Renderer* renderer, LightStatus* status, Vector3 normal, int opaque)
void brunetonGetLightingStatus(Renderer* renderer, LightStatus* status, Vector3, int)
{
UNUSED(normal);
UNUSED(opaque);
LightDefinition sun, irradiance;
double muS;

View file

@ -7,13 +7,11 @@
#include "../renderer.h"
#include "clouds/public.h"
static Color _postProcessFragment(Renderer* renderer, Vector3 location, void* data)
static Color _postProcessFragment(Renderer* renderer, Vector3 location, void*)
{
Vector3 camera_location, direction;
Color result;
UNUSED(data);
camera_location = renderer->getCameraLocation(renderer, location);
direction = v3Sub(location, camera_location);

View file

@ -11,21 +11,13 @@
#include "CloudLayerDefinition.h"
/******************** Fake ********************/
static int _fakeAlterLight(Renderer* renderer, LightDefinition* light, Vector3 location)
static int _fakeAlterLight(Renderer*, LightDefinition*, Vector3)
{
UNUSED(renderer);
UNUSED(light);
UNUSED(location);
return 0;
}
static Color _fakeGetColor(Renderer* renderer, Color base, Vector3 start, Vector3 end)
static Color _fakeGetColor(Renderer*, Color base, Vector3, Vector3)
{
UNUSED(renderer);
UNUSED(start);
UNUSED(end);
return base;
}

View file

@ -15,9 +15,8 @@ GeoArea geoareaCreate()
return result;
}
void geoareaDelete(GeoArea* geoarea)
void geoareaDelete(GeoArea*)
{
UNUSED(geoarea);
}
void geoareaCopy(GeoArea* source, GeoArea* destination)

View file

@ -24,31 +24,23 @@ static void* _renderFirstPass(void* data)
return NULL;
}
static int _addRenderProgress(Renderer* renderer, double progress)
static int _addRenderProgress(Renderer* renderer, double)
{
UNUSED(progress);
return !renderer->render_interrupt;
}
static Vector3 _getCameraLocation(Renderer* renderer, Vector3 target)
static Vector3 _getCameraLocation(Renderer* renderer, Vector3)
{
UNUSED(renderer);
UNUSED(target);
return renderer->render_camera->getLocation();
}
static Vector3 _getCameraDirection(Renderer* renderer, Vector3 target)
static Vector3 _getCameraDirection(Renderer* renderer, Vector3)
{
UNUSED(renderer);
UNUSED(target);
return renderer->render_camera->getDirectionNormalized();
}
static double _getPrecision(Renderer* renderer, Vector3 location)
static double _getPrecision(Renderer*, Vector3)
{
UNUSED(renderer);
UNUSED(location);
return 0.0;
}
@ -96,15 +88,8 @@ static void _pushDisplacedQuad(Renderer* renderer, Vector3 v1, Vector3 v2, Vecto
renderer->pushDisplacedTriangle(renderer, v4, v1, v3, ov4, ov1, ov3, callback, callback_data);
}
static RayCastingResult _rayWalking(Renderer* renderer, Vector3 location, Vector3 direction, int terrain, int water, int sky, int clouds)
static RayCastingResult _rayWalking(Renderer*, Vector3, Vector3, int, int, int, int)
{
UNUSED(renderer);
UNUSED(location);
UNUSED(direction);
UNUSED(terrain);
UNUSED(water);
UNUSED(sky);
UNUSED(clouds);
return _RAYCASTING_NULL;
}

View file

@ -23,21 +23,7 @@ typedef struct
typedef void* (*FuncObjectCreate)();
typedef void (*FuncObjectDelete)(void* object);
typedef void (*FuncObjectCopy)(void* source, void* destination);
typedef void (*FuncObjectValidate)(void* object);
typedef void (*FuncObjectSave)(PackStream* stream, void* object);
typedef void (*FuncObjectLoad)(PackStream* stream, void* object);
typedef void (*FuncObjectBind)(void* base, void* sub);
typedef struct {
FuncObjectCreate create;
FuncObjectDelete destroy;
FuncObjectCopy copy;
FuncObjectValidate validate;
FuncObjectSave save;
FuncObjectLoad load;
} StandardDefinition;
typedef struct {
FuncObjectCreate create;
FuncObjectDelete destroy;

View file

@ -14,14 +14,10 @@
* Terrain previews.
*/
static void _getLightingStatus(Renderer* renderer, LightStatus* status, Vector3 normal, int opaque)
static void _getLightingStatus(Renderer*, LightStatus* status, Vector3, int)
{
LightDefinition light;
UNUSED(renderer);
UNUSED(normal);
UNUSED(opaque);
light.color.r = 0.6;
light.color.g = 0.6;
light.color.b = 0.6;
@ -45,9 +41,8 @@ static void _getLightingStatus(Renderer* renderer, LightStatus* status, Vector3
lightingPushLight(status, &light);
}
static Vector3 _getCameraLocation(Renderer* renderer, Vector3 location)
static Vector3 _getCameraLocation(Renderer*, Vector3 location)
{
UNUSED(renderer);
location.x -= 10.0;
location.y += 15.0;
location.z += 10.0;

View file

@ -16,10 +16,8 @@
* Terrain rasterization.
*/
static inline Vector3 _getPoint(TerrainDefinition* definition, Renderer* renderer, double x, double z)
static inline Vector3 _getPoint(TerrainDefinition*, Renderer* renderer, double x, double z)
{
UNUSED(definition);
Vector3 result;
result.x = x;
@ -213,11 +211,9 @@ typedef struct
TerrainChunkInfo chunk;
} ParallelRasterInfo;
static int _parallelJobCallback(ParallelQueue* queue, int job_id, void* data, int stopping)
static int _parallelJobCallback(ParallelQueue*, int, void* data, int stopping)
{
ParallelRasterInfo* info = (ParallelRasterInfo*)data;
UNUSED(queue);
UNUSED(job_id);
if (!stopping)
{

View file

@ -8,13 +8,8 @@
#include "TerrainDefinition.h"
/******************** Binding ********************/
static double _fakeGetHeight(Renderer* renderer, double x, double z, int with_painting)
static double _fakeGetHeight(Renderer*, double, double, int)
{
UNUSED(renderer);
UNUSED(x);
UNUSED(z);
UNUSED(with_painting);
return 0.0;
}
@ -23,16 +18,10 @@ static double _realGetHeight(Renderer* renderer, double x, double z, int with_pa
return renderer->terrain->definition->getInterpolatedHeight(x, z, 1, with_painting);
}
static TerrainResult _fakeGetResult(Renderer* renderer, double x, double z, int with_painting, int with_textures)
static TerrainResult _fakeGetResult(Renderer*, double x, double z, int, int)
{
TerrainResult result;
UNUSED(renderer);
UNUSED(x);
UNUSED(z);
UNUSED(with_painting);
UNUSED(with_textures);
result.location.x = x;
result.location.y = 0.0;
result.location.z = z;
@ -137,11 +126,8 @@ static TerrainResult _realGetResult(Renderer* renderer, double x, double z, int
return result;
}
static Color _fakeGetFinalColor(Renderer* renderer, Vector3 location, double precision)
static Color _fakeGetFinalColor(Renderer*, Vector3, double)
{
UNUSED(renderer);
UNUSED(location);
UNUSED(precision);
return COLOR_GREEN;
}
@ -152,12 +138,8 @@ static Color _realGetFinalColor(Renderer* renderer, Vector3 location, double)
return renderer->applyMediumTraversal(textures.final_location, textures.final_color);
}
static RayCastingResult _fakeCastRay(Renderer* renderer, Vector3 start, Vector3 direction)
static RayCastingResult _fakeCastRay(Renderer*, Vector3, Vector3)
{
UNUSED(renderer);
UNUSED(start);
UNUSED(direction);
RayCastingResult result;
result.hit = 0;
return result;
@ -297,9 +279,8 @@ static int _alterLight(Renderer* renderer, LightDefinition* light, Vector3 locat
}
}
static double _fakeGetWaterHeight(Renderer* renderer)
static double _fakeGetWaterHeight(Renderer*)
{
UNUSED(renderer);
return -1000.0;
}

View file

@ -1,44 +1,9 @@
#include "tools.h"
#include <assert.h>
#include <stdlib.h>
#include <inttypes.h>
#include <math.h>
#include <cmath>
#include <cstdlib>
double toolsRandom()
{
return ((double)rand()) / (double)RAND_MAX;
}
static inline double _cubicInterpolate(double p[4], double x)
{
return p[1] + 0.5 * x * (p[2] - p[0] + x * (2.0 * p[0] - 5.0 * p[1] + 4.0 * p[2] - p[3] + x * (3.0 * (p[1] - p[2]) + p[3] - p[0])));
}
double toolsCubicInterpolate(double stencil[4], double x)
{
return _cubicInterpolate(stencil, x);
}
void toolsFloat2DMapCopy(double* src, double* dest, int src_xstart, int src_ystart, int dest_xstart, int dest_ystart, int xsize, int ysize, int src_xstep, int src_ystep, int dest_xstep, int dest_ystep)
{
/* TODO Optimize with memcpy if src_xstep == dest_xstep == 1 */
int x, y;
double* src_row;
double* dest_row;
src += src_ystart * src_ystep + src_xstart * src_xstep;
dest += dest_ystart * dest_ystep + dest_xstart * dest_xstep;
for (y = 0; y < ysize; y++)
{
src_row = src;
dest_row = dest;
for (x = 0; x < xsize; x++)
{
*dest = *src;
src += src_xstep;
dest += dest_xstep;
}
src = src_row + src_ystep;
dest = dest_row + dest_ystep;
}
}

View file

@ -2,11 +2,7 @@
#define _PAYSAGES_TOOLS_H_
#include "rendering_global.h"
#include "shared/types.h"
#define UNUSED(_x_) ((void)(_x_))
RENDERINGSHARED_EXPORT double toolsRandom();
RENDERINGSHARED_EXPORT void toolsFloat2DMapCopy(double* src, double* dest, int src_xstart, int src_ystart, int dest_xstart, int dest_ystart, int xsize, int ysize, int src_xstep, int src_ystep, int dest_xstep, int dest_ystep);
#endif

View file

@ -54,10 +54,8 @@ int cacheFileIsReadable(CacheFile* cache)
}
}
int cacheFileIsWritable(CacheFile* cache)
int cacheFileIsWritable(CacheFile*)
{
UNUSED(cache);
FILE* f = fopen("./cache/.test", "wb");
if (f)
{

View file

@ -7,9 +7,8 @@
#include "../tools.h"
#include "../tools/parallel.h"
static Color _postProcessFragment(Renderer* renderer, Vector3 location, void* data)
static Color _postProcessFragment(Renderer* renderer, Vector3 location, void*)
{
UNUSED(data);
return renderer->water->getResult(renderer, location.x, location.z).final;
}
@ -47,11 +46,9 @@ typedef struct
double radius_ext;
} ParallelRasterInfo;
static int _parallelJobCallback(ParallelQueue* queue, int job_id, void* data, int stopping)
static int _parallelJobCallback(ParallelQueue*, int, void* data, int stopping)
{
ParallelRasterInfo* info = (ParallelRasterInfo*)data;
UNUSED(queue);
UNUSED(job_id);
if (!stopping)
{

View file

@ -11,26 +11,20 @@
static HeightInfo _FAKE_HEIGHT_INFO = {0.0, 0.0, 0.0};
/******************** Fake ********************/
static HeightInfo _fakeGetHeightInfo(Renderer* renderer)
static HeightInfo _fakeGetHeightInfo(Renderer*)
{
UNUSED(renderer);
return _FAKE_HEIGHT_INFO;
}
static double _fakeGetHeight(Renderer* renderer, double x, double z)
static double _fakeGetHeight(Renderer*, double, double)
{
UNUSED(renderer);
UNUSED(x);
UNUSED(z);
return 0.0;
}
static WaterResult _fakeGetResult(Renderer* renderer, double x, double z)
static WaterResult _fakeGetResult(Renderer*, double x, double z)
{
WaterResult result;
UNUSED(renderer);
result.location.x = x;
result.location.y = 0.0;
result.location.z = z;