diff --git a/src/rendering/atmosphere/atm_bruneton.cpp b/src/rendering/atmosphere/atm_bruneton.cpp index f7be9ca..f54db9b 100644 --- a/src/rendering/atmosphere/atm_bruneton.cpp +++ b/src/rendering/atmosphere/atm_bruneton.cpp @@ -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; diff --git a/src/rendering/atmosphere/atm_raster.cpp b/src/rendering/atmosphere/atm_raster.cpp index 4a367e7..9b56ffc 100644 --- a/src/rendering/atmosphere/atm_raster.cpp +++ b/src/rendering/atmosphere/atm_raster.cpp @@ -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); diff --git a/src/rendering/clouds/clo_rendering.cpp b/src/rendering/clouds/clo_rendering.cpp index dddce85..15ea75d 100644 --- a/src/rendering/clouds/clo_rendering.cpp +++ b/src/rendering/clouds/clo_rendering.cpp @@ -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; } diff --git a/src/rendering/geoarea.cpp b/src/rendering/geoarea.cpp index 3ab0e63..303c87b 100644 --- a/src/rendering/geoarea.cpp +++ b/src/rendering/geoarea.cpp @@ -15,9 +15,8 @@ GeoArea geoareaCreate() return result; } -void geoareaDelete(GeoArea* geoarea) +void geoareaDelete(GeoArea*) { - UNUSED(geoarea); } void geoareaCopy(GeoArea* source, GeoArea* destination) diff --git a/src/rendering/renderer.cpp b/src/rendering/renderer.cpp index 65a556f..a329adc 100644 --- a/src/rendering/renderer.cpp +++ b/src/rendering/renderer.cpp @@ -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; } diff --git a/src/rendering/shared/types.h b/src/rendering/shared/types.h index f6dc18f..bcd466d 100644 --- a/src/rendering/shared/types.h +++ b/src/rendering/shared/types.h @@ -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; diff --git a/src/rendering/terrain/ter_preview.cpp b/src/rendering/terrain/ter_preview.cpp index 85c3f9f..9b91eaf 100644 --- a/src/rendering/terrain/ter_preview.cpp +++ b/src/rendering/terrain/ter_preview.cpp @@ -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; diff --git a/src/rendering/terrain/ter_raster.cpp b/src/rendering/terrain/ter_raster.cpp index bd2b500..e48244f 100644 --- a/src/rendering/terrain/ter_raster.cpp +++ b/src/rendering/terrain/ter_raster.cpp @@ -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) { diff --git a/src/rendering/terrain/ter_render.cpp b/src/rendering/terrain/ter_render.cpp index 0d7f8a4..3ff22c6 100644 --- a/src/rendering/terrain/ter_render.cpp +++ b/src/rendering/terrain/ter_render.cpp @@ -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; } diff --git a/src/rendering/tools.cpp b/src/rendering/tools.cpp index f3df0f1..c4c1929 100644 --- a/src/rendering/tools.cpp +++ b/src/rendering/tools.cpp @@ -1,44 +1,9 @@ #include "tools.h" -#include -#include -#include -#include +#include +#include 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; - } -} diff --git a/src/rendering/tools.h b/src/rendering/tools.h index 0811288..9f3ecd7 100644 --- a/src/rendering/tools.h +++ b/src/rendering/tools.h @@ -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 diff --git a/src/rendering/tools/cache.cpp b/src/rendering/tools/cache.cpp index cd0bc2a..433c7c9 100644 --- a/src/rendering/tools/cache.cpp +++ b/src/rendering/tools/cache.cpp @@ -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) { diff --git a/src/rendering/water/wat_raster.cpp b/src/rendering/water/wat_raster.cpp index cd95976..6797348 100644 --- a/src/rendering/water/wat_raster.cpp +++ b/src/rendering/water/wat_raster.cpp @@ -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) { diff --git a/src/rendering/water/wat_render.cpp b/src/rendering/water/wat_render.cpp index f86260a..03f1e2a 100644 --- a/src/rendering/water/wat_render.cpp +++ b/src/rendering/water/wat_render.cpp @@ -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;