From e82e0c47bd7a400f151dd5f3bb01c2d50f251edd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Sun, 20 Oct 2013 16:47:59 +0200 Subject: [PATCH] Added win32 DLL support everywhere Build is now entirely possible from a fresh QtSDK install, with no external dependency. --- src/editing/editing.pro | 24 +++---- src/exploring/exploring.pro | 27 +++++++- src/exploring/exploring_global.h | 26 ++++++++ src/exploring/main.c | 1 + src/exploring/main.h | 12 ++-- src/paysages.pro | 7 +- src/rendering/atmosphere/public.h | 17 ++--- src/rendering/camera.h | 69 +++++++++---------- src/rendering/clouds/clo_density.h | 10 +-- src/rendering/clouds/clo_preview.c | 1 + src/rendering/clouds/clo_preview.h | 12 ++-- src/rendering/clouds/clo_walking.h | 24 +++---- src/rendering/clouds/public.h | 12 ++-- src/rendering/geoarea.h | 17 ++--- src/rendering/layers.h | 31 ++++----- src/rendering/main.h | 22 ++++--- src/rendering/noise.h | 75 ++++++++++----------- src/rendering/noisenaive.h | 15 +++-- src/rendering/noiseperlin.h | 10 +-- src/rendering/noisesimplex.h | 12 ++-- src/rendering/opencl.h | 11 ++-- src/rendering/render.h | 29 ++++---- src/rendering/renderer.h | 11 ++-- src/rendering/rendering.pro | 10 +-- src/rendering/rendering_global.h | 26 ++++++++ src/rendering/scenery.h | 45 ++++++------- src/rendering/shared/preview.h | 3 +- src/rendering/system.h | 7 +- src/rendering/terrain/public.h | 35 +++++----- src/rendering/terrain/ter_raster.h | 8 ++- src/rendering/textures/public.h | 13 ++-- src/rendering/textures/tex_preview.h | 12 ++-- src/rendering/tools.h | 9 +-- src/rendering/tools/array.h | 17 ++--- src/rendering/tools/boundingbox.h | 5 +- src/rendering/tools/cache.h | 12 ++-- src/rendering/tools/color.h | 99 ++++++++++++++-------------- src/rendering/tools/curve.h | 31 ++++----- src/rendering/tools/data.h | 4 +- src/rendering/tools/euclid.h | 87 ++++++++++++------------ src/rendering/tools/lighting.h | 27 ++++---- src/rendering/tools/memory.h | 6 +- src/rendering/tools/pack.h | 20 +++--- src/rendering/tools/parallel.h | 20 +++--- src/rendering/tools/texture.h | 79 +++++++++++----------- src/rendering/tools/zone.h | 35 +++++----- src/rendering/water/public.h | 17 ++--- src/system/PictureFile.h | 2 +- src/system/system.pro | 7 +- src/system/system_global.h | 16 +++-- 50 files changed, 627 insertions(+), 500 deletions(-) create mode 100644 src/exploring/exploring_global.h create mode 100644 src/rendering/rendering_global.h diff --git a/src/editing/editing.pro b/src/editing/editing.pro index 838ca2a..1adb254 100644 --- a/src/editing/editing.pro +++ b/src/editing/editing.pro @@ -6,22 +6,11 @@ QT += core gui opengl TARGET = paysages-gui unix:LIBS += -lGLU -win32:LIBS += ../../libpaysages.a CONFIG(release, debug|release): DEFINES += NDEBUG INCLUDEPATH += $$PWD/.. -win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../exploring/release/ -lpaysages_exploring -else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../exploring/debug/ -lpaysages_exploring -else:unix: LIBS += -L$$OUT_PWD/../exploring/ -lpaysages_exploring -DEPENDPATH += $$PWD/../exploring - -win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../rendering/release/ -lpaysages_rendering -else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../rendering/debug/ -lpaysages_rendering -else:unix: LIBS += -L$$OUT_PWD/../rendering/ -lpaysages_rendering -DEPENDPATH += $$PWD/../rendering - HEADERS += \ terrain/widgetheightmap.h \ widgetexplorer.h \ @@ -160,3 +149,16 @@ else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../system/debug/ -l else:unix: LIBS += -L$$OUT_PWD/../system/ -lpaysages_system INCLUDEPATH += $$PWD/../system DEPENDPATH += $$PWD/../system + +win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../exploring/release/ -lpaysages_exploring +else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../exploring/debug/ -lpaysages_exploring +else:unix: LIBS += -L$$OUT_PWD/../exploring/ -lpaysages_exploring +INCLUDEPATH += $$PWD/../exploring +DEPENDPATH += $$PWD/../exploring + +win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../rendering/release/ -lpaysages_rendering +else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../rendering/debug/ -lpaysages_rendering +else:unix: LIBS += -L$$OUT_PWD/../rendering/ -lpaysages_rendering +INCLUDEPATH += $$PWD/../rendering +DEPENDPATH += $$PWD/../rendering + diff --git a/src/exploring/exploring.pro b/src/exploring/exploring.pro index c80145a..de60b83 100644 --- a/src/exploring/exploring.pro +++ b/src/exploring/exploring.pro @@ -1,14 +1,35 @@ QT += opengl TEMPLATE = lib -CONFIG += console - TARGET = paysages_exploring +DEFINES += EXPLORING_LIBRARY CONFIG(release, debug|release): DEFINES += NDEBUG INCLUDEPATH += $$PWD/.. SOURCES += main.c -HEADERS += main.h +HEADERS += main.h \ + exploring_global.h + +unix:!symbian { + maemo5 { + target.path = /opt/usr/lib + } else { + target.path = /usr/lib + } + INSTALLS += target +} + +win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../rendering/release/ -lpaysages_rendering +else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../rendering/debug/ -lpaysages_rendering +else:unix: LIBS += -L$$OUT_PWD/../rendering/ -lpaysages_rendering +INCLUDEPATH += $$PWD/../rendering +DEPENDPATH += $$PWD/../rendering + +win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../system/release/ -lpaysages_system +else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../system/debug/ -lpaysages_system +else:unix: LIBS += -L$$OUT_PWD/../system/ -lpaysages_system +INCLUDEPATH += $$PWD/../system +DEPENDPATH += $$PWD/../system diff --git a/src/exploring/exploring_global.h b/src/exploring/exploring_global.h new file mode 100644 index 0000000..f37b575 --- /dev/null +++ b/src/exploring/exploring_global.h @@ -0,0 +1,26 @@ +#ifndef EXPLORING_GLOBAL_H +#define EXPLORING_GLOBAL_H + +/* Shared object helpers */ +#ifdef __cplusplus +# include +#else +# if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) +# define Q_DECL_EXPORT __declspec(dllexport) +# define Q_DECL_IMPORT __declspec(dllimport) +# else +# define Q_DECL_EXPORT +# define Q_DECL_IMPORT +# endif +#endif +#if defined(EXPLORING_LIBRARY) +# define EXPLORINGSHARED_EXPORT Q_DECL_EXPORT +#else +# define EXPLORINGSHARED_EXPORT Q_DECL_IMPORT +#endif + +/* Namespace using */ + +/* Global import */ + +#endif // EXPLORING_GLOBAL_H diff --git a/src/exploring/main.c b/src/exploring/main.c index 134fd1f..e270c12 100644 --- a/src/exploring/main.c +++ b/src/exploring/main.c @@ -2,6 +2,7 @@ #include #include "GL/gl.h" +#include "GL/glu.h" void exploringInit() { diff --git a/src/exploring/main.h b/src/exploring/main.h index 25a702d..7c4ae3e 100644 --- a/src/exploring/main.h +++ b/src/exploring/main.h @@ -1,6 +1,8 @@ #ifndef _PAYSAGES_EXPLORING_MAIN_H_ #define _PAYSAGES_EXPLORING_MAIN_H_ +#include "exploring_global.h" + #include "rendering/renderer.h" #include "rendering/camera.h" @@ -8,12 +10,12 @@ extern "C" { #endif -void exploringInit(); -void exploringSetViewPort(int width, int height, CameraDefinition* camera); -void exploringRenderFrame(Renderer* renderer); +EXPLORINGSHARED_EXPORT void exploringInit(); +EXPLORINGSHARED_EXPORT void exploringSetViewPort(int width, int height, CameraDefinition* camera); +EXPLORINGSHARED_EXPORT void exploringRenderFrame(Renderer* renderer); -void exploringStartStandAlone(); -void exploringInterruptStandAlone(); +EXPLORINGSHARED_EXPORT void exploringStartStandAlone(); +EXPLORINGSHARED_EXPORT void exploringInterruptStandAlone(); #ifdef __cplusplus } diff --git a/src/paysages.pro b/src/paysages.pro index c83080b..8a35e55 100644 --- a/src/paysages.pro +++ b/src/paysages.pro @@ -6,11 +6,12 @@ SUBDIRS = \ rendering \ exploring \ editing \ - controlling \ - testing + controlling + +unix:SUBDIRS += testing rendering.depends = system exploring.depends = rendering editing.depends = exploring rendering controlling.depends = rendering -testing.depends = rendering +unix:testing.depends = rendering diff --git a/src/rendering/atmosphere/public.h b/src/rendering/atmosphere/public.h index 459c281..b4fb854 100644 --- a/src/rendering/atmosphere/public.h +++ b/src/rendering/atmosphere/public.h @@ -1,6 +1,7 @@ #ifndef _PAYSAGES_ATMOSPHERE_PUBLIC_H_ #define _PAYSAGES_ATMOSPHERE_PUBLIC_H_ +#include "../rendering_global.h" #include "../tools/lighting.h" #include "../tools/euclid.h" #include "../tools/color.h" @@ -66,18 +67,18 @@ typedef struct /*void* _internal_data;*/ } AtmosphereRenderer; -extern StandardDefinition AtmosphereDefinitionClass; -extern StandardRenderer AtmosphereRendererClass; +RENDERINGSHARED_EXPORT extern StandardDefinition AtmosphereDefinitionClass; +RENDERINGSHARED_EXPORT extern StandardRenderer AtmosphereRendererClass; -void atmosphereAutoPreset(AtmosphereDefinition* definition, AtmospherePreset preset); +RENDERINGSHARED_EXPORT void atmosphereAutoPreset(AtmosphereDefinition* definition, AtmospherePreset preset); -void atmosphereRenderSkydome(Renderer* renderer); +RENDERINGSHARED_EXPORT void atmosphereRenderSkydome(Renderer* renderer); -void atmosphereInitResult(AtmosphereResult* result); -void atmosphereUpdateResult(AtmosphereResult* result); +RENDERINGSHARED_EXPORT void atmosphereInitResult(AtmosphereResult* result); +RENDERINGSHARED_EXPORT void atmosphereUpdateResult(AtmosphereResult* result); -Renderer* atmosphereCreatePreviewRenderer(); -Color atmosphereGetPreview(Renderer* renderer, double x, double y, double heading); +RENDERINGSHARED_EXPORT Renderer* atmosphereCreatePreviewRenderer(); +RENDERINGSHARED_EXPORT Color atmosphereGetPreview(Renderer* renderer, double x, double y, double heading); #ifdef __cplusplus } diff --git a/src/rendering/camera.h b/src/rendering/camera.h index 3f77683..9548606 100644 --- a/src/rendering/camera.h +++ b/src/rendering/camera.h @@ -1,6 +1,7 @@ #ifndef _PAYSAGES_CAMERA_H_ #define _PAYSAGES_CAMERA_H_ +#include "rendering_global.h" #include "tools/pack.h" #include "tools/euclid.h" #include "tools/boundingbox.h" @@ -20,48 +21,48 @@ typedef struct double zfar; } CameraPerspective; -void cameraSave(PackStream* stream, CameraDefinition* camera); -void cameraLoad(PackStream* stream, CameraDefinition* camera); +RENDERINGSHARED_EXPORT void cameraSave(PackStream* stream, CameraDefinition* camera); +RENDERINGSHARED_EXPORT void cameraLoad(PackStream* stream, CameraDefinition* camera); -CameraDefinition* cameraCreateDefinition(); -void cameraDeleteDefinition(CameraDefinition* definition); -void cameraCopyDefinition(CameraDefinition* source, CameraDefinition* destination); -void cameraValidateDefinition(CameraDefinition* definition, int check_above); +RENDERINGSHARED_EXPORT CameraDefinition* cameraCreateDefinition(); +RENDERINGSHARED_EXPORT void cameraDeleteDefinition(CameraDefinition* definition); +RENDERINGSHARED_EXPORT void cameraCopyDefinition(CameraDefinition* source, CameraDefinition* destination); +RENDERINGSHARED_EXPORT void cameraValidateDefinition(CameraDefinition* definition, int check_above); -Vector3 cameraGetLocation(CameraDefinition* camera); -Vector3 cameraGetTarget(CameraDefinition* camera); -Vector3 cameraGetUpVector(CameraDefinition* camera); -double cameraGetRoll(CameraDefinition* camera); -Vector3 cameraGetDirection(CameraDefinition* camera); -Vector3 cameraGetDirectionNormalized(CameraDefinition* camera); -VectorSpherical cameraGetDirectionSpherical(CameraDefinition* camera); -CameraPerspective cameraGetPerspective(CameraDefinition* camera); -double cameraGetRealDepth(CameraDefinition* camera, Vector3 projected); +RENDERINGSHARED_EXPORT Vector3 cameraGetLocation(CameraDefinition* camera); +RENDERINGSHARED_EXPORT Vector3 cameraGetTarget(CameraDefinition* camera); +RENDERINGSHARED_EXPORT Vector3 cameraGetUpVector(CameraDefinition* camera); +RENDERINGSHARED_EXPORT double cameraGetRoll(CameraDefinition* camera); +RENDERINGSHARED_EXPORT Vector3 cameraGetDirection(CameraDefinition* camera); +RENDERINGSHARED_EXPORT Vector3 cameraGetDirectionNormalized(CameraDefinition* camera); +RENDERINGSHARED_EXPORT VectorSpherical cameraGetDirectionSpherical(CameraDefinition* camera); +RENDERINGSHARED_EXPORT CameraPerspective cameraGetPerspective(CameraDefinition* camera); +RENDERINGSHARED_EXPORT double cameraGetRealDepth(CameraDefinition* camera, Vector3 projected); -void cameraSetLocation(CameraDefinition* camera, Vector3 location); -void cameraSetLocationCoords(CameraDefinition* camera, double x, double y, double z); -void cameraSetTarget(CameraDefinition* camera, Vector3 target); -void cameraSetTargetCoords(CameraDefinition* camera, double x, double y, double z); -void cameraSetRoll(CameraDefinition* camera, double angle); -void cameraSetZoomToTarget(CameraDefinition* camera, double zoom); +RENDERINGSHARED_EXPORT void cameraSetLocation(CameraDefinition* camera, Vector3 location); +RENDERINGSHARED_EXPORT void cameraSetLocationCoords(CameraDefinition* camera, double x, double y, double z); +RENDERINGSHARED_EXPORT void cameraSetTarget(CameraDefinition* camera, Vector3 target); +RENDERINGSHARED_EXPORT void cameraSetTargetCoords(CameraDefinition* camera, double x, double y, double z); +RENDERINGSHARED_EXPORT void cameraSetRoll(CameraDefinition* camera, double angle); +RENDERINGSHARED_EXPORT void cameraSetZoomToTarget(CameraDefinition* camera, double zoom); -void cameraStrafeForward(CameraDefinition* camera, double value); -void cameraStrafeRight(CameraDefinition* camera, double value); -void cameraStrafeUp(CameraDefinition* camera, double value); -void cameraRotateYaw(CameraDefinition* camera, double value); -void cameraRotatePitch(CameraDefinition* camera, double value); -void cameraRotateRoll(CameraDefinition* camera, double value); +RENDERINGSHARED_EXPORT void cameraStrafeForward(CameraDefinition* camera, double value); +RENDERINGSHARED_EXPORT void cameraStrafeRight(CameraDefinition* camera, double value); +RENDERINGSHARED_EXPORT void cameraStrafeUp(CameraDefinition* camera, double value); +RENDERINGSHARED_EXPORT void cameraRotateYaw(CameraDefinition* camera, double value); +RENDERINGSHARED_EXPORT void cameraRotatePitch(CameraDefinition* camera, double value); +RENDERINGSHARED_EXPORT void cameraRotateRoll(CameraDefinition* camera, double value); -void cameraSetRenderSize(CameraDefinition* camera, int width, int height); +RENDERINGSHARED_EXPORT void cameraSetRenderSize(CameraDefinition* camera, int width, int height); -Vector3 cameraProject(CameraDefinition* camera, Vector3 point); -Vector3 cameraUnproject(CameraDefinition* camera, Vector3 point); +RENDERINGSHARED_EXPORT Vector3 cameraProject(CameraDefinition* camera, Vector3 point); +RENDERINGSHARED_EXPORT Vector3 cameraUnproject(CameraDefinition* camera, Vector3 point); /*void cameraPushOverlay(CameraDefinition* camera, Color col, f_RenderFragmentCallback callback);*/ -int cameraIsBoxInView(CameraDefinition* camera, Vector3 center, double xsize, double ysize, double zsize); -int cameraIsUnprojectedBoxInView(CameraDefinition* camera, BoundingBox* box); -int cameraIsProjectedBoxInView(CameraDefinition* camera, BoundingBox* box); +RENDERINGSHARED_EXPORT int cameraIsBoxInView(CameraDefinition* camera, Vector3 center, double xsize, double ysize, double zsize); +RENDERINGSHARED_EXPORT int cameraIsUnprojectedBoxInView(CameraDefinition* camera, BoundingBox* box); +RENDERINGSHARED_EXPORT int cameraIsProjectedBoxInView(CameraDefinition* camera, BoundingBox* box); -int cameraTransitionToAnother(CameraDefinition* current, CameraDefinition* wanted, double factor); +RENDERINGSHARED_EXPORT int cameraTransitionToAnother(CameraDefinition* current, CameraDefinition* wanted, double factor); #ifdef __cplusplus } diff --git a/src/rendering/clouds/clo_density.h b/src/rendering/clouds/clo_density.h index 9117881..b697512 100644 --- a/src/rendering/clouds/clo_density.h +++ b/src/rendering/clouds/clo_density.h @@ -18,7 +18,7 @@ extern "C" * 0.0 means no cloud is present. * 1.0 means full layer. */ -double cloudsGetLayerCoverage(CloudsLayerDefinition* layer, Vector3 location); +RENDERINGSHARED_EXPORT double cloudsGetLayerCoverage(CloudsLayerDefinition* layer, Vector3 location); /** * Get the global density of a cloud layer at a given point [0.0;1.0]. @@ -26,22 +26,22 @@ double cloudsGetLayerCoverage(CloudsLayerDefinition* layer, Vector3 location); * 0.0 means no cloud is present. * 1.0 means full density (deep inside cloud). */ -double cloudsGetLayerDensity(CloudsLayerDefinition* layer, Vector3 location, double coverage); +RENDERINGSHARED_EXPORT double cloudsGetLayerDensity(CloudsLayerDefinition* layer, Vector3 location, double coverage); /** * Get the local density of a cloud layer at a given point inside an edge [0.0;1.0]. */ -double cloudsGetEdgeDensity(CloudsLayerDefinition* layer, Vector3 location, double layer_density); +RENDERINGSHARED_EXPORT double cloudsGetEdgeDensity(CloudsLayerDefinition* layer, Vector3 location, double layer_density); /* * Bind fake density functions to a renderer. */ -void cloudsBindFakeDensityToRenderer(CloudsRenderer* renderer); +RENDERINGSHARED_EXPORT void cloudsBindFakeDensityToRenderer(CloudsRenderer* renderer); /* * Bind real density functions to a renderer. */ -void cloudsBindRealDensityToRenderer(CloudsRenderer* renderer); +RENDERINGSHARED_EXPORT void cloudsBindRealDensityToRenderer(CloudsRenderer* renderer); #ifdef __cplusplus } diff --git a/src/rendering/clouds/clo_preview.c b/src/rendering/clouds/clo_preview.c index ca2fc44..4fb7d82 100644 --- a/src/rendering/clouds/clo_preview.c +++ b/src/rendering/clouds/clo_preview.c @@ -1,3 +1,4 @@ +#include "clo_preview.h" #include "private.h" #include "../tools/euclid.h" diff --git a/src/rendering/clouds/clo_preview.h b/src/rendering/clouds/clo_preview.h index c1bfe35..cfb295c 100644 --- a/src/rendering/clouds/clo_preview.h +++ b/src/rendering/clouds/clo_preview.h @@ -13,13 +13,13 @@ extern "C" { #endif -Renderer* cloudsPreviewCoverageCreateRenderer(); -void cloudsPreviewCoverageBindLayer(Renderer* renderer, CloudsLayerDefinition* layer); -Color cloudsPreviewCoverageGetPixel(Renderer* renderer, double x, double y, double scaling, int perspective); +RENDERINGSHARED_EXPORT Renderer* cloudsPreviewCoverageCreateRenderer(); +RENDERINGSHARED_EXPORT void cloudsPreviewCoverageBindLayer(Renderer* renderer, CloudsLayerDefinition* layer); +RENDERINGSHARED_EXPORT Color cloudsPreviewCoverageGetPixel(Renderer* renderer, double x, double y, double scaling, int perspective); -Renderer* cloudsPreviewMaterialCreateRenderer(); -void cloudsPreviewMaterialBindLayer(Renderer* renderer, CloudsLayerDefinition* layer); -Color cloudsPreviewMaterialGetPixel(Renderer* renderer, double x, double y); +RENDERINGSHARED_EXPORT Renderer* cloudsPreviewMaterialCreateRenderer(); +RENDERINGSHARED_EXPORT void cloudsPreviewMaterialBindLayer(Renderer* renderer, CloudsLayerDefinition* layer); +RENDERINGSHARED_EXPORT Color cloudsPreviewMaterialGetPixel(Renderer* renderer, double x, double y); #ifdef __cplusplus } diff --git a/src/rendering/clouds/clo_walking.h b/src/rendering/clouds/clo_walking.h index e8c89fb..c896fba 100644 --- a/src/rendering/clouds/clo_walking.h +++ b/src/rendering/clouds/clo_walking.h @@ -51,7 +51,7 @@ typedef void (*FuncCloudsWalkingCallback)(CloudsWalker* walker); * @param end End of the search to optimize * @return 0 if the search is useless */ -int cloudsOptimizeWalkingBounds(CloudsLayerDefinition* layer, Vector3* start, Vector3* end); +RENDERINGSHARED_EXPORT int cloudsOptimizeWalkingBounds(CloudsLayerDefinition* layer, Vector3* start, Vector3* end); /** * Create a cloud walker. @@ -62,14 +62,14 @@ int cloudsOptimizeWalkingBounds(CloudsLayerDefinition* layer, Vector3* start, Ve * @param start Start of the walk * @param end End of the walk */ -CloudsWalker* cloudsCreateWalker(Renderer* renderer, CloudsLayerDefinition* layer, Vector3 start, Vector3 end); +RENDERINGSHARED_EXPORT CloudsWalker* cloudsCreateWalker(Renderer* renderer, CloudsLayerDefinition* layer, Vector3 start, Vector3 end); /** * Delete a cloud walker. * * @param walker The walker to free */ -void cloudsDeleteWalker(CloudsWalker* walker); +RENDERINGSHARED_EXPORT void cloudsDeleteWalker(CloudsWalker* walker); /** * Define the segment size for next steps. @@ -77,7 +77,7 @@ void cloudsDeleteWalker(CloudsWalker* walker); * @param walker The walker to configure * @param step The step length, negative for automatic */ -void cloudsWalkerSetStepSize(CloudsWalker* walker, double step); +RENDERINGSHARED_EXPORT void cloudsWalkerSetStepSize(CloudsWalker* walker, double step); /** * Set the void skipping mode. @@ -85,7 +85,7 @@ void cloudsWalkerSetStepSize(CloudsWalker* walker, double step); * @param walker The walker to configure * @param enabled 1 to enable the void skipping, 0 to disable */ -void cloudsWalkerSetVoidSkipping(CloudsWalker* walker, int enabled); +RENDERINGSHARED_EXPORT void cloudsWalkerSetVoidSkipping(CloudsWalker* walker, int enabled); /** * Toggle the local density computing. @@ -95,7 +95,7 @@ void cloudsWalkerSetVoidSkipping(CloudsWalker* walker, int enabled); * @param walker The walker to configure * @param enabled 1 to enable local density, 0 to disable it, -1 for automatic setting. */ -void cloudsWalkerToggleLocalDensity(CloudsWalker* walker, int enabled); +RENDERINGSHARED_EXPORT void cloudsWalkerToggleLocalDensity(CloudsWalker* walker, int enabled); /** * Perform a single step. @@ -103,14 +103,14 @@ void cloudsWalkerToggleLocalDensity(CloudsWalker* walker, int enabled); * @param walker The walker to use * @return 1 to continue the loop, 0 to stop */ -int cloudsWalkerPerformStep(CloudsWalker* walker); +RENDERINGSHARED_EXPORT int cloudsWalkerPerformStep(CloudsWalker* walker); /** * Order the walker to stop. * * @param walker The walker to use */ -void cloudsWalkerOrderStop(CloudsWalker* walker); +RENDERINGSHARED_EXPORT void cloudsWalkerOrderStop(CloudsWalker* walker); /** * Order the walker to refine the search for cloud entry or exit. @@ -121,7 +121,7 @@ void cloudsWalkerOrderStop(CloudsWalker* walker); * @param walker The walker to use * @param precision Precision wanted for the refinement */ -void cloudsWalkerOrderRefine(CloudsWalker* walker, double precision); +RENDERINGSHARED_EXPORT void cloudsWalkerOrderRefine(CloudsWalker* walker, double precision); /** * Order the walker to subdivide the previous segment in smaller segments. @@ -131,14 +131,14 @@ void cloudsWalkerOrderRefine(CloudsWalker* walker, double precision); * @param walker The walker to use * @param max_segments Maximal number of segments */ -void cloudsWalkerOrderSubdivide(CloudsWalker* walker, double max_segments); +RENDERINGSHARED_EXPORT void cloudsWalkerOrderSubdivide(CloudsWalker* walker, double max_segments); /** * Get the last segment information. * * @param walker The walker to use */ -CloudWalkerStepInfo* cloudsWalkerGetLastSegment(CloudsWalker* walker); +RENDERINGSHARED_EXPORT CloudWalkerStepInfo* cloudsWalkerGetLastSegment(CloudsWalker* walker); /** * Start walking automatically through a segment. @@ -148,7 +148,7 @@ CloudWalkerStepInfo* cloudsWalkerGetLastSegment(CloudsWalker* walker); * @param callback Callback to be called with each found segment * @param data User data that will be passed back in the callback */ -void cloudsStartWalking(CloudsWalker* walker, FuncCloudsWalkingCallback callback, void* data); +RENDERINGSHARED_EXPORT void cloudsStartWalking(CloudsWalker* walker, FuncCloudsWalkingCallback callback, void* data); #ifdef __cplusplus } diff --git a/src/rendering/clouds/public.h b/src/rendering/clouds/public.h index 82ebee2..52ee011 100644 --- a/src/rendering/clouds/public.h +++ b/src/rendering/clouds/public.h @@ -1,6 +1,7 @@ #ifndef _PAYSAGES_CLOUDS_PUBLIC_H_ #define _PAYSAGES_CLOUDS_PUBLIC_H_ +#include "../rendering_global.h" #include "../shared/types.h" #include "../tools/lighting.h" #include "../tools/curve.h" @@ -74,13 +75,12 @@ typedef struct } CloudsRenderer; -extern StandardDefinition CloudsDefinitionClass; -extern StandardRenderer CloudsRendererClass; +RENDERINGSHARED_EXPORT extern StandardDefinition CloudsDefinitionClass; +RENDERINGSHARED_EXPORT extern StandardRenderer CloudsRendererClass; - -LayerType cloudsGetLayerType(); -void cloudsAutoPreset(CloudsDefinition* definition, CloudsPreset preset); -void cloudsLayerAutoPreset(CloudsLayerDefinition* definition, CloudsLayerPreset preset); +RENDERINGSHARED_EXPORT LayerType cloudsGetLayerType(); +RENDERINGSHARED_EXPORT void cloudsAutoPreset(CloudsDefinition* definition, CloudsPreset preset); +RENDERINGSHARED_EXPORT void cloudsLayerAutoPreset(CloudsLayerDefinition* definition, CloudsLayerPreset preset); #ifdef __cplusplus } diff --git a/src/rendering/geoarea.h b/src/rendering/geoarea.h index 8350b49..01067c2 100644 --- a/src/rendering/geoarea.h +++ b/src/rendering/geoarea.h @@ -3,6 +3,7 @@ /* Geographic area definition */ +#include "rendering_global.h" #include "tools/pack.h" #ifdef __cplusplus @@ -17,16 +18,16 @@ typedef struct double size_z; } GeoArea; -GeoArea geoareaCreate(); -void geoareaDelete(GeoArea* geoarea); -void geoareaCopy(GeoArea* source, GeoArea* destination); -void geoareaValidate(GeoArea* geoarea); +RENDERINGSHARED_EXPORT GeoArea geoareaCreate(); +RENDERINGSHARED_EXPORT void geoareaDelete(GeoArea* geoarea); +RENDERINGSHARED_EXPORT void geoareaCopy(GeoArea* source, GeoArea* destination); +RENDERINGSHARED_EXPORT void geoareaValidate(GeoArea* geoarea); -void geoareaSave(PackStream* stream, GeoArea* geoarea); -void geoareaLoad(PackStream* stream, GeoArea* geoarea); +RENDERINGSHARED_EXPORT void geoareaSave(PackStream* stream, GeoArea* geoarea); +RENDERINGSHARED_EXPORT void geoareaLoad(PackStream* stream, GeoArea* geoarea); -void geoareaToLocal(GeoArea* geoarea, double absolute_x, double absolute_z, double* local_x, double* local_z); -void geoareaFromLocal(GeoArea* geoarea, double local_x, double local_z, double* absolute_x, double* absolute_z); +RENDERINGSHARED_EXPORT void geoareaToLocal(GeoArea* geoarea, double absolute_x, double absolute_z, double* local_x, double* local_z); +RENDERINGSHARED_EXPORT void geoareaFromLocal(GeoArea* geoarea, double local_x, double local_z, double* absolute_x, double* absolute_z); #ifdef __cplusplus } diff --git a/src/rendering/layers.h b/src/rendering/layers.h index 194747c..27820ce 100644 --- a/src/rendering/layers.h +++ b/src/rendering/layers.h @@ -3,6 +3,7 @@ /* Factorized layer management (with names) */ +#include "rendering_global.h" #include "tools/pack.h" #ifdef __cplusplus @@ -27,25 +28,25 @@ typedef struct { typedef struct Layers Layers; -Layers* layersCreate(LayerType type, int max_layer_count); -Layers* layersCreateCopy(Layers* original); -void layersDelete(Layers* layers); +RENDERINGSHARED_EXPORT Layers* layersCreate(LayerType type, int max_layer_count); +RENDERINGSHARED_EXPORT Layers* layersCreateCopy(Layers* original); +RENDERINGSHARED_EXPORT void layersDelete(Layers* layers); -void layersCopy(Layers* source, Layers* destination); -void layersValidate(Layers* layers); +RENDERINGSHARED_EXPORT void layersCopy(Layers* source, Layers* destination); +RENDERINGSHARED_EXPORT void layersValidate(Layers* layers); -void layersSave(PackStream* stream, Layers* layers); -void layersLoad(PackStream* stream, Layers* layers); +RENDERINGSHARED_EXPORT void layersSave(PackStream* stream, Layers* layers); +RENDERINGSHARED_EXPORT void layersLoad(PackStream* stream, Layers* layers); -const char* layersGetName(Layers* layers, int layer); -void layersSetName(Layers* layers, int layer, const char* name); +RENDERINGSHARED_EXPORT const char* layersGetName(Layers* layers, int layer); +RENDERINGSHARED_EXPORT void layersSetName(Layers* layers, int layer, const char* name); -void layersClear(Layers* layers); -int layersCount(Layers* layers); -void* layersGetLayer(Layers* layers, int layer); -int layersAddLayer(Layers* layers, void* definition); -void layersDeleteLayer(Layers* layers, int layer); -void layersMove(Layers* layers, int layer, int new_position); +RENDERINGSHARED_EXPORT void layersClear(Layers* layers); +RENDERINGSHARED_EXPORT int layersCount(Layers* layers); +RENDERINGSHARED_EXPORT void* layersGetLayer(Layers* layers, int layer); +RENDERINGSHARED_EXPORT int layersAddLayer(Layers* layers, void* definition); +RENDERINGSHARED_EXPORT void layersDeleteLayer(Layers* layers, int layer); +RENDERINGSHARED_EXPORT void layersMove(Layers* layers, int layer, int new_position); #ifdef __cplusplus } diff --git a/src/rendering/main.h b/src/rendering/main.h index 8c663cc..2806faa 100644 --- a/src/rendering/main.h +++ b/src/rendering/main.h @@ -3,21 +3,23 @@ #define PAYSAGES_CURRENT_DATA_VERSION 1 +#include "rendering_global.h" + #ifdef __cplusplus extern "C" { #endif - typedef enum { - FILE_OPERATION_OK, - FILE_OPERATION_IOERROR, - FILE_OPERATION_APP_MISMATCH, - FILE_OPERATION_VERSION_MISMATCH - } FileOperationResult; +typedef enum { + FILE_OPERATION_OK, + FILE_OPERATION_IOERROR, + FILE_OPERATION_APP_MISMATCH, + FILE_OPERATION_VERSION_MISMATCH +} FileOperationResult; - void paysagesInit(); - void paysagesQuit(); - FileOperationResult paysagesSave(char* filepath); - FileOperationResult paysagesLoad(char* filepath); +RENDERINGSHARED_EXPORT void paysagesInit(); +RENDERINGSHARED_EXPORT void paysagesQuit(); +RENDERINGSHARED_EXPORT FileOperationResult paysagesSave(char* filepath); +RENDERINGSHARED_EXPORT FileOperationResult paysagesLoad(char* filepath); #ifdef __cplusplus } diff --git a/src/rendering/noise.h b/src/rendering/noise.h index a8dea1a..9612a7c 100644 --- a/src/rendering/noise.h +++ b/src/rendering/noise.h @@ -1,6 +1,7 @@ #ifndef _PAYSAGES_NOISE_H_ #define _PAYSAGES_NOISE_H_ +#include "rendering_global.h" #include "tools/pack.h" #ifdef __cplusplus @@ -33,44 +34,44 @@ typedef struct typedef struct NoiseGenerator NoiseGenerator; -void noiseInit(); -void noiseQuit(); -void noiseSave(PackStream* stream); -void noiseLoad(PackStream* stream); +RENDERINGSHARED_EXPORT void noiseInit(); +RENDERINGSHARED_EXPORT void noiseQuit(); +RENDERINGSHARED_EXPORT void noiseSave(PackStream* stream); +RENDERINGSHARED_EXPORT void noiseLoad(PackStream* stream); -NoiseGenerator* noiseCreateGenerator(); -void noiseDeleteGenerator(NoiseGenerator* generator); -void noiseSaveGenerator(PackStream* stream, NoiseGenerator* generator); -void noiseLoadGenerator(PackStream* stream, NoiseGenerator* generator); -void noiseCopy(NoiseGenerator* source, NoiseGenerator* destination); -void noiseValidate(NoiseGenerator* generator); -void noiseRandomizeOffsets(NoiseGenerator* generator); -NoiseFunction noiseGetFunction(NoiseGenerator* generator); -void noiseSetCustomFunction(NoiseGenerator* generator, double (*func1d)(double x), double (*func2d)(double x, double y), double (*func3d)(double x, double y, double z)); -void noiseSetFunction(NoiseGenerator* generator, NoiseFunction* function); -void noiseSetFunctionParams(NoiseGenerator* generator, NoiseFunctionAlgorithm algorithm, double ridge_factor, double curve_factor); -void noiseForceValue(NoiseGenerator* generator, double value); -void noiseGetRange(NoiseGenerator* generator, double* minvalue, double* maxvalue); -int noiseGetLevelCount(NoiseGenerator* generator); -void noiseClearLevels(NoiseGenerator* generator); -void noiseAddLevel(NoiseGenerator* generator, NoiseLevel level, int protect_offsets); -void noiseAddLevelSimple(NoiseGenerator* generator, double scaling, double minvalue, double maxvalue); -void noiseAddLevels(NoiseGenerator* generator, int level_count, NoiseLevel start_level, double scaling_factor, double amplitude_factor, double center_factor); -void noiseAddLevelsSimple(NoiseGenerator* generator, int level_count, double scaling, double minvalue, double maxvalue, double center_factor); -void noiseRemoveLevel(NoiseGenerator* generator, int level); -int noiseGetLevel(NoiseGenerator* generator, int level, NoiseLevel* params); -void noiseSetLevel(NoiseGenerator* generator, int index, NoiseLevel level, int protect_offsets); -void noiseSetLevelSimple(NoiseGenerator* generator, int index, double scaling, double minvalue, double maxvalue); -void noiseNormalizeAmplitude(NoiseGenerator* generator, double minvalue, double maxvalue, int adjust_scaling); -double noiseGet1DLevel(NoiseGenerator* generator, int level, double x); -double noiseGet1DTotal(NoiseGenerator* generator, double x); -double noiseGet1DDetail(NoiseGenerator* generator, double x, double detail); -double noiseGet2DLevel(NoiseGenerator* generator, int level, double x, double y); -double noiseGet2DTotal(NoiseGenerator* generator, double x, double y); -double noiseGet2DDetail(NoiseGenerator* generator, double x, double y, double detail); -double noiseGet3DLevel(NoiseGenerator* generator, int level, double x, double y, double z); -double noiseGet3DTotal(NoiseGenerator* generator, double x, double y, double z); -double noiseGet3DDetail(NoiseGenerator* generator, double x, double y, double z, double detail); +RENDERINGSHARED_EXPORT NoiseGenerator* noiseCreateGenerator(); +RENDERINGSHARED_EXPORT void noiseDeleteGenerator(NoiseGenerator* generator); +RENDERINGSHARED_EXPORT void noiseSaveGenerator(PackStream* stream, NoiseGenerator* generator); +RENDERINGSHARED_EXPORT void noiseLoadGenerator(PackStream* stream, NoiseGenerator* generator); +RENDERINGSHARED_EXPORT void noiseCopy(NoiseGenerator* source, NoiseGenerator* destination); +RENDERINGSHARED_EXPORT void noiseValidate(NoiseGenerator* generator); +RENDERINGSHARED_EXPORT void noiseRandomizeOffsets(NoiseGenerator* generator); +RENDERINGSHARED_EXPORT NoiseFunction noiseGetFunction(NoiseGenerator* generator); +RENDERINGSHARED_EXPORT void noiseSetCustomFunction(NoiseGenerator* generator, double (*func1d)(double x), double (*func2d)(double x, double y), double (*func3d)(double x, double y, double z)); +RENDERINGSHARED_EXPORT void noiseSetFunction(NoiseGenerator* generator, NoiseFunction* function); +RENDERINGSHARED_EXPORT void noiseSetFunctionParams(NoiseGenerator* generator, NoiseFunctionAlgorithm algorithm, double ridge_factor, double curve_factor); +RENDERINGSHARED_EXPORT void noiseForceValue(NoiseGenerator* generator, double value); +RENDERINGSHARED_EXPORT void noiseGetRange(NoiseGenerator* generator, double* minvalue, double* maxvalue); +RENDERINGSHARED_EXPORT int noiseGetLevelCount(NoiseGenerator* generator); +RENDERINGSHARED_EXPORT void noiseClearLevels(NoiseGenerator* generator); +RENDERINGSHARED_EXPORT void noiseAddLevel(NoiseGenerator* generator, NoiseLevel level, int protect_offsets); +RENDERINGSHARED_EXPORT void noiseAddLevelSimple(NoiseGenerator* generator, double scaling, double minvalue, double maxvalue); +RENDERINGSHARED_EXPORT void noiseAddLevels(NoiseGenerator* generator, int level_count, NoiseLevel start_level, double scaling_factor, double amplitude_factor, double center_factor); +RENDERINGSHARED_EXPORT void noiseAddLevelsSimple(NoiseGenerator* generator, int level_count, double scaling, double minvalue, double maxvalue, double center_factor); +RENDERINGSHARED_EXPORT void noiseRemoveLevel(NoiseGenerator* generator, int level); +RENDERINGSHARED_EXPORT int noiseGetLevel(NoiseGenerator* generator, int level, NoiseLevel* params); +RENDERINGSHARED_EXPORT void noiseSetLevel(NoiseGenerator* generator, int index, NoiseLevel level, int protect_offsets); +RENDERINGSHARED_EXPORT void noiseSetLevelSimple(NoiseGenerator* generator, int index, double scaling, double minvalue, double maxvalue); +RENDERINGSHARED_EXPORT void noiseNormalizeAmplitude(NoiseGenerator* generator, double minvalue, double maxvalue, int adjust_scaling); +RENDERINGSHARED_EXPORT double noiseGet1DLevel(NoiseGenerator* generator, int level, double x); +RENDERINGSHARED_EXPORT double noiseGet1DTotal(NoiseGenerator* generator, double x); +RENDERINGSHARED_EXPORT double noiseGet1DDetail(NoiseGenerator* generator, double x, double detail); +RENDERINGSHARED_EXPORT double noiseGet2DLevel(NoiseGenerator* generator, int level, double x, double y); +RENDERINGSHARED_EXPORT double noiseGet2DTotal(NoiseGenerator* generator, double x, double y); +RENDERINGSHARED_EXPORT double noiseGet2DDetail(NoiseGenerator* generator, double x, double y, double detail); +RENDERINGSHARED_EXPORT double noiseGet3DLevel(NoiseGenerator* generator, int level, double x, double y, double z); +RENDERINGSHARED_EXPORT double noiseGet3DTotal(NoiseGenerator* generator, double x, double y, double z); +RENDERINGSHARED_EXPORT double noiseGet3DDetail(NoiseGenerator* generator, double x, double y, double z, double detail); #ifdef __cplusplus } diff --git a/src/rendering/noisenaive.h b/src/rendering/noisenaive.h index 7121961..4d55854 100644 --- a/src/rendering/noisenaive.h +++ b/src/rendering/noisenaive.h @@ -1,19 +1,20 @@ #ifndef _PAYSAGES_NOISENAIVE_H_ #define _PAYSAGES_NOISENAIVE_H_ +#include "rendering_global.h" #include "tools/pack.h" #ifdef __cplusplus extern "C" { #endif -void noiseNaiveInit(); -void noiseNaiveQuit(); -void noiseNaiveSave(PackStream* stream); -void noiseNaiveLoad(PackStream* stream); -double noiseNaiveGet1DValue(double x); -double noiseNaiveGet2DValue(double x, double y); -double noiseNaiveGet3DValue(double x, double y, double z); +RENDERINGSHARED_EXPORT void noiseNaiveInit(); +RENDERINGSHARED_EXPORT void noiseNaiveQuit(); +RENDERINGSHARED_EXPORT void noiseNaiveSave(PackStream* stream); +RENDERINGSHARED_EXPORT void noiseNaiveLoad(PackStream* stream); +RENDERINGSHARED_EXPORT double noiseNaiveGet1DValue(double x); +RENDERINGSHARED_EXPORT double noiseNaiveGet2DValue(double x, double y); +RENDERINGSHARED_EXPORT double noiseNaiveGet3DValue(double x, double y, double z); /*double noiseNaiveGet4DValue(double x, double y, double z, double w);*/ #ifdef __cplusplus diff --git a/src/rendering/noiseperlin.h b/src/rendering/noiseperlin.h index d45f91a..1b28315 100644 --- a/src/rendering/noiseperlin.h +++ b/src/rendering/noiseperlin.h @@ -1,14 +1,16 @@ #ifndef _PAYSAGES_NOISEPERLIN_H_ #define _PAYSAGES_NOISEPERLIN_H_ +#include "rendering_global.h" + #ifdef __cplusplus extern "C" { #endif -void noisePerlinInit(); -double noisePerlinGet1DValue(double x); -double noisePerlinGet2DValue(double x, double y); -double noisePerlinGet3DValue(double x, double y, double z); +RENDERINGSHARED_EXPORT void noisePerlinInit(); +RENDERINGSHARED_EXPORT double noisePerlinGet1DValue(double x); +RENDERINGSHARED_EXPORT double noisePerlinGet2DValue(double x, double y); +RENDERINGSHARED_EXPORT double noisePerlinGet3DValue(double x, double y, double z); /*double noiseSimplexGet4DValue(double x, double y, double z, double w);*/ #ifdef __cplusplus diff --git a/src/rendering/noisesimplex.h b/src/rendering/noisesimplex.h index 53daf2d..d0afabc 100644 --- a/src/rendering/noisesimplex.h +++ b/src/rendering/noisesimplex.h @@ -1,15 +1,17 @@ #ifndef _PAYSAGES_NOISESIMPLEX_H_ #define _PAYSAGES_NOISESIMPLEX_H_ +#include "rendering_global.h" + #ifdef __cplusplus extern "C" { #endif -void noiseSimplexInit(); -double noiseSimplexGet1DValue(double x); -double noiseSimplexGet2DValue(double x, double y); -double noiseSimplexGet3DValue(double x, double y, double z); -double noiseSimplexGet4DValue(double x, double y, double z, double w); +RENDERINGSHARED_EXPORT void noiseSimplexInit(); +RENDERINGSHARED_EXPORT double noiseSimplexGet1DValue(double x); +RENDERINGSHARED_EXPORT double noiseSimplexGet2DValue(double x, double y); +RENDERINGSHARED_EXPORT double noiseSimplexGet3DValue(double x, double y, double z); +RENDERINGSHARED_EXPORT double noiseSimplexGet4DValue(double x, double y, double z, double w); #ifdef __cplusplus } diff --git a/src/rendering/opencl.h b/src/rendering/opencl.h index 1bd97f4..b90a304 100644 --- a/src/rendering/opencl.h +++ b/src/rendering/opencl.h @@ -3,15 +3,16 @@ /* OpenCL usage */ +#include "rendering_global.h" +#include "noise.h" + #ifdef __cplusplus extern "C" { #endif -#include "noise.h" - -void openclInit(); -int openclAvailable(); -void openclQuit(); +RENDERINGSHARED_EXPORT void openclInit(); +RENDERINGSHARED_EXPORT int openclAvailable(); +RENDERINGSHARED_EXPORT void openclQuit(); #ifdef __cplusplus } diff --git a/src/rendering/render.h b/src/rendering/render.h index 62184a0..7d4092c 100644 --- a/src/rendering/render.h +++ b/src/rendering/render.h @@ -1,6 +1,7 @@ #ifndef _PAYSAGES_RENDER_H_ #define _PAYSAGES_RENDER_H_ +#include "rendering_global.h" #include "shared/types.h" #include "tools/color.h" #include "tools/euclid.h" @@ -25,25 +26,25 @@ typedef struct int quality; } RenderParams; -void renderInit(); -void renderQuit(); +RENDERINGSHARED_EXPORT void renderInit(); +RENDERINGSHARED_EXPORT void renderQuit(); -RenderArea* renderCreateArea(Renderer* renderer); -void renderDeleteArea(RenderArea* area); +RENDERINGSHARED_EXPORT RenderArea* renderCreateArea(Renderer* renderer); +RENDERINGSHARED_EXPORT void renderDeleteArea(RenderArea* area); -void renderSetParams(RenderArea* area, RenderParams params); -void renderSetToneMapping(RenderArea* area, ToneMappingOperator tonemapper, double exposure); -void renderSetBackgroundColor(RenderArea* area, Color* col); -void renderClear(RenderArea* area); -void renderUpdate(RenderArea* area); +RENDERINGSHARED_EXPORT void renderSetParams(RenderArea* area, RenderParams params); +RENDERINGSHARED_EXPORT void renderSetToneMapping(RenderArea* area, ToneMappingOperator tonemapper, double exposure); +RENDERINGSHARED_EXPORT void renderSetBackgroundColor(RenderArea* area, Color* col); +RENDERINGSHARED_EXPORT void renderClear(RenderArea* area); +RENDERINGSHARED_EXPORT void renderUpdate(RenderArea* area); -void renderPushTriangle(RenderArea* area, Vector3 pixel1, Vector3 pixel2, Vector3 pixel3, Vector3 location1, Vector3 location2, Vector3 location3, f_RenderFragmentCallback callback, void* callback_data); +RENDERINGSHARED_EXPORT void renderPushTriangle(RenderArea* area, Vector3 pixel1, Vector3 pixel2, Vector3 pixel3, Vector3 location1, Vector3 location2, Vector3 location3, f_RenderFragmentCallback callback, void* callback_data); -Color renderGetPixel(RenderArea* area, int x, int y); +RENDERINGSHARED_EXPORT Color renderGetPixel(RenderArea* area, int x, int y); -void renderPostProcess(RenderArea* area, int nbchunks); -int renderSaveToFile(RenderArea* area, const char* path); -void renderSetPreviewCallbacks(RenderArea* area, RenderCallbackStart start, RenderCallbackDraw draw, RenderCallbackUpdate update); +RENDERINGSHARED_EXPORT void renderPostProcess(RenderArea* area, int nbchunks); +RENDERINGSHARED_EXPORT int renderSaveToFile(RenderArea* area, const char* path); +RENDERINGSHARED_EXPORT void renderSetPreviewCallbacks(RenderArea* area, RenderCallbackStart start, RenderCallbackDraw draw, RenderCallbackUpdate update); #ifdef __cplusplus diff --git a/src/rendering/renderer.h b/src/rendering/renderer.h index 3b71c86..44d45f8 100644 --- a/src/rendering/renderer.h +++ b/src/rendering/renderer.h @@ -1,6 +1,7 @@ #ifndef _PAYSAGES_RENDERER_H_ #define _PAYSAGES_RENDERER_H_ +#include "rendering_global.h" #include "shared/types.h" #include "atmosphere/public.h" #include "clouds/public.h" @@ -60,11 +61,11 @@ struct Renderer void* customData[10]; }; -Renderer* rendererCreate(); -void rendererDelete(Renderer* renderer); -void rendererSetPreviewCallbacks(Renderer* renderer, RenderCallbackStart start, RenderCallbackDraw draw, RenderCallbackUpdate update); -void rendererStart(Renderer* renderer, RenderParams params); -void rendererInterrupt(Renderer* renderer); +RENDERINGSHARED_EXPORT Renderer* rendererCreate(); +RENDERINGSHARED_EXPORT void rendererDelete(Renderer* renderer); +RENDERINGSHARED_EXPORT void rendererSetPreviewCallbacks(Renderer* renderer, RenderCallbackStart start, RenderCallbackDraw draw, RenderCallbackUpdate update); +RENDERINGSHARED_EXPORT void rendererStart(Renderer* renderer, RenderParams params); +RENDERINGSHARED_EXPORT void rendererInterrupt(Renderer* renderer); #ifdef __cplusplus } diff --git a/src/rendering/rendering.pro b/src/rendering/rendering.pro index 9e9ede6..1215b9b 100644 --- a/src/rendering/rendering.pro +++ b/src/rendering/rendering.pro @@ -1,14 +1,15 @@ -TEMPLATE = lib CONFIG += console CONFIG -= app_bundle CONFIG -= qt +TEMPLATE = lib TARGET = paysages_rendering -INCLUDEPATH += $$PWD/.. - +DEFINES += RENDERING_LIBRARY CONFIG(release, debug|release): DEFINES += NDEBUG +INCLUDEPATH += $$PWD/.. + SOURCES += main.c \ tools.c \ system.c \ @@ -110,7 +111,8 @@ HEADERS += \ tools/boundingbox.h \ tools/array.h \ water/public.h \ - water/private.h + water/private.h \ + rendering_global.h win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../system/release/ -lpaysages_system else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../system/debug/ -lpaysages_system diff --git a/src/rendering/rendering_global.h b/src/rendering/rendering_global.h new file mode 100644 index 0000000..4bc9885 --- /dev/null +++ b/src/rendering/rendering_global.h @@ -0,0 +1,26 @@ +#ifndef RENDERING_GLOBAL_H +#define RENDERING_GLOBAL_H + +/* Shared object helpers */ +#ifdef __cplusplus +# include +#else +# if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) +# define Q_DECL_EXPORT __declspec(dllexport) +# define Q_DECL_IMPORT __declspec(dllimport) +# else +# define Q_DECL_EXPORT +# define Q_DECL_IMPORT +# endif +#endif +#if defined(RENDERING_LIBRARY) +# define RENDERINGSHARED_EXPORT Q_DECL_EXPORT +#else +# define RENDERINGSHARED_EXPORT Q_DECL_IMPORT +#endif + +/* Namespace using */ + +/* Global import */ + +#endif // RENDERING_GLOBAL_H diff --git a/src/rendering/scenery.h b/src/rendering/scenery.h index ad0a60b..7d80198 100644 --- a/src/rendering/scenery.h +++ b/src/rendering/scenery.h @@ -8,6 +8,7 @@ * a standard renderer. */ +#include "rendering_global.h" #include "tools/pack.h" #include "atmosphere/public.h" #include "clouds/public.h" @@ -23,38 +24,38 @@ extern "C" { typedef void (*SceneryCustomDataCallback)(PackStream* stream, void* data); -void sceneryInit(); -void sceneryQuit(); +RENDERINGSHARED_EXPORT void sceneryInit(); +RENDERINGSHARED_EXPORT void sceneryQuit(); -void sceneryAutoPreset(int seed); +RENDERINGSHARED_EXPORT void sceneryAutoPreset(int seed); -void scenerySetCustomDataCallback(SceneryCustomDataCallback callback_save, SceneryCustomDataCallback callback_load, void* data); +RENDERINGSHARED_EXPORT void scenerySetCustomDataCallback(SceneryCustomDataCallback callback_save, SceneryCustomDataCallback callback_load, void* data); -void scenerySave(PackStream* stream); -void sceneryLoad(PackStream* stream); +RENDERINGSHARED_EXPORT void scenerySave(PackStream* stream); +RENDERINGSHARED_EXPORT void sceneryLoad(PackStream* stream); -void scenerySetAtmosphere(AtmosphereDefinition* atmosphere); -void sceneryGetAtmosphere(AtmosphereDefinition* atmosphere); +RENDERINGSHARED_EXPORT void scenerySetAtmosphere(AtmosphereDefinition* atmosphere); +RENDERINGSHARED_EXPORT void sceneryGetAtmosphere(AtmosphereDefinition* atmosphere); -void scenerySetCamera(CameraDefinition* camera); -void sceneryGetCamera(CameraDefinition* camera); +RENDERINGSHARED_EXPORT void scenerySetCamera(CameraDefinition* camera); +RENDERINGSHARED_EXPORT void sceneryGetCamera(CameraDefinition* camera); -void scenerySetClouds(CloudsDefinition* clouds); -void sceneryGetClouds(CloudsDefinition* clouds); +RENDERINGSHARED_EXPORT void scenerySetClouds(CloudsDefinition* clouds); +RENDERINGSHARED_EXPORT void sceneryGetClouds(CloudsDefinition* clouds); -void scenerySetTerrain(TerrainDefinition* terrain); -void sceneryGetTerrain(TerrainDefinition* terrain); -TerrainDefinition* sceneryGetTerrainDirect(); +RENDERINGSHARED_EXPORT void scenerySetTerrain(TerrainDefinition* terrain); +RENDERINGSHARED_EXPORT void sceneryGetTerrain(TerrainDefinition* terrain); +RENDERINGSHARED_EXPORT TerrainDefinition* sceneryGetTerrainDirect(); -void scenerySetTextures(TexturesDefinition* textures); -void sceneryGetTextures(TexturesDefinition* textures); +RENDERINGSHARED_EXPORT void scenerySetTextures(TexturesDefinition* textures); +RENDERINGSHARED_EXPORT void sceneryGetTextures(TexturesDefinition* textures); -void scenerySetWater(WaterDefinition* water); -void sceneryGetWater(WaterDefinition* water); +RENDERINGSHARED_EXPORT void scenerySetWater(WaterDefinition* water); +RENDERINGSHARED_EXPORT void sceneryGetWater(WaterDefinition* water); -Renderer* sceneryCreateStandardRenderer(); -void sceneryBindRenderer(Renderer* renderer); -void sceneryRenderFirstPass(Renderer* renderer); +RENDERINGSHARED_EXPORT Renderer* sceneryCreateStandardRenderer(); +RENDERINGSHARED_EXPORT void sceneryBindRenderer(Renderer* renderer); +RENDERINGSHARED_EXPORT void sceneryRenderFirstPass(Renderer* renderer); #ifdef __cplusplus } diff --git a/src/rendering/shared/preview.h b/src/rendering/shared/preview.h index 47f3b77..d9356d5 100644 --- a/src/rendering/shared/preview.h +++ b/src/rendering/shared/preview.h @@ -5,6 +5,7 @@ * Preview management. */ +#include "../rendering_global.h" #include "types.h" #ifdef __cplusplus @@ -28,7 +29,7 @@ typedef struct { FuncPreviewGetPixelColor getPixelColor; } PreviewClass; -PreviewClass previewCreateClass(FuncPreviewCustomizeRenderer customizeRenderer, FuncPreviewBindDefinition bindDefinition, FuncPreviewGetPixelColor getPixelColor); +RENDERINGSHARED_EXPORT PreviewClass previewCreateClass(FuncPreviewCustomizeRenderer customizeRenderer, FuncPreviewBindDefinition bindDefinition, FuncPreviewGetPixelColor getPixelColor); #ifdef __cplusplus } diff --git a/src/rendering/system.h b/src/rendering/system.h index f10f2d4..9d1dc31 100644 --- a/src/rendering/system.h +++ b/src/rendering/system.h @@ -3,16 +3,17 @@ /* Library dependent features */ +#include "rendering_global.h" #include #ifdef __cplusplus extern "C" { #endif -void systemInit(); -int systemGetCoreCount(); +RENDERINGSHARED_EXPORT void systemInit(); +RENDERINGSHARED_EXPORT int systemGetCoreCount(); -int systemGetFileSize(const char* path); +RENDERINGSHARED_EXPORT int systemGetFileSize(const char* path); #ifdef __cplusplus } diff --git a/src/rendering/terrain/public.h b/src/rendering/terrain/public.h index 671d3f5..0abd6da 100644 --- a/src/rendering/terrain/public.h +++ b/src/rendering/terrain/public.h @@ -1,6 +1,7 @@ #ifndef _PAYSAGES_TERRAIN_PUBLIC_H_ #define _PAYSAGES_TERRAIN_PUBLIC_H_ +#include "../rendering_global.h" #include #include "../shared/types.h" #include "../tools/color.h" @@ -58,18 +59,18 @@ typedef struct void* _internal_data; } TerrainRenderer; -extern StandardDefinition TerrainDefinitionClass; -extern StandardRenderer TerrainRendererClass; +RENDERINGSHARED_EXPORT extern StandardDefinition TerrainDefinitionClass; +RENDERINGSHARED_EXPORT extern StandardRenderer TerrainRendererClass; -void terrainAutoPreset(TerrainDefinition* definition, TerrainPreset preset); -double terrainGetGridHeight(TerrainDefinition* definition, int x, int z, int with_painting); -double terrainGetInterpolatedHeight(TerrainDefinition* definition, double x, double z, int scaled, int with_painting); -size_t terrainGetMemoryStats(TerrainDefinition* definition); +RENDERINGSHARED_EXPORT void terrainAutoPreset(TerrainDefinition* definition, TerrainPreset preset); +RENDERINGSHARED_EXPORT double terrainGetGridHeight(TerrainDefinition* definition, int x, int z, int with_painting); +RENDERINGSHARED_EXPORT double terrainGetInterpolatedHeight(TerrainDefinition* definition, double x, double z, int scaled, int with_painting); +RENDERINGSHARED_EXPORT size_t terrainGetMemoryStats(TerrainDefinition* definition); -Renderer* terrainCreatePreviewRenderer(); -Color terrainGetPreviewColor(Renderer* renderer, double x, double z, double detail); +RENDERINGSHARED_EXPORT Renderer* terrainCreatePreviewRenderer(); +RENDERINGSHARED_EXPORT Color terrainGetPreviewColor(Renderer* renderer, double x, double z, double detail); -HeightInfo terrainGetHeightInfo(TerrainDefinition* definition); +RENDERINGSHARED_EXPORT HeightInfo terrainGetHeightInfo(TerrainDefinition* definition); typedef struct { @@ -81,14 +82,14 @@ typedef struct } TerrainBrush; /* Heightmap manipulation */ -int terrainIsPainted(TerrainHeightMap* heightmap, int x, int z); -void terrainClearPainting(TerrainHeightMap* heightmap); -void terrainBrushElevation(TerrainHeightMap* heightmap, TerrainBrush* brush, double value); -void terrainBrushSmooth(TerrainHeightMap* heightmap, TerrainBrush* brush, double value); -void terrainBrushAddNoise(TerrainHeightMap* heightmap, TerrainBrush* brush, NoiseGenerator* generator, double value); -void terrainBrushReset(TerrainHeightMap* heightmap, TerrainBrush* brush, double value); -void terrainBrushFlatten(TerrainHeightMap* heightmap, TerrainBrush* brush, double height, double force); -void terrainEndBrushStroke(TerrainHeightMap* heightmap); +RENDERINGSHARED_EXPORT int terrainIsPainted(TerrainHeightMap* heightmap, int x, int z); +RENDERINGSHARED_EXPORT void terrainClearPainting(TerrainHeightMap* heightmap); +RENDERINGSHARED_EXPORT void terrainBrushElevation(TerrainHeightMap* heightmap, TerrainBrush* brush, double value); +RENDERINGSHARED_EXPORT void terrainBrushSmooth(TerrainHeightMap* heightmap, TerrainBrush* brush, double value); +RENDERINGSHARED_EXPORT void terrainBrushAddNoise(TerrainHeightMap* heightmap, TerrainBrush* brush, NoiseGenerator* generator, double value); +RENDERINGSHARED_EXPORT void terrainBrushReset(TerrainHeightMap* heightmap, TerrainBrush* brush, double value); +RENDERINGSHARED_EXPORT void terrainBrushFlatten(TerrainHeightMap* heightmap, TerrainBrush* brush, double height, double force); +RENDERINGSHARED_EXPORT void terrainEndBrushStroke(TerrainHeightMap* heightmap); #ifdef __cplusplus } diff --git a/src/rendering/terrain/ter_raster.h b/src/rendering/terrain/ter_raster.h index a113f17..471b17c 100644 --- a/src/rendering/terrain/ter_raster.h +++ b/src/rendering/terrain/ter_raster.h @@ -1,6 +1,8 @@ #ifndef _RENDERING_TERRAIN_RASTER_H_ #define _RENDERING_TERRAIN_RASTER_H_ +#include "../rendering_global.h" + #ifdef __cplusplus extern "C" { #endif @@ -21,19 +23,19 @@ typedef int (*FuncTerrainTessellationCallback)(Renderer* renderer, TerrainChunkI * * The terrain will be broken in chunks, most detailed near the camera. */ -void terrainGetTessellationInfo(Renderer* renderer, FuncTerrainTessellationCallback callback, int displaced); +RENDERINGSHARED_EXPORT void terrainGetTessellationInfo(Renderer* renderer, FuncTerrainTessellationCallback callback, int displaced); /** * Tessellate a terrain chunk, pushing the quads in the render area. */ -void terrainTessellateChunk(Renderer* renderer, TerrainChunkInfo* chunk, int detail); +RENDERINGSHARED_EXPORT void terrainTessellateChunk(Renderer* renderer, TerrainChunkInfo* chunk, int detail); /** * Start the final rasterization of terrain. * * This will push the rasterized quads in the render area, waiting for post process. */ -void terrainRenderSurface(Renderer* renderer); +RENDERINGSHARED_EXPORT void terrainRenderSurface(Renderer* renderer); #ifdef __cplusplus } diff --git a/src/rendering/textures/public.h b/src/rendering/textures/public.h index a2e455d..7d03bd8 100644 --- a/src/rendering/textures/public.h +++ b/src/rendering/textures/public.h @@ -1,6 +1,7 @@ #ifndef _PAYSAGES_TEXTURES_PUBLIC_H_ #define _PAYSAGES_TEXTURES_PUBLIC_H_ +#include "../rendering_global.h" #include "rendering/layers.h" #include "rendering/tools/zone.h" #include "rendering/tools/lighting.h" @@ -89,15 +90,15 @@ typedef struct } TexturesRenderer; -extern StandardDefinition TexturesDefinitionClass; -extern StandardRenderer TexturesRendererClass; +RENDERINGSHARED_EXPORT extern StandardDefinition TexturesDefinitionClass; +RENDERINGSHARED_EXPORT extern StandardRenderer TexturesRendererClass; -LayerType texturesGetLayerType(); -void texturesAutoPreset(TexturesDefinition* definition, TexturesPreset preset); -void texturesLayerAutoPreset(TexturesLayerDefinition* definition, TexturesLayerPreset preset); +RENDERINGSHARED_EXPORT LayerType texturesGetLayerType(); +RENDERINGSHARED_EXPORT void texturesAutoPreset(TexturesDefinition* definition, TexturesPreset preset); +RENDERINGSHARED_EXPORT void texturesLayerAutoPreset(TexturesLayerDefinition* definition, TexturesLayerPreset preset); -double texturesGetMaximalDisplacement(TexturesDefinition* textures); +RENDERINGSHARED_EXPORT double texturesGetMaximalDisplacement(TexturesDefinition* textures); #ifdef __cplusplus } diff --git a/src/rendering/textures/tex_preview.h b/src/rendering/textures/tex_preview.h index 74c7d4f..6b41e9b 100644 --- a/src/rendering/textures/tex_preview.h +++ b/src/rendering/textures/tex_preview.h @@ -9,16 +9,16 @@ extern "C" { #include "rendering/textures/public.h" /* Single layer coverage */ -void TexturesPreviewLayerCoverage_bind(Renderer* renderer, TexturesDefinition* definition); -Color TexturesPreviewLayerCoverage_getColor(Renderer* renderer, double x, double y, double scaling, int layer); +RENDERINGSHARED_EXPORT void TexturesPreviewLayerCoverage_bind(Renderer* renderer, TexturesDefinition* definition); +RENDERINGSHARED_EXPORT Color TexturesPreviewLayerCoverage_getColor(Renderer* renderer, double x, double y, double scaling, int layer); /* Single layer look */ -void TexturesPreviewLayerLook_bind(Renderer* renderer, TexturesDefinition* definition); -Color TexturesPreviewLayerLook_getColor(Renderer* renderer, double x, double y, double scaling, int layer); +RENDERINGSHARED_EXPORT void TexturesPreviewLayerLook_bind(Renderer* renderer, TexturesDefinition* definition); +RENDERINGSHARED_EXPORT Color TexturesPreviewLayerLook_getColor(Renderer* renderer, double x, double y, double scaling, int layer); /* Cumulative color preview */ -void TexturesPreviewCumul_bind(Renderer* renderer, TexturesDefinition* definition); -Color TexturesPreviewCumul_getColor(Renderer* renderer, double x, double y, double scaling, int layer); +RENDERINGSHARED_EXPORT void TexturesPreviewCumul_bind(Renderer* renderer, TexturesDefinition* definition); +RENDERINGSHARED_EXPORT Color TexturesPreviewCumul_getColor(Renderer* renderer, double x, double y, double scaling, int layer); #ifdef __cplusplus } diff --git a/src/rendering/tools.h b/src/rendering/tools.h index 62a2ee4..9e05225 100644 --- a/src/rendering/tools.h +++ b/src/rendering/tools.h @@ -1,6 +1,7 @@ #ifndef _PAYSAGES_TOOLS_H_ #define _PAYSAGES_TOOLS_H_ +#include "rendering_global.h" #include "shared/types.h" #ifdef __cplusplus @@ -9,10 +10,10 @@ extern "C" { #define UNUSED(_x_) ((void)(_x_)) -double toolsRandom(); -double toolsCubicInterpolate(double stencil[4], double x); -double toolsBicubicInterpolate(double stencil[16], double x, double y); -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); +RENDERINGSHARED_EXPORT double toolsRandom(); +RENDERINGSHARED_EXPORT double toolsCubicInterpolate(double stencil[4], double x); +RENDERINGSHARED_EXPORT double toolsBicubicInterpolate(double stencil[16], double x, double y); +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); #ifdef __cplusplus } diff --git a/src/rendering/tools/array.h b/src/rendering/tools/array.h index 5184ac7..14a2980 100644 --- a/src/rendering/tools/array.h +++ b/src/rendering/tools/array.h @@ -1,6 +1,7 @@ #ifndef _PAYSAGES_TOOLS_ARRAY_H_ #define _PAYSAGES_TOOLS_ARRAY_H_ +#include "../rendering_global.h" #include "../shared/types.h" #include @@ -13,7 +14,7 @@ extern "C" { /* * Insert an item at a given position, rallocating the array, moving data and returning a pointer to the inserted element. */ -void* naiveArrayInsert(void** array, size_t item_size, int item_count, int location); +RENDERINGSHARED_EXPORT void* naiveArrayInsert(void** array, size_t item_size, int item_count, int location); /**************** Array object ****************/ @@ -26,13 +27,13 @@ typedef struct void* data; } Array; -void arrayCreate(Array* array, int item_size); -void arrayDelete(Array* array); -void* arrayAppend(Array* array, void* item); -void arrayInsert(Array* array, void* item, int position); -void arrayReplace(Array* array, void* item, int position); -void arrayLStrip(Array* array, int count); -void arrayClear(Array* array); +RENDERINGSHARED_EXPORT void arrayCreate(Array* array, int item_size); +RENDERINGSHARED_EXPORT void arrayDelete(Array* array); +RENDERINGSHARED_EXPORT void* arrayAppend(Array* array, void* item); +RENDERINGSHARED_EXPORT void arrayInsert(Array* array, void* item, int position); +RENDERINGSHARED_EXPORT void arrayReplace(Array* array, void* item, int position); +RENDERINGSHARED_EXPORT void arrayLStrip(Array* array, int count); +RENDERINGSHARED_EXPORT void arrayClear(Array* array); #ifdef __cplusplus } diff --git a/src/rendering/tools/boundingbox.h b/src/rendering/tools/boundingbox.h index 1aeb29a..b2223c5 100644 --- a/src/rendering/tools/boundingbox.h +++ b/src/rendering/tools/boundingbox.h @@ -1,6 +1,7 @@ #ifndef _RENDERING_TOOLS_BOUNDINGBOX_H_ #define _RENDERING_TOOLS_BOUNDINGBOX_H_ +#include "../rendering_global.h" #include "euclid.h" #ifdef __cplusplus @@ -18,8 +19,8 @@ typedef struct double zmax; } BoundingBox; -void boundingBoxReset(BoundingBox* box); -void boundingBoxPushPoint(BoundingBox* box, Vector3 point); +RENDERINGSHARED_EXPORT void boundingBoxReset(BoundingBox* box); +RENDERINGSHARED_EXPORT void boundingBoxPushPoint(BoundingBox* box, Vector3 point); #ifdef __cplusplus } diff --git a/src/rendering/tools/cache.h b/src/rendering/tools/cache.h index 1939798..3b896bd 100644 --- a/src/rendering/tools/cache.h +++ b/src/rendering/tools/cache.h @@ -5,17 +5,19 @@ * Cache management. */ +#include "../rendering_global.h" + #ifdef __cplusplus extern "C" { #endif typedef struct CacheFile CacheFile; -CacheFile* cacheFileCreateAccessor(const char* module, const char* ext, const char* tag1, int tag2, int tag3, int tag4, int tag5, int tag6); -void cacheFileDeleteAccessor(CacheFile* cache); -int cacheFileIsReadable(CacheFile* cache); -int cacheFileIsWritable(CacheFile* cache); -const char* cacheFileGetPath(CacheFile* cache); +RENDERINGSHARED_EXPORT CacheFile* cacheFileCreateAccessor(const char* module, const char* ext, const char* tag1, int tag2, int tag3, int tag4, int tag5, int tag6); +RENDERINGSHARED_EXPORT void cacheFileDeleteAccessor(CacheFile* cache); +RENDERINGSHARED_EXPORT int cacheFileIsReadable(CacheFile* cache); +RENDERINGSHARED_EXPORT int cacheFileIsWritable(CacheFile* cache); +RENDERINGSHARED_EXPORT const char* cacheFileGetPath(CacheFile* cache); #ifdef __cplusplus } diff --git a/src/rendering/tools/color.h b/src/rendering/tools/color.h index 7541601..7b15a21 100644 --- a/src/rendering/tools/color.h +++ b/src/rendering/tools/color.h @@ -1,6 +1,7 @@ #ifndef _PAYSAGES_TOOLS_COLOR_H_ #define _PAYSAGES_TOOLS_COLOR_H_ +#include "../rendering_global.h" #include "curve.h" #include "pack.h" @@ -17,35 +18,35 @@ typedef struct double a; } Color; -extern Color COLOR_TRANSPARENT; -extern Color COLOR_BLACK; -extern Color COLOR_RED; -extern Color COLOR_GREEN; -extern Color COLOR_BLUE; -extern Color COLOR_WHITE; -extern Color COLOR_GREY; +RENDERINGSHARED_EXPORT extern Color COLOR_TRANSPARENT; +RENDERINGSHARED_EXPORT extern Color COLOR_BLACK; +RENDERINGSHARED_EXPORT extern Color COLOR_RED; +RENDERINGSHARED_EXPORT extern Color COLOR_GREEN; +RENDERINGSHARED_EXPORT extern Color COLOR_BLUE; +RENDERINGSHARED_EXPORT extern Color COLOR_WHITE; +RENDERINGSHARED_EXPORT extern Color COLOR_GREY; /* Color */ -void colorSave(PackStream* stream, Color* col); -void colorLoad(PackStream* stream, Color* col); -Color colorFromValues(double r, double g, double b, double a); +RENDERINGSHARED_EXPORT void colorSave(PackStream* stream, Color* col); +RENDERINGSHARED_EXPORT void colorLoad(PackStream* stream, Color* col); +RENDERINGSHARED_EXPORT Color colorFromValues(double r, double g, double b, double a); -unsigned int colorTo32BitRGBA(Color* col); -unsigned int colorTo32BitBGRA(Color* col); -unsigned int colorTo32BitARGB(Color* col); -unsigned int colorTo32BitABGR(Color* col); +RENDERINGSHARED_EXPORT unsigned int colorTo32BitRGBA(Color* col); +RENDERINGSHARED_EXPORT unsigned int colorTo32BitBGRA(Color* col); +RENDERINGSHARED_EXPORT unsigned int colorTo32BitARGB(Color* col); +RENDERINGSHARED_EXPORT unsigned int colorTo32BitABGR(Color* col); -Color colorFrom32BitRGBA(unsigned int col); -Color colorFrom32BitBGRA(unsigned int col); -Color colorFrom32BitARGB(unsigned int col); -Color colorFrom32BitABGR(unsigned int col); +RENDERINGSHARED_EXPORT Color colorFrom32BitRGBA(unsigned int col); +RENDERINGSHARED_EXPORT Color colorFrom32BitBGRA(unsigned int col); +RENDERINGSHARED_EXPORT Color colorFrom32BitARGB(unsigned int col); +RENDERINGSHARED_EXPORT Color colorFrom32BitABGR(unsigned int col); -void colorMask(Color* base, Color* mask); -double colorNormalize(Color* col); -double colorGetValue(Color* col); +RENDERINGSHARED_EXPORT void colorMask(Color* base, Color* mask); +RENDERINGSHARED_EXPORT double colorNormalize(Color* col); +RENDERINGSHARED_EXPORT double colorGetValue(Color* col); -double colorGetPower(Color* col); -void colorLimitPower(Color* col, double max_power); +RENDERINGSHARED_EXPORT double colorGetPower(Color* col); +RENDERINGSHARED_EXPORT void colorLimitPower(Color* col, double max_power); /* HDR profile for tone-mapping */ typedef struct ColorProfile ColorProfile; @@ -56,41 +57,41 @@ typedef enum TONE_MAPPING_CLAMP } ToneMappingOperator; -ColorProfile* colorProfileCreate(); -void colorProfileDelete(ColorProfile* profile); +RENDERINGSHARED_EXPORT ColorProfile* colorProfileCreate(); +RENDERINGSHARED_EXPORT void colorProfileDelete(ColorProfile* profile); -void colorProfileSetToneMapping(ColorProfile* profile, ToneMappingOperator tonemapper, double exposure); +RENDERINGSHARED_EXPORT void colorProfileSetToneMapping(ColorProfile* profile, ToneMappingOperator tonemapper, double exposure); -void colorProfileSave(PackStream* stream, ColorProfile* profile); -void colorProfileLoad(PackStream* stream, ColorProfile* profile); +RENDERINGSHARED_EXPORT void colorProfileSave(PackStream* stream, ColorProfile* profile); +RENDERINGSHARED_EXPORT void colorProfileLoad(PackStream* stream, ColorProfile* profile); -void colorProfileClear(ColorProfile* profile); -int colorProfileCollect(ColorProfile* profile, Color pixel); -Color colorProfileApply(ColorProfile* profile, Color pixel); +RENDERINGSHARED_EXPORT void colorProfileClear(ColorProfile* profile); +RENDERINGSHARED_EXPORT int colorProfileCollect(ColorProfile* profile, Color pixel); +RENDERINGSHARED_EXPORT Color colorProfileApply(ColorProfile* profile, Color pixel); /* ColorGradation */ typedef struct ColorGradation ColorGradation; -ColorGradation* colorGradationCreate(); -void colorGradationDelete(ColorGradation* gradation); -void colorGradationCopy(ColorGradation* source, ColorGradation* destination); -void colorGradationClear(ColorGradation* gradation); +RENDERINGSHARED_EXPORT ColorGradation* colorGradationCreate(); +RENDERINGSHARED_EXPORT void colorGradationDelete(ColorGradation* gradation); +RENDERINGSHARED_EXPORT void colorGradationCopy(ColorGradation* source, ColorGradation* destination); +RENDERINGSHARED_EXPORT void colorGradationClear(ColorGradation* gradation); -void colorGradationSave(PackStream* stream, ColorGradation* gradation); -void colorGradationLoad(PackStream* stream, ColorGradation* gradation); +RENDERINGSHARED_EXPORT void colorGradationSave(PackStream* stream, ColorGradation* gradation); +RENDERINGSHARED_EXPORT void colorGradationLoad(PackStream* stream, ColorGradation* gradation); -void colorGradationGetRedCurve(ColorGradation* gradation, Curve* curve); -void colorGradationGetGreenCurve(ColorGradation* gradation, Curve* curve); -void colorGradationGetBlueCurve(ColorGradation* gradation, Curve* curve); +RENDERINGSHARED_EXPORT void colorGradationGetRedCurve(ColorGradation* gradation, Curve* curve); +RENDERINGSHARED_EXPORT void colorGradationGetGreenCurve(ColorGradation* gradation, Curve* curve); +RENDERINGSHARED_EXPORT void colorGradationGetBlueCurve(ColorGradation* gradation, Curve* curve); -void colorGradationSetRedCurve(ColorGradation* gradation, Curve* curve); -void colorGradationSetGreenCurve(ColorGradation* gradation, Curve* curve); -void colorGradationSetBlueCurve(ColorGradation* gradation, Curve* curve); +RENDERINGSHARED_EXPORT void colorGradationSetRedCurve(ColorGradation* gradation, Curve* curve); +RENDERINGSHARED_EXPORT void colorGradationSetGreenCurve(ColorGradation* gradation, Curve* curve); +RENDERINGSHARED_EXPORT void colorGradationSetBlueCurve(ColorGradation* gradation, Curve* curve); -void colorGradationQuickAdd(ColorGradation* gradation, double value, Color* col); -void colorGradationQuickAddRgb(ColorGradation* gradation, double value, double r, double g, double b); +RENDERINGSHARED_EXPORT void colorGradationQuickAdd(ColorGradation* gradation, double value, Color* col); +RENDERINGSHARED_EXPORT void colorGradationQuickAddRgb(ColorGradation* gradation, double value, double r, double g, double b); -Color colorGradationGet(ColorGradation* gradation, double value); +RENDERINGSHARED_EXPORT Color colorGradationGet(ColorGradation* gradation, double value); /* HSL color space */ typedef struct @@ -101,10 +102,10 @@ typedef struct double a; } ColorHSL; -Color colorFromHSL(ColorHSL col); -ColorHSL colorToHSL(Color col); +RENDERINGSHARED_EXPORT Color colorFromHSL(ColorHSL col); +RENDERINGSHARED_EXPORT ColorHSL colorToHSL(Color col); -ColorHSL colorHSLFromValues(double h, double s, double l, double a); +RENDERINGSHARED_EXPORT ColorHSL colorHSLFromValues(double h, double s, double l, double a); #ifdef __cplusplus } diff --git a/src/rendering/tools/curve.h b/src/rendering/tools/curve.h index 9d1f8a8..8d51ba5 100644 --- a/src/rendering/tools/curve.h +++ b/src/rendering/tools/curve.h @@ -1,6 +1,7 @@ #ifndef _PAYSAGES_TOOLS_CURVE_H_ #define _PAYSAGES_TOOLS_CURVE_H_ +#include "../rendering_global.h" #include "pack.h" #ifdef __cplusplus @@ -13,24 +14,24 @@ typedef struct { } CurvePoint; typedef struct Curve Curve; -Curve* curveCreate(); -void curveDelete(Curve* curve); -void curveCopy(Curve* source, Curve* destination); +RENDERINGSHARED_EXPORT Curve* curveCreate(); +RENDERINGSHARED_EXPORT void curveDelete(Curve* curve); +RENDERINGSHARED_EXPORT void curveCopy(Curve* source, Curve* destination); -void curveSave(PackStream* stream, Curve* curve); -void curveLoad(PackStream* stream, Curve* curve); +RENDERINGSHARED_EXPORT void curveSave(PackStream* stream, Curve* curve); +RENDERINGSHARED_EXPORT void curveLoad(PackStream* stream, Curve* curve); -void curveClear(Curve* curve); -void curveSetDefault(Curve* curve, double value); -int curveAddPoint(Curve* curve, CurvePoint* point); -int curveQuickAddPoint(Curve* curve, double position, double value); -int curveGetPointCount(Curve* curve); -void curveGetPoint(Curve* curve, int number, CurvePoint* point); -void curveSetPoint(Curve* curve, int number, CurvePoint* point); -void curveRemovePoint(Curve* curve, int number); -void curveValidate(Curve* curve); +RENDERINGSHARED_EXPORT void curveClear(Curve* curve); +RENDERINGSHARED_EXPORT void curveSetDefault(Curve* curve, double value); +RENDERINGSHARED_EXPORT int curveAddPoint(Curve* curve, CurvePoint* point); +RENDERINGSHARED_EXPORT int curveQuickAddPoint(Curve* curve, double position, double value); +RENDERINGSHARED_EXPORT int curveGetPointCount(Curve* curve); +RENDERINGSHARED_EXPORT void curveGetPoint(Curve* curve, int number, CurvePoint* point); +RENDERINGSHARED_EXPORT void curveSetPoint(Curve* curve, int number, CurvePoint* point); +RENDERINGSHARED_EXPORT void curveRemovePoint(Curve* curve, int number); +RENDERINGSHARED_EXPORT void curveValidate(Curve* curve); -double curveGetValue(Curve* curve, double position); +RENDERINGSHARED_EXPORT double curveGetValue(Curve* curve, double position); #ifdef __cplusplus } diff --git a/src/rendering/tools/data.h b/src/rendering/tools/data.h index f5c77b1..f5fcbc2 100644 --- a/src/rendering/tools/data.h +++ b/src/rendering/tools/data.h @@ -1,10 +1,12 @@ #ifndef _PAYSAGES_TOOLS_DATA_H_ #define _PAYSAGES_TOOLS_DATA_H_ +#include "../rendering_global.h" + /* * Data directory management. */ -int dataInit(); +RENDERINGSHARED_EXPORT int dataInit(); #endif diff --git a/src/rendering/tools/euclid.h b/src/rendering/tools/euclid.h index 90f68a6..45c073e 100644 --- a/src/rendering/tools/euclid.h +++ b/src/rendering/tools/euclid.h @@ -1,6 +1,7 @@ #ifndef _PAYSAGES_TOOLS_EUCLID_H_ #define _PAYSAGES_TOOLS_EUCLID_H_ +#include "../rendering_global.h" #include "pack.h" /* @@ -69,57 +70,57 @@ typedef struct double p; } Matrix4; -extern Vector3 VECTOR_ZERO; -extern Vector3 VECTOR_DOWN; -extern Vector3 VECTOR_UP; -extern Vector3 VECTOR_NORTH; -extern Vector3 VECTOR_SOUTH; -extern Vector3 VECTOR_EAST; -extern Vector3 VECTOR_WEST; +RENDERINGSHARED_EXPORT extern Vector3 VECTOR_ZERO; +RENDERINGSHARED_EXPORT extern Vector3 VECTOR_DOWN; +RENDERINGSHARED_EXPORT extern Vector3 VECTOR_UP; +RENDERINGSHARED_EXPORT extern Vector3 VECTOR_NORTH; +RENDERINGSHARED_EXPORT extern Vector3 VECTOR_SOUTH; +RENDERINGSHARED_EXPORT extern Vector3 VECTOR_EAST; +RENDERINGSHARED_EXPORT extern Vector3 VECTOR_WEST; static inline Vector3 v3(double x, double y, double z) { Vector3 result = {x, y, z}; return result; }; -void v3Save(PackStream* stream, Vector3* v); -void v3Load(PackStream* stream, Vector3* v); -Vector3 v3Translate(Vector3 v1, double x, double y, double z); -Vector3 v3Add(Vector3 v1, Vector3 v2); -Vector3 v3Sub(Vector3 v1, Vector3 v2); -Vector3 v3Neg(Vector3 v); -Vector3 v3Scale(Vector3 v, double scale); -double v3Norm(Vector3 v); -Vector3 v3Normalize(Vector3 v); -double v3Dot(Vector3 v1, Vector3 v2); -Vector3 v3Cross(Vector3 v1, Vector3 v2); -VectorSpherical v3ToSpherical(Vector3 v); -Vector3 v3FromSpherical(VectorSpherical v); +RENDERINGSHARED_EXPORT void v3Save(PackStream* stream, Vector3* v); +RENDERINGSHARED_EXPORT void v3Load(PackStream* stream, Vector3* v); +RENDERINGSHARED_EXPORT Vector3 v3Translate(Vector3 v1, double x, double y, double z); +RENDERINGSHARED_EXPORT Vector3 v3Add(Vector3 v1, Vector3 v2); +RENDERINGSHARED_EXPORT Vector3 v3Sub(Vector3 v1, Vector3 v2); +RENDERINGSHARED_EXPORT Vector3 v3Neg(Vector3 v); +RENDERINGSHARED_EXPORT Vector3 v3Scale(Vector3 v, double scale); +RENDERINGSHARED_EXPORT double v3Norm(Vector3 v); +RENDERINGSHARED_EXPORT Vector3 v3Normalize(Vector3 v); +RENDERINGSHARED_EXPORT double v3Dot(Vector3 v1, Vector3 v2); +RENDERINGSHARED_EXPORT Vector3 v3Cross(Vector3 v1, Vector3 v2); +RENDERINGSHARED_EXPORT VectorSpherical v3ToSpherical(Vector3 v); +RENDERINGSHARED_EXPORT Vector3 v3FromSpherical(VectorSpherical v); -void m4Save(PackStream* stream, Matrix4* m); -void m4Load(PackStream* stream, Matrix4* m); -Matrix4 m4NewIdentity(); -Matrix4 m4Mult(Matrix4 m1, Matrix4 m2); -Vector3 m4MultPoint(Matrix4 m, Vector3 v); -Vector3 m4Transform(Matrix4 m, Vector3 v); -Matrix4 m4Transpose(Matrix4 m); -Matrix4 m4NewScale(double x, double y, double z); -Matrix4 m4NewTranslate(double x, double y, double z); -Matrix4 m4NewRotateX(double angle); -Matrix4 m4NewRotateY(double angle); -Matrix4 m4NewRotateZ(double angle); -Matrix4 m4NewRotateAxis(double angle, Vector3 axis); -Matrix4 m4NewRotateEuler(double heading, double attitude, double bank); -Matrix4 m4NewRotateTripleAxis(Vector3 x, Vector3 y, Vector3 z); -Matrix4 m4NewLookAt(Vector3 eye, Vector3 at, Vector3 up); -Matrix4 m4NewPerspective(double fov_y, double aspect, double near, double far); -double m4Determinant(Matrix4 m); -Matrix4 m4Inverse(Matrix4 m); +RENDERINGSHARED_EXPORT void m4Save(PackStream* stream, Matrix4* m); +RENDERINGSHARED_EXPORT void m4Load(PackStream* stream, Matrix4* m); +RENDERINGSHARED_EXPORT Matrix4 m4NewIdentity(); +RENDERINGSHARED_EXPORT Matrix4 m4Mult(Matrix4 m1, Matrix4 m2); +RENDERINGSHARED_EXPORT Vector3 m4MultPoint(Matrix4 m, Vector3 v); +RENDERINGSHARED_EXPORT Vector3 m4Transform(Matrix4 m, Vector3 v); +RENDERINGSHARED_EXPORT Matrix4 m4Transpose(Matrix4 m); +RENDERINGSHARED_EXPORT Matrix4 m4NewScale(double x, double y, double z); +RENDERINGSHARED_EXPORT Matrix4 m4NewTranslate(double x, double y, double z); +RENDERINGSHARED_EXPORT Matrix4 m4NewRotateX(double angle); +RENDERINGSHARED_EXPORT Matrix4 m4NewRotateY(double angle); +RENDERINGSHARED_EXPORT Matrix4 m4NewRotateZ(double angle); +RENDERINGSHARED_EXPORT Matrix4 m4NewRotateAxis(double angle, Vector3 axis); +RENDERINGSHARED_EXPORT Matrix4 m4NewRotateEuler(double heading, double attitude, double bank); +RENDERINGSHARED_EXPORT Matrix4 m4NewRotateTripleAxis(Vector3 x, Vector3 y, Vector3 z); +RENDERINGSHARED_EXPORT Matrix4 m4NewLookAt(Vector3 eye, Vector3 at, Vector3 up); +RENDERINGSHARED_EXPORT Matrix4 m4NewPerspective(double fov_y, double aspect, double near, double far); +RENDERINGSHARED_EXPORT double m4Determinant(Matrix4 m); +RENDERINGSHARED_EXPORT Matrix4 m4Inverse(Matrix4 m); -double euclidGet2DAngle(double x, double y); -Vector3 euclidGetNormalFromTriangle(Vector3 center, Vector3 bottom, Vector3 right); -double euclidGetDistance2D(double x1, double y1, double x2, double y2); -int euclidRayIntersectSphere(Vector3 ray_point, Vector3 ray_direction, Vector3 sphere_center, double sphere_radius, Vector3* hit1, Vector3* hit2); +RENDERINGSHARED_EXPORT double euclidGet2DAngle(double x, double y); +RENDERINGSHARED_EXPORT Vector3 euclidGetNormalFromTriangle(Vector3 center, Vector3 bottom, Vector3 right); +RENDERINGSHARED_EXPORT double euclidGetDistance2D(double x1, double y1, double x2, double y2); +RENDERINGSHARED_EXPORT int euclidRayIntersectSphere(Vector3 ray_point, Vector3 ray_direction, Vector3 sphere_center, double sphere_radius, Vector3* hit1, Vector3* hit2); #ifdef __cplusplus } diff --git a/src/rendering/tools/lighting.h b/src/rendering/tools/lighting.h index 712c06a..3b113a7 100644 --- a/src/rendering/tools/lighting.h +++ b/src/rendering/tools/lighting.h @@ -1,6 +1,7 @@ #ifndef _PAYSAGES_TOOLS_LIGHTING_H_ #define _PAYSAGES_TOOLS_LIGHTING_H_ +#include "../rendering_global.h" #include "euclid.h" #include "color.h" #include "pack.h" @@ -35,22 +36,22 @@ typedef int (*FuncLightingAlterLight)(void* data, LightDefinition* light, Vector typedef struct LightingManager LightingManager; typedef struct LightStatus LightStatus; -LightingManager* lightingManagerCreate(); -void lightingManagerDelete(LightingManager* filter); -void lightingManagerRegisterFilter(LightingManager* filter, FuncLightingAlterLight callback, void* data); -void lightingManagerDisableSpecularity(LightingManager* manager); +RENDERINGSHARED_EXPORT LightingManager* lightingManagerCreate(); +RENDERINGSHARED_EXPORT void lightingManagerDelete(LightingManager* filter); +RENDERINGSHARED_EXPORT void lightingManagerRegisterFilter(LightingManager* filter, FuncLightingAlterLight callback, void* data); +RENDERINGSHARED_EXPORT void lightingManagerDisableSpecularity(LightingManager* manager); -LightStatus* lightingCreateStatus(LightingManager* manager, Vector3 location, Vector3 eye); -void lightingDeleteStatus(LightStatus* status); -void lightingPushLight(LightStatus* status, LightDefinition* light); -Color lightingApplyStatus(LightStatus* status, Vector3 normal, SurfaceMaterial* material); -Vector3 lightingGetStatusLocation(LightStatus* status); +RENDERINGSHARED_EXPORT LightStatus* lightingCreateStatus(LightingManager* manager, Vector3 location, Vector3 eye); +RENDERINGSHARED_EXPORT void lightingDeleteStatus(LightStatus* status); +RENDERINGSHARED_EXPORT void lightingPushLight(LightStatus* status, LightDefinition* light); +RENDERINGSHARED_EXPORT Color lightingApplyStatus(LightStatus* status, Vector3 normal, SurfaceMaterial* material); +RENDERINGSHARED_EXPORT Vector3 lightingGetStatusLocation(LightStatus* status); -Color lightingApplyOneLight(LightDefinition* light, Vector3 eye, Vector3 location, Vector3 normal, SurfaceMaterial* material); +RENDERINGSHARED_EXPORT Color lightingApplyOneLight(LightDefinition* light, Vector3 eye, Vector3 location, Vector3 normal, SurfaceMaterial* material); -void materialSave(PackStream* stream, SurfaceMaterial* material); -void materialLoad(PackStream* stream, SurfaceMaterial* material); -void materialValidate(SurfaceMaterial* material); +RENDERINGSHARED_EXPORT void materialSave(PackStream* stream, SurfaceMaterial* material); +RENDERINGSHARED_EXPORT void materialLoad(PackStream* stream, SurfaceMaterial* material); +RENDERINGSHARED_EXPORT void materialValidate(SurfaceMaterial* material); #ifdef __cplusplus } diff --git a/src/rendering/tools/memory.h b/src/rendering/tools/memory.h index 33bec41..17a323b 100644 --- a/src/rendering/tools/memory.h +++ b/src/rendering/tools/memory.h @@ -5,12 +5,14 @@ * Memory tools. */ +#include "../rendering_global.h" + #ifdef __cplusplus extern "C" { #endif -void* memory2dRealloc(void* data, int datasize, int oldxsize, int oldysize, int newxsize, int newysize, int xoffset, int yoffset); -void memory2dScrolling(void* data, int datasize, int xsize, int ysize, int xoffset, int yoffset); +RENDERINGSHARED_EXPORT void* memory2dRealloc(void* data, int datasize, int oldxsize, int oldysize, int newxsize, int newysize, int xoffset, int yoffset); +RENDERINGSHARED_EXPORT void memory2dScrolling(void* data, int datasize, int xsize, int ysize, int xoffset, int yoffset); #ifdef __cplusplus } diff --git a/src/rendering/tools/pack.h b/src/rendering/tools/pack.h index b7b0656..e83ceac 100644 --- a/src/rendering/tools/pack.h +++ b/src/rendering/tools/pack.h @@ -1,22 +1,24 @@ #ifndef _PAYSAGES_TOOLS_PACK_H_ #define _PAYSAGES_TOOLS_PACK_H_ +#include "../rendering_global.h" + #ifdef __cplusplus extern "C" { #endif typedef struct PackStream PackStream; -PackStream* packReadFile(const char* filepath); -PackStream* packWriteFile(const char* filepath); -void packCloseStream(PackStream* stream); +RENDERINGSHARED_EXPORT PackStream* packReadFile(const char* filepath); +RENDERINGSHARED_EXPORT PackStream* packWriteFile(const char* filepath); +RENDERINGSHARED_EXPORT void packCloseStream(PackStream* stream); -void packWriteDouble(PackStream* stream, double* value); -void packReadDouble(PackStream* stream, double* value); -void packWriteInt(PackStream* stream, int* value); -void packReadInt(PackStream* stream, int* value); -void packWriteString(PackStream* stream, char* value, int max_length); -void packReadString(PackStream* stream, char* value, int max_length); +RENDERINGSHARED_EXPORT void packWriteDouble(PackStream* stream, double* value); +RENDERINGSHARED_EXPORT void packReadDouble(PackStream* stream, double* value); +RENDERINGSHARED_EXPORT void packWriteInt(PackStream* stream, int* value); +RENDERINGSHARED_EXPORT void packReadInt(PackStream* stream, int* value); +RENDERINGSHARED_EXPORT void packWriteString(PackStream* stream, char* value, int max_length); +RENDERINGSHARED_EXPORT void packReadString(PackStream* stream, char* value, int max_length); #ifdef __cplusplus } diff --git a/src/rendering/tools/parallel.h b/src/rendering/tools/parallel.h index 150c339..004cad2 100644 --- a/src/rendering/tools/parallel.h +++ b/src/rendering/tools/parallel.h @@ -1,6 +1,8 @@ #ifndef _PAYSAGES_TOOLS_PARALLEL_H_ #define _PAYSAGES_TOOLS_PARALLEL_H_ +#include "../rendering_global.h" + /* * Parallel processing helpers. * @@ -25,7 +27,7 @@ typedef int (*ParallelUnitFunction)(ParallelWork* work, int unit, void* data); * @param data Custom data that will be passed to the callback. * @return The newly allocated handler. */ -ParallelWork* parallelWorkCreate(ParallelUnitFunction func, int units, void* data); +RENDERINGSHARED_EXPORT ParallelWork* parallelWorkCreate(ParallelUnitFunction func, int units, void* data); /** * Delete a parallel work handler. @@ -33,7 +35,7 @@ ParallelWork* parallelWorkCreate(ParallelUnitFunction func, int units, void* dat * The work must be terminated or fully interrupted before calling this. * @param work The handler to free. */ -void parallelWorkDelete(ParallelWork* work); +RENDERINGSHARED_EXPORT void parallelWorkDelete(ParallelWork* work); /** * Start working on the units. @@ -41,7 +43,7 @@ void parallelWorkDelete(ParallelWork* work); * @param work The handler. * @param workers Number of threads to spaws, -1 for an optimal number. */ -int parallelWorkPerform(ParallelWork* work, int workers); +RENDERINGSHARED_EXPORT int parallelWorkPerform(ParallelWork* work, int workers); @@ -55,7 +57,7 @@ typedef int (*FuncParallelJob)(ParallelQueue* queue, int job_id, void* data, int * @param collect True to collect finished jobs and wait for a call to parallelQueueCollectJobs, False to discard finished jobs. * @return The newly allocated queue. */ -ParallelQueue* parallelQueueCreate(int collect); +RENDERINGSHARED_EXPORT ParallelQueue* parallelQueueCreate(int collect); /** * Delete a parallel queue. @@ -64,7 +66,7 @@ ParallelQueue* parallelQueueCreate(int collect); * If the queue is in collect mode, you should call parallelQueueInterrupt, then parallelQueueCollectJobs, before calling this. * @param queue The queue to free. */ -void parallelQueueDelete(ParallelQueue* queue); +RENDERINGSHARED_EXPORT void parallelQueueDelete(ParallelQueue* queue); /** * Interrupt the queue processing. @@ -73,7 +75,7 @@ void parallelQueueDelete(ParallelQueue* queue); * refuse future jobs. * @param queue The queue to interrupt. */ -void parallelQueueInterrupt(ParallelQueue* queue); +RENDERINGSHARED_EXPORT void parallelQueueInterrupt(ParallelQueue* queue); /** * Wait for all jobs to finish. @@ -81,7 +83,7 @@ void parallelQueueInterrupt(ParallelQueue* queue); * This function will return as soon as there is no pending jobs. It is recommended to stop feeding the queue, or this * function may never return. */ -void parallelQueueWait(ParallelQueue* queue); +RENDERINGSHARED_EXPORT void parallelQueueWait(ParallelQueue* queue); /** * Add a job to the queue. @@ -92,7 +94,7 @@ void parallelQueueWait(ParallelQueue* queue); * @param data The data that will be passed to the callback. * @return The job ID, 0 if the queue doesn't accept jobs. */ -int parallelQueueAddJob(ParallelQueue* queue, FuncParallelJob func_process, void* data); +RENDERINGSHARED_EXPORT int parallelQueueAddJob(ParallelQueue* queue, FuncParallelJob func_process, void* data); /** * Collect finished jobs. @@ -102,7 +104,7 @@ int parallelQueueAddJob(ParallelQueue* queue, FuncParallelJob func_process, void * @param func_collect The callback for collect. * @return The number of collected jobs. */ -int parallelQueueCollectJobs(FuncParallelJob func_collect); +RENDERINGSHARED_EXPORT int parallelQueueCollectJobs(FuncParallelJob func_collect); #ifdef __cplusplus } diff --git a/src/rendering/tools/texture.h b/src/rendering/tools/texture.h index a9159ff..6d3a74f 100644 --- a/src/rendering/tools/texture.h +++ b/src/rendering/tools/texture.h @@ -9,6 +9,7 @@ extern "C" { #endif +#include "../rendering_global.h" #include "color.h" #include "pack.h" @@ -16,47 +17,47 @@ typedef struct Texture2D Texture2D; typedef struct Texture3D Texture3D; typedef struct Texture4D Texture4D; -Texture2D* texture2DCreate(int xsize, int ysize); -void texture2DDelete(Texture2D* tex); -void texture2DGetSize(Texture2D* tex, int* xsize, int* ysize); -void texture2DSetPixel(Texture2D* tex, int x, int y, Color col); -Color texture2DGetPixel(Texture2D* tex, int x, int y); -Color texture2DGetNearest(Texture2D* tex, double dx, double dy); -Color texture2DGetLinear(Texture2D* tex, double dx, double dy); -Color texture2DGetCubic(Texture2D* tex, double dx, double dy); -void texture2DFill(Texture2D* tex, Color col); -void texture2DAdd(Texture2D* source, Texture2D* destination); -void texture2DSave(PackStream* stream, Texture2D* tex); -void texture2DLoad(PackStream* stream, Texture2D* tex); -void texture2DSaveToFile(Texture2D* tex, const char* filepath); +RENDERINGSHARED_EXPORT Texture2D* texture2DCreate(int xsize, int ysize); +RENDERINGSHARED_EXPORT void texture2DDelete(Texture2D* tex); +RENDERINGSHARED_EXPORT void texture2DGetSize(Texture2D* tex, int* xsize, int* ysize); +RENDERINGSHARED_EXPORT void texture2DSetPixel(Texture2D* tex, int x, int y, Color col); +RENDERINGSHARED_EXPORT Color texture2DGetPixel(Texture2D* tex, int x, int y); +RENDERINGSHARED_EXPORT Color texture2DGetNearest(Texture2D* tex, double dx, double dy); +RENDERINGSHARED_EXPORT Color texture2DGetLinear(Texture2D* tex, double dx, double dy); +RENDERINGSHARED_EXPORT Color texture2DGetCubic(Texture2D* tex, double dx, double dy); +RENDERINGSHARED_EXPORT void texture2DFill(Texture2D* tex, Color col); +RENDERINGSHARED_EXPORT void texture2DAdd(Texture2D* source, Texture2D* destination); +RENDERINGSHARED_EXPORT void texture2DSave(PackStream* stream, Texture2D* tex); +RENDERINGSHARED_EXPORT void texture2DLoad(PackStream* stream, Texture2D* tex); +RENDERINGSHARED_EXPORT void texture2DSaveToFile(Texture2D* tex, const char* filepath); -Texture3D* texture3DCreate(int xsize, int ysize, int zsize); -void texture3DDelete(Texture3D* tex); -void texture3DGetSize(Texture3D* tex, int* xsize, int* ysize, int* zsize); -void texture3DSetPixel(Texture3D* tex, int x, int y, int z, Color col); -Color texture3DGetPixel(Texture3D* tex, int x, int y, int z); -Color texture3DGetNearest(Texture3D* tex, double dx, double dy, double dz); -Color texture3DGetLinear(Texture3D* tex, double dx, double dy, double dz); -Color texture3DGetCubic(Texture3D* tex, double dx, double dy, double dz); -void texture3DFill(Texture3D* tex, Color col); -void texture3DAdd(Texture3D* source, Texture3D* destination); -void texture3DSave(PackStream* stream, Texture3D* tex); -void texture3DLoad(PackStream* stream, Texture3D* tex); -void texture3DSaveToFile(Texture3D* tex, const char* filepath); +RENDERINGSHARED_EXPORT Texture3D* texture3DCreate(int xsize, int ysize, int zsize); +RENDERINGSHARED_EXPORT void texture3DDelete(Texture3D* tex); +RENDERINGSHARED_EXPORT void texture3DGetSize(Texture3D* tex, int* xsize, int* ysize, int* zsize); +RENDERINGSHARED_EXPORT void texture3DSetPixel(Texture3D* tex, int x, int y, int z, Color col); +RENDERINGSHARED_EXPORT Color texture3DGetPixel(Texture3D* tex, int x, int y, int z); +RENDERINGSHARED_EXPORT Color texture3DGetNearest(Texture3D* tex, double dx, double dy, double dz); +RENDERINGSHARED_EXPORT Color texture3DGetLinear(Texture3D* tex, double dx, double dy, double dz); +RENDERINGSHARED_EXPORT Color texture3DGetCubic(Texture3D* tex, double dx, double dy, double dz); +RENDERINGSHARED_EXPORT void texture3DFill(Texture3D* tex, Color col); +RENDERINGSHARED_EXPORT void texture3DAdd(Texture3D* source, Texture3D* destination); +RENDERINGSHARED_EXPORT void texture3DSave(PackStream* stream, Texture3D* tex); +RENDERINGSHARED_EXPORT void texture3DLoad(PackStream* stream, Texture3D* tex); +RENDERINGSHARED_EXPORT void texture3DSaveToFile(Texture3D* tex, const char* filepath); -Texture4D* texture4DCreate(int xsize, int ysize, int zsize, int wsize); -void texture4DDelete(Texture4D* tex); -void texture4DGetSize(Texture4D* tex, int* xsize, int* ysize, int* zsize, int* wsize); -void texture4DSetPixel(Texture4D* tex, int x, int y, int z, int w, Color col); -Color texture4DGetPixel(Texture4D* tex, int x, int y, int z, int w); -Color texture4DGetNearest(Texture4D* tex, double dx, double dy, double dz, double dw); -Color texture4DGetLinear(Texture4D* tex, double dx, double dy, double dz, double dw); -Color texture4DGetCubic(Texture4D* tex, double dx, double dy, double dz, double dw); -void texture4DFill(Texture4D* tex, Color col); -void texture4DAdd(Texture4D* source, Texture4D* destination); -void texture4DSave(PackStream* stream, Texture4D* tex); -void texture4DLoad(PackStream* stream, Texture4D* tex); -void texture4DSaveToFile(Texture4D* tex, const char* filepath); +RENDERINGSHARED_EXPORT Texture4D* texture4DCreate(int xsize, int ysize, int zsize, int wsize); +RENDERINGSHARED_EXPORT void texture4DDelete(Texture4D* tex); +RENDERINGSHARED_EXPORT void texture4DGetSize(Texture4D* tex, int* xsize, int* ysize, int* zsize, int* wsize); +RENDERINGSHARED_EXPORT void texture4DSetPixel(Texture4D* tex, int x, int y, int z, int w, Color col); +RENDERINGSHARED_EXPORT Color texture4DGetPixel(Texture4D* tex, int x, int y, int z, int w); +RENDERINGSHARED_EXPORT Color texture4DGetNearest(Texture4D* tex, double dx, double dy, double dz, double dw); +RENDERINGSHARED_EXPORT Color texture4DGetLinear(Texture4D* tex, double dx, double dy, double dz, double dw); +RENDERINGSHARED_EXPORT Color texture4DGetCubic(Texture4D* tex, double dx, double dy, double dz, double dw); +RENDERINGSHARED_EXPORT void texture4DFill(Texture4D* tex, Color col); +RENDERINGSHARED_EXPORT void texture4DAdd(Texture4D* source, Texture4D* destination); +RENDERINGSHARED_EXPORT void texture4DSave(PackStream* stream, Texture4D* tex); +RENDERINGSHARED_EXPORT void texture4DLoad(PackStream* stream, Texture4D* tex); +RENDERINGSHARED_EXPORT void texture4DSaveToFile(Texture4D* tex, const char* filepath); #ifdef __cplusplus } diff --git a/src/rendering/tools/zone.h b/src/rendering/tools/zone.h index 44e74d8..f9c040d 100644 --- a/src/rendering/tools/zone.h +++ b/src/rendering/tools/zone.h @@ -5,6 +5,7 @@ * Definition of a geographic area. */ +#include "../rendering_global.h" #include "rendering/tools/euclid.h" #include "rendering/tools/curve.h" #include "rendering/tools/pack.h" @@ -15,28 +16,28 @@ extern "C" { typedef struct Zone Zone; -Zone* zoneCreate(); -void zoneDelete(Zone* zone); -void zoneSave(PackStream* stream, Zone* zone); -void zoneLoad(PackStream* stream, Zone* zone); -void zoneCopy(Zone* source, Zone* destination); -void zoneClear(Zone* zone); +RENDERINGSHARED_EXPORT Zone* zoneCreate(); +RENDERINGSHARED_EXPORT void zoneDelete(Zone* zone); +RENDERINGSHARED_EXPORT void zoneSave(PackStream* stream, Zone* zone); +RENDERINGSHARED_EXPORT void zoneLoad(PackStream* stream, Zone* zone); +RENDERINGSHARED_EXPORT void zoneCopy(Zone* source, Zone* destination); +RENDERINGSHARED_EXPORT void zoneClear(Zone* zone); -void zoneSetAbsoluteHeight(Zone* zone); -void zoneSetRelativeHeight(Zone* zone, double min, double middle, double max); +RENDERINGSHARED_EXPORT void zoneSetAbsoluteHeight(Zone* zone); +RENDERINGSHARED_EXPORT void zoneSetRelativeHeight(Zone* zone, double min, double middle, double max); -void zoneIncludeCircleArea(Zone* zone, double value, double centerx, double centerz, double softradius, double hardradius); -void zoneExcludeCircleArea(Zone* zone, double centerx, double centerz, double softradius, double hardradius); +RENDERINGSHARED_EXPORT void zoneIncludeCircleArea(Zone* zone, double value, double centerx, double centerz, double softradius, double hardradius); +RENDERINGSHARED_EXPORT void zoneExcludeCircleArea(Zone* zone, double centerx, double centerz, double softradius, double hardradius); -void zoneGetHeightCurve(Zone* zone, Curve* curve); -void zoneSetHeightCurve(Zone* zone, Curve* curve); -void zoneAddHeightRangeQuick(Zone* zone, double value, double hardmin, double softmin, double softmax, double hardmax); +RENDERINGSHARED_EXPORT void zoneGetHeightCurve(Zone* zone, Curve* curve); +RENDERINGSHARED_EXPORT void zoneSetHeightCurve(Zone* zone, Curve* curve); +RENDERINGSHARED_EXPORT void zoneAddHeightRangeQuick(Zone* zone, double value, double hardmin, double softmin, double softmax, double hardmax); -void zoneGetSlopeCurve(Zone* zone, Curve* curve); -void zoneSetSlopeCurve(Zone* zone, Curve* curve); -void zoneAddSlopeRangeQuick(Zone* zone, double value, double hardmin, double softmin, double softmax, double hardmax); +RENDERINGSHARED_EXPORT void zoneGetSlopeCurve(Zone* zone, Curve* curve); +RENDERINGSHARED_EXPORT void zoneSetSlopeCurve(Zone* zone, Curve* curve); +RENDERINGSHARED_EXPORT void zoneAddSlopeRangeQuick(Zone* zone, double value, double hardmin, double softmin, double softmax, double hardmax); -double zoneGetValue(Zone* zone, Vector3 location, Vector3 normal); +RENDERINGSHARED_EXPORT double zoneGetValue(Zone* zone, Vector3 location, Vector3 normal); #ifdef __cplusplus } diff --git a/src/rendering/water/public.h b/src/rendering/water/public.h index 381486e..9e23578 100644 --- a/src/rendering/water/public.h +++ b/src/rendering/water/public.h @@ -1,6 +1,7 @@ #ifndef _PAYSAGES_WATER_PUBLIC_H_ #define _PAYSAGES_WATER_PUBLIC_H_ +#include "../rendering_global.h" #include "../shared/types.h" #include "../tools/lighting.h" #include "../tools/curve.h" @@ -62,17 +63,17 @@ typedef struct } WaterRenderer; -extern StandardDefinition WaterDefinitionClass; -extern StandardRenderer WaterRendererClass; +RENDERINGSHARED_EXPORT extern StandardDefinition WaterDefinitionClass; +RENDERINGSHARED_EXPORT extern StandardRenderer WaterRendererClass; -void waterRenderSurface(Renderer* renderer); -void waterAutoPreset(WaterDefinition* definition, WaterPreset preset); +RENDERINGSHARED_EXPORT void waterRenderSurface(Renderer* renderer); +RENDERINGSHARED_EXPORT void waterAutoPreset(WaterDefinition* definition, WaterPreset preset); -Renderer* waterCreatePreviewCoverageRenderer(); -Color waterGetPreviewCoverage(Renderer* renderer, double x, double y, double scaling, int highlight_enabled); +RENDERINGSHARED_EXPORT Renderer* waterCreatePreviewCoverageRenderer(); +RENDERINGSHARED_EXPORT Color waterGetPreviewCoverage(Renderer* renderer, double x, double y, double scaling, int highlight_enabled); -Renderer* waterCreatePreviewColorRenderer(); -Color waterGetPreviewColor(Renderer* renderer, double x, double y, double scaling); +RENDERINGSHARED_EXPORT Renderer* waterCreatePreviewColorRenderer(); +RENDERINGSHARED_EXPORT Color waterGetPreviewColor(Renderer* renderer, double x, double y, double scaling); #ifdef __cplusplus } diff --git a/src/system/PictureFile.h b/src/system/PictureFile.h index 0b8f2c1..9a0dc2a 100644 --- a/src/system/PictureFile.h +++ b/src/system/PictureFile.h @@ -35,7 +35,7 @@ typedef struct #endif typedef Color (*PictureCallbackSavePixel)(void* data, int x, int y); -int systemSavePictureFile(const char* filepath, PictureCallbackSavePixel callback_pixel, void* data, int width, int height); +SYSTEMSHARED_EXPORT int systemSavePictureFile(const char* filepath, PictureCallbackSavePixel callback_pixel, void* data, int width, int height); #ifdef __cplusplus } diff --git a/src/system/system.pro b/src/system/system.pro index c1c8f2e..53c6a6e 100644 --- a/src/system/system.pro +++ b/src/system/system.pro @@ -6,18 +6,19 @@ #QT -= gui -TARGET = paysages_system TEMPLATE = lib +TARGET = paysages_system DEFINES += SYSTEM_LIBRARY +CONFIG(release, debug|release): DEFINES += NDEBUG SOURCES += \ PictureFile.cpp \ Thread.cpp \ Mutex.cpp -HEADERS +=\ - system_global.h \ +HEADERS += \ + system_global.h \ PictureFile.h \ Thread.h \ Mutex.h diff --git a/src/system/system_global.h b/src/system/system_global.h index a719757..a8db430 100644 --- a/src/system/system_global.h +++ b/src/system/system_global.h @@ -4,18 +4,20 @@ /* Shared object helpers */ #ifdef __cplusplus # include -# if defined(SYSTEM_LIBRARY) -# define SYSTEMSHARED_EXPORT Q_DECL_EXPORT -# else -# define SYSTEMSHARED_EXPORT Q_DECL_IMPORT -# endif #else # if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) -# define SYSTEMSHARED_EXPORT __declspec(dllimport) +# define Q_DECL_EXPORT __declspec(dllexport) +# define Q_DECL_IMPORT __declspec(dllimport) # else -# define SYSTEMSHARED_EXPORT +# define Q_DECL_EXPORT +# define Q_DECL_IMPORT # endif #endif +#if defined(SYSTEM_LIBRARY) +# define SYSTEMSHARED_EXPORT Q_DECL_EXPORT +#else +# define SYSTEMSHARED_EXPORT Q_DECL_IMPORT +#endif /* Namespace using */ #ifdef __cplusplus