From 5c2bc4b31e2c93168646f6c1b8d95ed223175cd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Thu, 7 Nov 2013 09:37:11 +0100 Subject: [PATCH] Refactoring for c++ --- src/basics/ColorRGB.cpp | 5 --- src/basics/ColorRGB.h | 10 ------ src/basics/basics.pro | 2 -- src/controlling/controlling.pro | 1 + src/controlling/main.cpp | 13 ++++--- src/definition/Layers.h | 18 +--------- src/definition/definition_global.h | 16 +-------- src/editing/basepreview.cpp | 1 + src/editing/basepreview.h | 10 ++++-- src/editing/common/mainwindow.cpp | 1 + src/editing/common/mainwindow.h | 8 ++++- src/editing/formrender.cpp | 5 +++ src/editing/formwater.cpp | 4 ++- src/editing/terrain/previewterrainshape.cpp | 1 + src/editing/terrain/widgetheightmap.cpp | 1 + src/editing/textures/PreviewCumul.h | 1 + src/editing/textures/PreviewLayerCoverage.h | 1 + src/editing/textures/PreviewLayerLook.h | 1 + src/render/opengl/ExplorerChunkSky.cpp | 3 +- src/render/opengl/ExplorerChunkTerrain.cpp | 1 + src/render/opengl/OpenGLRenderer.cpp | 1 + src/render/opengl/WidgetExplorer.cpp | 5 +++ src/rendering/Scenery.cpp | 8 +++++ src/rendering/Scenery.h | 39 +++++++-------------- src/rendering/atmosphere/atm_bruneton.cpp | 10 +++--- src/rendering/atmosphere/atm_definition.cpp | 6 ++-- src/rendering/atmosphere/atm_preview.cpp | 1 + src/rendering/atmosphere/atm_raster.cpp | 1 + src/rendering/atmosphere/public.h | 18 ++++------ src/rendering/camera.cpp | 8 +++-- src/rendering/camera.h | 9 ----- src/rendering/clouds/clo_density.h | 9 ----- src/rendering/clouds/clo_preview.cpp | 1 + src/rendering/clouds/clo_preview.h | 9 ----- src/rendering/clouds/clo_rendering.cpp | 1 + src/rendering/clouds/clo_walking.h | 9 ----- src/rendering/clouds/public.h | 10 +++--- src/rendering/geoarea.cpp | 1 + src/rendering/geoarea.h | 13 +++---- src/rendering/main.cpp | 5 +-- src/rendering/main.h | 8 ----- src/rendering/opencl.h | 8 ----- src/rendering/render.h | 9 ----- src/rendering/renderer.cpp | 6 ++++ src/rendering/renderer.h | 22 +++++------- src/rendering/shared/preview.h | 8 ----- src/rendering/shared/types.h | 8 ----- src/rendering/terrain/public.h | 10 +++--- src/rendering/terrain/ter_definition.cpp | 1 + src/rendering/terrain/ter_preview.cpp | 2 ++ src/rendering/terrain/ter_raster.cpp | 3 ++ src/rendering/terrain/ter_raster.h | 8 ----- src/rendering/terrain/ter_render.cpp | 1 + src/rendering/textures/public.h | 18 ++++------ src/rendering/textures/tex_definition.cpp | 1 + src/rendering/textures/tex_preview.h | 8 ----- src/rendering/tools.h | 8 ----- src/rendering/tools/array.h | 8 ----- src/rendering/tools/boundingbox.h | 8 ----- src/rendering/tools/cache.h | 8 ----- src/rendering/tools/color.h | 8 ----- src/rendering/tools/curve.h | 8 ----- src/rendering/tools/euclid.h | 9 ----- src/rendering/tools/lighting.h | 13 ++----- src/rendering/tools/memory.h | 8 ----- src/rendering/tools/parallel.h | 8 ----- src/rendering/tools/texture.cpp | 1 + src/rendering/tools/texture.h | 13 +++---- src/rendering/tools/zone.cpp | 7 ++-- src/rendering/tools/zone.h | 13 +++---- src/rendering/water/public.h | 10 +++--- src/rendering/water/wat_render.cpp | 1 + src/system/PictureFile.h | 9 ----- 73 files changed, 170 insertions(+), 358 deletions(-) delete mode 100644 src/basics/ColorRGB.cpp delete mode 100644 src/basics/ColorRGB.h diff --git a/src/basics/ColorRGB.cpp b/src/basics/ColorRGB.cpp deleted file mode 100644 index 2fa82ec..0000000 --- a/src/basics/ColorRGB.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "ColorRGB.h" - -ColorRGB::ColorRGB() -{ -} diff --git a/src/basics/ColorRGB.h b/src/basics/ColorRGB.h deleted file mode 100644 index 4c2998d..0000000 --- a/src/basics/ColorRGB.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef COLORRGB_H -#define COLORRGB_H - -class ColorRGB -{ -public: - ColorRGB(); -}; - -#endif // COLORRGB_H diff --git a/src/basics/basics.pro b/src/basics/basics.pro index 7f36060..6cc300a 100644 --- a/src/basics/basics.pro +++ b/src/basics/basics.pro @@ -12,7 +12,6 @@ TEMPLATE = lib DEFINES += BASICS_LIBRARY SOURCES += \ - ColorRGB.cpp \ NoiseGenerator.cpp \ NoiseFunctionNaive.cpp \ NoiseFunctionPerlin.cpp \ @@ -21,7 +20,6 @@ SOURCES += \ HEADERS +=\ basics_global.h \ - ColorRGB.h \ NoiseGenerator.h \ NoiseFunctionNaive.h \ NoiseFunctionPerlin.h \ diff --git a/src/controlling/controlling.pro b/src/controlling/controlling.pro index 148ca11..f1ffd65 100644 --- a/src/controlling/controlling.pro +++ b/src/controlling/controlling.pro @@ -14,6 +14,7 @@ SOURCES += \ 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 diff --git a/src/controlling/main.cpp b/src/controlling/main.cpp index 514559a..2a354d8 100644 --- a/src/controlling/main.cpp +++ b/src/controlling/main.cpp @@ -1,11 +1,14 @@ -#include -#include -#include -#include +#include +#include +#include +#include #include "rendering/main.h" #include "rendering/render.h" -#include "rendering/Scenery.h" +#include "rendering/renderer.h" +#include "rendering/atmosphere/public.h" +#include "rendering/camera.h" +#include "Scenery.h" void startRender(Renderer* renderer, char* outputpath, RenderParams params) { diff --git a/src/definition/Layers.h b/src/definition/Layers.h index 0c04ea5..85136b3 100644 --- a/src/definition/Layers.h +++ b/src/definition/Layers.h @@ -2,11 +2,8 @@ #define LAYERS_H #include "definition_global.h" -#include "LegacyLayer.h" - -#ifdef __cplusplus - #include "BaseDefinition.h" +#include "LegacyLayer.h" namespace paysages { namespace system {class PackStream;} @@ -61,15 +58,6 @@ private: } } -extern "C" { -#endif - -// Transitional C-API - -#ifndef __cplusplus -typedef struct Layers Layers; -#endif - DEFINITIONSHARED_EXPORT Layers* layersCreate(LayerType type, int max_layer_count); DEFINITIONSHARED_EXPORT Layers* layersCreateCopy(Layers* original); DEFINITIONSHARED_EXPORT void layersDelete(Layers* layers); @@ -90,8 +78,4 @@ DEFINITIONSHARED_EXPORT int layersAddLayer(Layers* layers, void* definition); DEFINITIONSHARED_EXPORT void layersDeleteLayer(Layers* layers, int layer); DEFINITIONSHARED_EXPORT void layersMove(Layers* layers, int layer, int new_position); -#ifdef __cplusplus -} -#endif - #endif // LAYERS_H diff --git a/src/definition/definition_global.h b/src/definition/definition_global.h index 81d2c02..da4e843 100644 --- a/src/definition/definition_global.h +++ b/src/definition/definition_global.h @@ -2,17 +2,7 @@ #define DEFINITION_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 +#include #if defined(DEFINITION_LIBRARY) # define DEFINITIONSHARED_EXPORT Q_DECL_EXPORT #else @@ -20,7 +10,6 @@ #endif /* Namespace using */ -#ifdef __cplusplus namespace paysages { namespace system {} @@ -30,8 +19,5 @@ namespace paysages using namespace paysages::system; using namespace paysages::basics; using namespace paysages::definition; -#endif - -/* Global imports */ #endif // DEFINITION_GLOBAL_H diff --git a/src/editing/basepreview.cpp b/src/editing/basepreview.cpp index aff14ff..5f454da 100644 --- a/src/editing/basepreview.cpp +++ b/src/editing/basepreview.cpp @@ -10,6 +10,7 @@ #include #include "tools.h" #include "System.h" +#include "PackStream.h" /*************** PreviewChunk ***************/ class PreviewChunk diff --git a/src/editing/basepreview.h b/src/editing/basepreview.h index 69ec388..74cf716 100644 --- a/src/editing/basepreview.h +++ b/src/editing/basepreview.h @@ -1,6 +1,8 @@ #ifndef _PAYSAGES_QT_BASEPREVIEW_H_ #define _PAYSAGES_QT_BASEPREVIEW_H_ +#include "editing_global.h" + #include #include #include @@ -12,10 +14,14 @@ #include "editing/previewosd.h" #include "editing/common/DrawingWidget.h" #include "editing/common/previewrenderer.h" - -#include "PackStream.h" #include "rendering/tools/color.h" +namespace paysages { +namespace system { + class PackStream; +} +} + class _ContextChoice { public: diff --git a/src/editing/common/mainwindow.cpp b/src/editing/common/mainwindow.cpp index edd9962..9e12991 100644 --- a/src/editing/common/mainwindow.cpp +++ b/src/editing/common/mainwindow.cpp @@ -25,6 +25,7 @@ #include "rendering/main.h" #include "Scenery.h" +#include "PackStream.h" #include "tools.h" MainWindow* MainWindow::_instance = NULL; diff --git a/src/editing/common/mainwindow.h b/src/editing/common/mainwindow.h index c425a83..6380b7e 100644 --- a/src/editing/common/mainwindow.h +++ b/src/editing/common/mainwindow.h @@ -1,13 +1,19 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H +#include "editing_global.h" #include #include -#include "PackStream.h" class BaseForm; class FormRender; +namespace paysages { +namespace system { +class PackStream; +} +} + namespace Ui { class MainWindow; } diff --git a/src/editing/formrender.cpp b/src/editing/formrender.cpp index e86fec6..5a79478 100644 --- a/src/editing/formrender.cpp +++ b/src/editing/formrender.cpp @@ -6,7 +6,12 @@ #include "inputcamera.h" #include "tools.h" #include "rendering/render.h" +#include "rendering/atmosphere/public.h" +#include "rendering/clouds/public.h" +#include "rendering/terrain/public.h" +#include "rendering/water/public.h" #include "Scenery.h" +#include "PackStream.h" /**************** Previews ****************/ class PreviewRenderLandscape : public BasePreview diff --git a/src/editing/formwater.cpp b/src/editing/formwater.cpp index 23c94c7..eb53df3 100644 --- a/src/editing/formwater.cpp +++ b/src/editing/formwater.cpp @@ -8,9 +8,11 @@ #include "rendering/tools/euclid.h" #include "rendering/tools/lighting.h" #include "rendering/renderer.h" -#include "Scenery.h" #include "rendering/water/public.h" +#include "rendering/terrain/public.h" +#include "rendering/atmosphere/public.h" #include "tools.h" +#include "Scenery.h" static WaterDefinition* _definition; diff --git a/src/editing/terrain/previewterrainshape.cpp b/src/editing/terrain/previewterrainshape.cpp index 5d8446b..274e91f 100644 --- a/src/editing/terrain/previewterrainshape.cpp +++ b/src/editing/terrain/previewterrainshape.cpp @@ -1,6 +1,7 @@ #include "previewterrainshape.h" #include "basepreview.h" +#include "rendering/water/public.h" PreviewTerrainShape::PreviewTerrainShape(TerrainDefinition* terrain) { diff --git a/src/editing/terrain/widgetheightmap.cpp b/src/editing/terrain/widgetheightmap.cpp index bc135ff..0bb0a60 100644 --- a/src/editing/terrain/widgetheightmap.cpp +++ b/src/editing/terrain/widgetheightmap.cpp @@ -7,6 +7,7 @@ #include #include "tools.h" #include "Scenery.h" +#include "rendering/water/public.h" #define HEIGHTMAP_RESOLUTION 256 diff --git a/src/editing/textures/PreviewCumul.h b/src/editing/textures/PreviewCumul.h index bf72b00..36a3f63 100644 --- a/src/editing/textures/PreviewCumul.h +++ b/src/editing/textures/PreviewCumul.h @@ -4,6 +4,7 @@ #include "editing/common/previewrenderer.h" class BasePreview; +class TexturesDefinition; class PreviewCumul : public PreviewRenderer { diff --git a/src/editing/textures/PreviewLayerCoverage.h b/src/editing/textures/PreviewLayerCoverage.h index 351e48d..a6b4f8f 100644 --- a/src/editing/textures/PreviewLayerCoverage.h +++ b/src/editing/textures/PreviewLayerCoverage.h @@ -4,6 +4,7 @@ #include "editing/common/previewrenderer.h" class BasePreview; +class TexturesDefinition; class PreviewLayerCoverage : public PreviewRenderer { diff --git a/src/editing/textures/PreviewLayerLook.h b/src/editing/textures/PreviewLayerLook.h index 659a3ed..9323b82 100644 --- a/src/editing/textures/PreviewLayerLook.h +++ b/src/editing/textures/PreviewLayerLook.h @@ -4,6 +4,7 @@ #include "editing/common/previewrenderer.h" class BasePreview; +class TexturesDefinition; class PreviewLayerLook : public PreviewRenderer { diff --git a/src/render/opengl/ExplorerChunkSky.cpp b/src/render/opengl/ExplorerChunkSky.cpp index b85e277..df6d4de 100644 --- a/src/render/opengl/ExplorerChunkSky.cpp +++ b/src/render/opengl/ExplorerChunkSky.cpp @@ -1,9 +1,10 @@ #include "ExplorerChunkSky.h" #include +#include #include "rendering/renderer.h" #include "rendering/camera.h" -#include +#include "rendering/atmosphere/public.h" ExplorerChunkSky::ExplorerChunkSky(Renderer* renderer, double size, SkyboxOrientation orientation) : BaseExplorerChunk(renderer) { diff --git a/src/render/opengl/ExplorerChunkTerrain.cpp b/src/render/opengl/ExplorerChunkTerrain.cpp index 14ee94a..f2869af 100644 --- a/src/render/opengl/ExplorerChunkTerrain.cpp +++ b/src/render/opengl/ExplorerChunkTerrain.cpp @@ -4,6 +4,7 @@ #include #include "rendering/camera.h" #include "rendering/renderer.h" +#include "rendering/terrain/public.h" ExplorerChunkTerrain::ExplorerChunkTerrain(Renderer* renderer, double x, double z, double size, int nbchunks, double water_height) : BaseExplorerChunk(renderer) { diff --git a/src/render/opengl/OpenGLRenderer.cpp b/src/render/opengl/OpenGLRenderer.cpp index 8bfdfe9..e20ce39 100644 --- a/src/render/opengl/OpenGLRenderer.cpp +++ b/src/render/opengl/OpenGLRenderer.cpp @@ -5,6 +5,7 @@ #include #include "Scenery.h" #include "renderer.h" +#include "rendering/camera.h" OpenGLRenderer::OpenGLRenderer(Scenery* scenery): scenery(scenery) diff --git a/src/render/opengl/WidgetExplorer.cpp b/src/render/opengl/WidgetExplorer.cpp index 138d2d0..3acdcc8 100644 --- a/src/render/opengl/WidgetExplorer.cpp +++ b/src/render/opengl/WidgetExplorer.cpp @@ -9,6 +9,11 @@ #include "Scenery.h" #include "OpenGLRenderer.h" #include "rendering/tools/euclid.h" +#include "rendering/renderer.h" +#include "rendering/camera.h" +#include "rendering/atmosphere/public.h" +#include "rendering/water/public.h" +#include "rendering/terrain/public.h" #include "ExplorerChunkSky.h" #include "ExplorerChunkTerrain.h" diff --git a/src/rendering/Scenery.cpp b/src/rendering/Scenery.cpp index b20a542..c8fde98 100644 --- a/src/rendering/Scenery.cpp +++ b/src/rendering/Scenery.cpp @@ -3,6 +3,14 @@ #include #include "NoiseGenerator.h" +#include "PackStream.h" +#include "rendering/atmosphere/public.h" +#include "rendering/camera.h" +#include "rendering/clouds/public.h" +#include "rendering/terrain/public.h" +#include "rendering/textures/public.h" +#include "rendering/water/public.h" +#include "rendering/renderer.h" #include "rendering/terrain/ter_raster.h" static Scenery* _main_scenery; diff --git a/src/rendering/Scenery.h b/src/rendering/Scenery.h index 9a166d7..64a63c1 100644 --- a/src/rendering/Scenery.h +++ b/src/rendering/Scenery.h @@ -3,27 +3,21 @@ #include "rendering_global.h" -#include "rendering/atmosphere/public.h" -#include "rendering/camera.h" -#include "rendering/clouds/public.h" -#include "rendering/terrain/public.h" -#include "rendering/textures/public.h" -#include "rendering/water/public.h" -#include "PackStream.h" -#include "rendering/renderer.h" - -#ifdef __cplusplus - #include "BaseDefinition.h" -//class AtmosphereDefinition; -//class CameraDefinition; -//class CloudsDefinition; -//class TerrainDefinition; -//class TexturesDefinition; -//class WaterDefinition; -//class PackStream; -//class Renderer; +class AtmosphereDefinition; +class CameraDefinition; +class CloudsDefinition; +class TerrainDefinition; +class TexturesDefinition; +class WaterDefinition; +class Renderer; + +namespace paysages { +namespace system { +class PackStream; +} +} /** * @brief Global scenery management @@ -76,9 +70,6 @@ private: WaterDefinition* water; }; -extern "C" { -#endif - // Transitional C-API RENDERINGSHARED_EXPORT void sceneryInit(); RENDERINGSHARED_EXPORT void sceneryQuit(); @@ -114,8 +105,4 @@ RENDERINGSHARED_EXPORT Renderer* sceneryCreateStandardRenderer(); RENDERINGSHARED_EXPORT void sceneryBindRenderer(Renderer* renderer); RENDERINGSHARED_EXPORT void sceneryRenderFirstPass(Renderer* renderer); -#ifdef __cplusplus -} -#endif - #endif // SCENERY_H diff --git a/src/rendering/atmosphere/atm_bruneton.cpp b/src/rendering/atmosphere/atm_bruneton.cpp index 25fbff1..02aabc9 100644 --- a/src/rendering/atmosphere/atm_bruneton.cpp +++ b/src/rendering/atmosphere/atm_bruneton.cpp @@ -5,16 +5,18 @@ * http://evasion.inrialpes.fr/~Eric.Bruneton/ */ -#include -#include -#include -#include +#include +#include +#include +#include #include "System.h" +#include "PackStream.h" #include "rendering/tools.h" #include "rendering/tools/cache.h" #include "rendering/tools/texture.h" #include "rendering/tools/parallel.h" #include "rendering/renderer.h" +#include "rendering/water/public.h" /*********************** Constants ***********************/ diff --git a/src/rendering/atmosphere/atm_definition.cpp b/src/rendering/atmosphere/atm_definition.cpp index 79c29ad..1da42ef 100644 --- a/src/rendering/atmosphere/atm_definition.cpp +++ b/src/rendering/atmosphere/atm_definition.cpp @@ -1,8 +1,8 @@ #include "private.h" -#include -#include -#include +#include +#include +#include "PackStream.h" #include "../tools.h" #include "../renderer.h" diff --git a/src/rendering/atmosphere/atm_preview.cpp b/src/rendering/atmosphere/atm_preview.cpp index 3a9b2ae..bfdb93e 100644 --- a/src/rendering/atmosphere/atm_preview.cpp +++ b/src/rendering/atmosphere/atm_preview.cpp @@ -1,6 +1,7 @@ #include "public.h" #include "../renderer.h" +#include "rendering/camera.h" /* * Atmosphere previews. diff --git a/src/rendering/atmosphere/atm_raster.cpp b/src/rendering/atmosphere/atm_raster.cpp index d36521c..8bf1976 100644 --- a/src/rendering/atmosphere/atm_raster.cpp +++ b/src/rendering/atmosphere/atm_raster.cpp @@ -5,6 +5,7 @@ #include #include "../tools.h" #include "../renderer.h" +#include "rendering/clouds/public.h" static Color _postProcessFragment(Renderer* renderer, Vector3 location, void* data) { diff --git a/src/rendering/atmosphere/public.h b/src/rendering/atmosphere/public.h index a2a1b93..65dbbec 100644 --- a/src/rendering/atmosphere/public.h +++ b/src/rendering/atmosphere/public.h @@ -11,10 +11,6 @@ namespace paysages { namespace system {class PackStream;} } -#ifdef __cplusplus -extern "C" { -#endif - typedef enum { ATMOSPHERE_PRESET_CLEAR_DAY = 0, @@ -29,8 +25,9 @@ typedef enum ATMOSPHERE_MODEL_BRUNETON = 0 } AtmosphereModel; -typedef struct +class AtmosphereDefinition { +public: AtmosphereModel model; int hour; int minute; @@ -40,7 +37,7 @@ typedef struct double dome_lighting; double _daytime; -} AtmosphereDefinition; +}; typedef struct { @@ -57,8 +54,9 @@ typedef AtmosphereResult (*FuncAtmosphereApplyAerialPerspective)(Renderer* rende typedef AtmosphereResult (*FuncAtmosphereGetSkyColor)(Renderer* renderer, Vector3 direction); typedef Vector3 (*FuncAtmosphereGetSunDirection)(Renderer* renderer); -typedef struct +class AtmosphereRenderer { +public: AtmosphereDefinition* definition; FuncAtmosphereGetLightingStatus getLightingStatus; @@ -67,7 +65,7 @@ typedef struct FuncAtmosphereGetSunDirection getSunDirection; /*void* _internal_data;*/ -} AtmosphereRenderer; +}; RENDERINGSHARED_EXPORT extern StandardDefinition AtmosphereDefinitionClass; RENDERINGSHARED_EXPORT extern StandardRenderer AtmosphereRendererClass; @@ -82,8 +80,4 @@ RENDERINGSHARED_EXPORT void atmosphereUpdateResult(AtmosphereResult* result); RENDERINGSHARED_EXPORT Renderer* atmosphereCreatePreviewRenderer(); RENDERINGSHARED_EXPORT Color atmosphereGetPreview(Renderer* renderer, double x, double y, double heading); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/rendering/camera.cpp b/src/rendering/camera.cpp index 5dfff2a..65dab66 100644 --- a/src/rendering/camera.cpp +++ b/src/rendering/camera.cpp @@ -1,11 +1,15 @@ #include "camera.h" -#include -#include +#include +#include #include "render.h" #include "Scenery.h" +#include "PackStream.h" #include "tools.h" #include "tools/boundingbox.h" +#include "rendering/renderer.h" +#include "rendering/terrain/public.h" +#include "rendering/water/public.h" struct CameraDefinition { diff --git a/src/rendering/camera.h b/src/rendering/camera.h index 77af95d..16826ea 100644 --- a/src/rendering/camera.h +++ b/src/rendering/camera.h @@ -9,11 +9,6 @@ namespace paysages { namespace system {class PackStream;} } -#ifdef __cplusplus -extern "C" -{ -#endif - typedef struct CameraDefinition CameraDefinition; typedef struct @@ -67,8 +62,4 @@ RENDERINGSHARED_EXPORT int cameraIsProjectedBoxInView(CameraDefinition* camera, RENDERINGSHARED_EXPORT int cameraTransitionToAnother(CameraDefinition* current, CameraDefinition* wanted, double factor); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/rendering/clouds/clo_density.h b/src/rendering/clouds/clo_density.h index b697512..9aa3855 100644 --- a/src/rendering/clouds/clo_density.h +++ b/src/rendering/clouds/clo_density.h @@ -7,11 +7,6 @@ * Coverage/density management in a cloud layer. */ -#ifdef __cplusplus -extern "C" -{ -#endif - /** * Get the coverage of a cloud layer [0.0;1.0] * @@ -43,8 +38,4 @@ RENDERINGSHARED_EXPORT void cloudsBindFakeDensityToRenderer(CloudsRenderer* rend */ RENDERINGSHARED_EXPORT void cloudsBindRealDensityToRenderer(CloudsRenderer* renderer); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/rendering/clouds/clo_preview.cpp b/src/rendering/clouds/clo_preview.cpp index 6fd698d..7c7dd39 100644 --- a/src/rendering/clouds/clo_preview.cpp +++ b/src/rendering/clouds/clo_preview.cpp @@ -4,6 +4,7 @@ #include "../tools/euclid.h" #include "../renderer.h" #include "../tools.h" +#include "rendering/atmosphere/public.h" /* * Clouds previews. diff --git a/src/rendering/clouds/clo_preview.h b/src/rendering/clouds/clo_preview.h index cfb295c..7e0def1 100644 --- a/src/rendering/clouds/clo_preview.h +++ b/src/rendering/clouds/clo_preview.h @@ -8,11 +8,6 @@ * Cloud preview helpers. */ -#ifdef __cplusplus -extern "C" -{ -#endif - 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); @@ -21,8 +16,4 @@ RENDERINGSHARED_EXPORT Renderer* cloudsPreviewMaterialCreateRenderer(); RENDERINGSHARED_EXPORT void cloudsPreviewMaterialBindLayer(Renderer* renderer, CloudsLayerDefinition* layer); RENDERINGSHARED_EXPORT Color cloudsPreviewMaterialGetPixel(Renderer* renderer, double x, double y); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/rendering/clouds/clo_rendering.cpp b/src/rendering/clouds/clo_rendering.cpp index cdb0bbf..887e4d7 100644 --- a/src/rendering/clouds/clo_rendering.cpp +++ b/src/rendering/clouds/clo_rendering.cpp @@ -6,6 +6,7 @@ #include "../renderer.h" #include "clo_density.h" #include "clo_walking.h" +#include "rendering/atmosphere/public.h" /******************** Fake ********************/ static int _fakeAlterLight(Renderer* renderer, LightDefinition* light, Vector3 location) diff --git a/src/rendering/clouds/clo_walking.h b/src/rendering/clouds/clo_walking.h index c896fba..c20a3b9 100644 --- a/src/rendering/clouds/clo_walking.h +++ b/src/rendering/clouds/clo_walking.h @@ -8,11 +8,6 @@ * Functions to walk through a cloud layer. */ -#ifdef __cplusplus -extern "C" -{ -#endif - typedef struct { double distance_from_start; @@ -150,8 +145,4 @@ RENDERINGSHARED_EXPORT CloudWalkerStepInfo* cloudsWalkerGetLastSegment(CloudsWal */ RENDERINGSHARED_EXPORT void cloudsStartWalking(CloudsWalker* walker, FuncCloudsWalkingCallback callback, void* data); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/rendering/clouds/public.h b/src/rendering/clouds/public.h index 624038d..dc4b1eb 100644 --- a/src/rendering/clouds/public.h +++ b/src/rendering/clouds/public.h @@ -56,24 +56,26 @@ typedef struct NoiseGenerator* _edge_noise; } CloudsLayerDefinition; -typedef struct +class CloudsDefinition { +public: Layers* layers; -} CloudsDefinition; +}; typedef Color (*FuncCloudsGetColor)(Renderer* renderer, Color base, Vector3 start, Vector3 end); typedef double (*FuncCloudsGetLayerDensity)(Renderer* renderer, CloudsLayerDefinition* layer, Vector3 location); typedef double (*FuncCloudsGetEdgeDensity)(Renderer* renderer, CloudsLayerDefinition* layer, Vector3 location, double layer_density); -typedef struct +class CloudsRenderer { +public: CloudsDefinition* definition; FuncCloudsGetColor getColor; FuncLightingAlterLight alterLight; FuncCloudsGetLayerDensity getLayerDensity; FuncCloudsGetEdgeDensity getEdgeDensity; -} CloudsRenderer; +}; RENDERINGSHARED_EXPORT extern StandardDefinition CloudsDefinitionClass; diff --git a/src/rendering/geoarea.cpp b/src/rendering/geoarea.cpp index a90b672..3ab0e63 100644 --- a/src/rendering/geoarea.cpp +++ b/src/rendering/geoarea.cpp @@ -1,5 +1,6 @@ #include "geoarea.h" +#include "PackStream.h" #include "tools.h" GeoArea geoareaCreate() diff --git a/src/rendering/geoarea.h b/src/rendering/geoarea.h index 73f5da8..bfc3d48 100644 --- a/src/rendering/geoarea.h +++ b/src/rendering/geoarea.h @@ -4,11 +4,12 @@ /* Geographic area definition */ #include "rendering_global.h" -#include "PackStream.h" -#ifdef __cplusplus -extern "C" { -#endif +namespace paysages { +namespace system { +class PackStream; +} +} typedef struct { @@ -29,8 +30,4 @@ RENDERINGSHARED_EXPORT void geoareaLoad(PackStream* stream, GeoArea* geoarea); 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 -} -#endif - #endif diff --git a/src/rendering/main.cpp b/src/rendering/main.cpp index a1221a2..62cb594 100644 --- a/src/rendering/main.cpp +++ b/src/rendering/main.cpp @@ -1,8 +1,9 @@ -#include -#include +#include +#include #include "tools/data.h" #include "Scenery.h" +#include "PackStream.h" #include "render.h" #include "main.h" #include "opencl.h" diff --git a/src/rendering/main.h b/src/rendering/main.h index 2806faa..f189b18 100644 --- a/src/rendering/main.h +++ b/src/rendering/main.h @@ -5,10 +5,6 @@ #include "rendering_global.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef enum { FILE_OPERATION_OK, FILE_OPERATION_IOERROR, @@ -21,8 +17,4 @@ RENDERINGSHARED_EXPORT void paysagesQuit(); RENDERINGSHARED_EXPORT FileOperationResult paysagesSave(char* filepath); RENDERINGSHARED_EXPORT FileOperationResult paysagesLoad(char* filepath); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/rendering/opencl.h b/src/rendering/opencl.h index af32a38..03029ea 100644 --- a/src/rendering/opencl.h +++ b/src/rendering/opencl.h @@ -5,16 +5,8 @@ #include "rendering_global.h" -#ifdef __cplusplus -extern "C" { -#endif - RENDERINGSHARED_EXPORT void openclInit(); RENDERINGSHARED_EXPORT int openclAvailable(); RENDERINGSHARED_EXPORT void openclQuit(); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/rendering/render.h b/src/rendering/render.h index 7d4092c..5a788ad 100644 --- a/src/rendering/render.h +++ b/src/rendering/render.h @@ -6,10 +6,6 @@ #include "tools/color.h" #include "tools/euclid.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef Color (*f_RenderFragmentCallback)(struct Renderer* renderer, Vector3 location, void* data); typedef void (*RenderCallbackStart)(int width, int height, Color background); @@ -46,9 +42,4 @@ 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 -} -#endif - #endif diff --git a/src/rendering/renderer.cpp b/src/rendering/renderer.cpp index 43eb162..3c8e1a6 100644 --- a/src/rendering/renderer.cpp +++ b/src/rendering/renderer.cpp @@ -6,6 +6,12 @@ #include "render.h" #include "Scenery.h" #include "tools.h" +#include "rendering/camera.h" +#include "rendering/atmosphere/public.h" +#include "rendering/clouds/public.h" +#include "rendering/terrain/public.h" +#include "rendering/textures/public.h" +#include "rendering/water/public.h" static RayCastingResult _RAYCASTING_NULL = {0}; diff --git a/src/rendering/renderer.h b/src/rendering/renderer.h index 44d45f8..71e4df3 100644 --- a/src/rendering/renderer.h +++ b/src/rendering/renderer.h @@ -3,18 +3,16 @@ #include "rendering_global.h" #include "shared/types.h" -#include "atmosphere/public.h" -#include "clouds/public.h" -#include "terrain/public.h" -#include "textures/public.h" -#include "water/public.h" -#include "camera.h" #include "render.h" -#ifdef __cplusplus -extern "C" -{ -#endif +class CameraDefinition; +class LightingManager; +class SurfaceMaterial; +class AtmosphereRenderer; +class TerrainRenderer; +class TexturesRenderer; +class CloudsRenderer; +class WaterRenderer; struct Renderer { @@ -67,8 +65,4 @@ RENDERINGSHARED_EXPORT void rendererSetPreviewCallbacks(Renderer* renderer, Rend RENDERINGSHARED_EXPORT void rendererStart(Renderer* renderer, RenderParams params); RENDERINGSHARED_EXPORT void rendererInterrupt(Renderer* renderer); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/rendering/shared/preview.h b/src/rendering/shared/preview.h index d9356d5..779fa98 100644 --- a/src/rendering/shared/preview.h +++ b/src/rendering/shared/preview.h @@ -8,10 +8,6 @@ #include "../rendering_global.h" #include "types.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef struct PreviewRenderer PreviewRenderer; typedef void (*FuncPreviewCustomizeRenderer)(PreviewRenderer* preview_renderer, Renderer* renderer); @@ -31,8 +27,4 @@ typedef struct { RENDERINGSHARED_EXPORT PreviewClass previewCreateClass(FuncPreviewCustomizeRenderer customizeRenderer, FuncPreviewBindDefinition bindDefinition, FuncPreviewGetPixelColor getPixelColor); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/rendering/shared/types.h b/src/rendering/shared/types.h index 4a44096..f7bcc09 100644 --- a/src/rendering/shared/types.h +++ b/src/rendering/shared/types.h @@ -4,10 +4,6 @@ #include "../tools/euclid.h" #include "../tools/color.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef struct Renderer Renderer; typedef struct @@ -48,8 +44,4 @@ typedef struct { FuncObjectBind bind; } StandardRenderer; -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/rendering/terrain/public.h b/src/rendering/terrain/public.h index e24d6fb..334dfae 100644 --- a/src/rendering/terrain/public.h +++ b/src/rendering/terrain/public.h @@ -20,8 +20,9 @@ typedef enum typedef struct TerrainHeightMap TerrainHeightMap; -typedef struct +class TerrainDefinition { +public: double height; double scaling; double shadow_smoothing; @@ -34,7 +35,7 @@ typedef struct NoiseGenerator* _height_noise; double _min_height; double _max_height; -} TerrainDefinition; +}; typedef struct { @@ -47,8 +48,9 @@ typedef TerrainResult (*FuncTerrainGetResult)(Renderer* renderer, double x, doub typedef Color(*FuncTerrainGetFinalColor)(Renderer* renderer, Vector3 location, double precision); typedef double (*FuncGetWaterHeight)(Renderer* renderer); -typedef struct +class TerrainRenderer { +public: TerrainDefinition* definition; FuncGeneralCastRay castRay; @@ -58,7 +60,7 @@ typedef struct FuncGetWaterHeight getWaterHeight; void* _internal_data; -} TerrainRenderer; +}; RENDERINGSHARED_EXPORT extern StandardDefinition TerrainDefinitionClass; RENDERINGSHARED_EXPORT extern StandardRenderer TerrainRendererClass; diff --git a/src/rendering/terrain/ter_definition.cpp b/src/rendering/terrain/ter_definition.cpp index f17c198..e67eba0 100644 --- a/src/rendering/terrain/ter_definition.cpp +++ b/src/rendering/terrain/ter_definition.cpp @@ -3,6 +3,7 @@ #include "../tools.h" #include "../renderer.h" #include "NoiseGenerator.h" +#include "PackStream.h" /******************** Definition ********************/ static void _validateDefinition(TerrainDefinition* definition) diff --git a/src/rendering/terrain/ter_preview.cpp b/src/rendering/terrain/ter_preview.cpp index 0878117..6de9e0a 100644 --- a/src/rendering/terrain/ter_preview.cpp +++ b/src/rendering/terrain/ter_preview.cpp @@ -4,6 +4,8 @@ #include "../tools/lighting.h" #include "../renderer.h" #include "NoiseGenerator.h" +#include "rendering/atmosphere/public.h" +#include "rendering/textures/public.h" /* * Terrain previews. diff --git a/src/rendering/terrain/ter_raster.cpp b/src/rendering/terrain/ter_raster.cpp index 1010ff5..bfb2f51 100644 --- a/src/rendering/terrain/ter_raster.cpp +++ b/src/rendering/terrain/ter_raster.cpp @@ -8,6 +8,9 @@ #include "../tools/boundingbox.h" #include "../tools/parallel.h" #include "../renderer.h" +#include "rendering/water/public.h" +#include "rendering/textures/public.h" +#include "rendering/camera.h" /* * Terrain rasterization. diff --git a/src/rendering/terrain/ter_raster.h b/src/rendering/terrain/ter_raster.h index 471b17c..b7117d1 100644 --- a/src/rendering/terrain/ter_raster.h +++ b/src/rendering/terrain/ter_raster.h @@ -3,10 +3,6 @@ #include "../rendering_global.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef struct { Vector3 point_nw; @@ -37,8 +33,4 @@ RENDERINGSHARED_EXPORT void terrainTessellateChunk(Renderer* renderer, TerrainCh */ RENDERINGSHARED_EXPORT void terrainRenderSurface(Renderer* renderer); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/rendering/terrain/ter_render.cpp b/src/rendering/terrain/ter_render.cpp index f142305..c8b036b 100644 --- a/src/rendering/terrain/ter_render.cpp +++ b/src/rendering/terrain/ter_render.cpp @@ -4,6 +4,7 @@ #include #include "../tools.h" #include "../renderer.h" +#include "rendering/textures/public.h" /******************** Binding ********************/ static double _fakeGetHeight(Renderer* renderer, double x, double z, int with_painting) diff --git a/src/rendering/textures/public.h b/src/rendering/textures/public.h index d4daff6..8060d09 100644 --- a/src/rendering/textures/public.h +++ b/src/rendering/textures/public.h @@ -7,10 +7,6 @@ #include "rendering/tools/lighting.h" #include "rendering/terrain/public.h" -#ifdef __cplusplus -extern "C" { -#endif - #define TEXTURES_MAX_LAYERS 50 typedef enum @@ -54,10 +50,11 @@ typedef struct /*Curve* _local_slope_condition;*/ } TexturesLayerDefinition; -typedef struct +class TexturesDefinition { +public: Layers* layers; -} TexturesDefinition; +}; typedef struct { @@ -80,14 +77,15 @@ typedef Vector3 (*FuncTexturesDisplaceTerrain)(Renderer* renderer, TerrainResult typedef double (*FuncTexturesGetBasePresence)(Renderer* renderer, int layer, TerrainResult terrain); typedef TexturesResult (*FuncTexturesApplyToTerrain)(Renderer* renderer, double x, double z); -typedef struct +class TexturesRenderer { +public: TexturesDefinition* definition; FuncTexturesDisplaceTerrain displaceTerrain; FuncTexturesGetBasePresence getBasePresence; FuncTexturesApplyToTerrain applyToTerrain; -} TexturesRenderer; +}; RENDERINGSHARED_EXPORT extern StandardDefinition TexturesDefinitionClass; @@ -100,8 +98,4 @@ RENDERINGSHARED_EXPORT void texturesLayerAutoPreset(TexturesLayerDefinition* def RENDERINGSHARED_EXPORT double texturesGetMaximalDisplacement(TexturesDefinition* textures); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/rendering/textures/tex_definition.cpp b/src/rendering/textures/tex_definition.cpp index c1b2030..3c32947 100644 --- a/src/rendering/textures/tex_definition.cpp +++ b/src/rendering/textures/tex_definition.cpp @@ -2,6 +2,7 @@ #include "Scenery.h" #include "NoiseGenerator.h" +#include "PackStream.h" /******************** Global definition ********************/ static void _validateDefinition(TexturesDefinition* definition) diff --git a/src/rendering/textures/tex_preview.h b/src/rendering/textures/tex_preview.h index de7d76d..457bc88 100644 --- a/src/rendering/textures/tex_preview.h +++ b/src/rendering/textures/tex_preview.h @@ -4,10 +4,6 @@ #include "rendering/renderer.h" #include "rendering/textures/public.h" -#ifdef __cplusplus -extern "C" { -#endif - /* Single layer coverage */ RENDERINGSHARED_EXPORT void TexturesPreviewLayerCoverage_bind(Renderer* renderer, TexturesDefinition* definition); RENDERINGSHARED_EXPORT Color TexturesPreviewLayerCoverage_getColor(Renderer* renderer, double x, double y, double scaling, int layer); @@ -20,8 +16,4 @@ RENDERINGSHARED_EXPORT Color TexturesPreviewLayerLook_getColor(Renderer* rendere 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 -} -#endif - #endif diff --git a/src/rendering/tools.h b/src/rendering/tools.h index 9e05225..379f5d1 100644 --- a/src/rendering/tools.h +++ b/src/rendering/tools.h @@ -4,10 +4,6 @@ #include "rendering_global.h" #include "shared/types.h" -#ifdef __cplusplus -extern "C" { -#endif - #define UNUSED(_x_) ((void)(_x_)) RENDERINGSHARED_EXPORT double toolsRandom(); @@ -15,8 +11,4 @@ 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 -} -#endif - #endif diff --git a/src/rendering/tools/array.h b/src/rendering/tools/array.h index 14a2980..42d94ed 100644 --- a/src/rendering/tools/array.h +++ b/src/rendering/tools/array.h @@ -5,10 +5,6 @@ #include "../shared/types.h" #include -#ifdef __cplusplus -extern "C" { -#endif - /**************** Naive methods (basic C arrays) ****************/ /* @@ -35,8 +31,4 @@ 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 -} -#endif - #endif diff --git a/src/rendering/tools/boundingbox.h b/src/rendering/tools/boundingbox.h index b2223c5..17a8533 100644 --- a/src/rendering/tools/boundingbox.h +++ b/src/rendering/tools/boundingbox.h @@ -4,10 +4,6 @@ #include "../rendering_global.h" #include "euclid.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef struct { int empty; @@ -22,8 +18,4 @@ typedef struct RENDERINGSHARED_EXPORT void boundingBoxReset(BoundingBox* box); RENDERINGSHARED_EXPORT void boundingBoxPushPoint(BoundingBox* box, Vector3 point); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/rendering/tools/cache.h b/src/rendering/tools/cache.h index 3b896bd..5ef044a 100644 --- a/src/rendering/tools/cache.h +++ b/src/rendering/tools/cache.h @@ -7,10 +7,6 @@ #include "../rendering_global.h" -#ifdef __cplusplus -extern "C" { -#endif - typedef struct CacheFile CacheFile; RENDERINGSHARED_EXPORT CacheFile* cacheFileCreateAccessor(const char* module, const char* ext, const char* tag1, int tag2, int tag3, int tag4, int tag5, int tag6); @@ -19,8 +15,4 @@ RENDERINGSHARED_EXPORT int cacheFileIsReadable(CacheFile* cache); RENDERINGSHARED_EXPORT int cacheFileIsWritable(CacheFile* cache); RENDERINGSHARED_EXPORT const char* cacheFileGetPath(CacheFile* cache); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/rendering/tools/color.h b/src/rendering/tools/color.h index 17ac888..cc8ca80 100644 --- a/src/rendering/tools/color.h +++ b/src/rendering/tools/color.h @@ -8,10 +8,6 @@ namespace paysages { namespace system {class PackStream;} } -#ifdef __cplusplus -extern "C" { -#endif - #define TYPEDEF_COLOR typedef struct { @@ -110,8 +106,4 @@ RENDERINGSHARED_EXPORT ColorHSL colorToHSL(Color col); RENDERINGSHARED_EXPORT ColorHSL colorHSLFromValues(double h, double s, double l, double a); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/rendering/tools/curve.h b/src/rendering/tools/curve.h index 9d3b695..33f2768 100644 --- a/src/rendering/tools/curve.h +++ b/src/rendering/tools/curve.h @@ -7,10 +7,6 @@ namespace paysages { namespace system {class PackStream;} } -#ifdef __cplusplus -extern "C" { -#endif - typedef struct { double position; double value; @@ -36,8 +32,4 @@ RENDERINGSHARED_EXPORT void curveValidate(Curve* curve); RENDERINGSHARED_EXPORT double curveGetValue(Curve* curve, double position); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/rendering/tools/euclid.h b/src/rendering/tools/euclid.h index 0d509a2..febdcb7 100644 --- a/src/rendering/tools/euclid.h +++ b/src/rendering/tools/euclid.h @@ -34,11 +34,6 @@ namespace system {class PackStream;} * X=0 Y=-1 Z=0 => THETA=-PI/2 */ -#ifdef __cplusplus -extern "C" -{ -#endif - typedef struct { double x; @@ -125,8 +120,4 @@ RENDERINGSHARED_EXPORT Vector3 euclidGetNormalFromTriangle(Vector3 center, Vecto 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 -} -#endif - #endif diff --git a/src/rendering/tools/lighting.h b/src/rendering/tools/lighting.h index f3c7600..e3992f4 100644 --- a/src/rendering/tools/lighting.h +++ b/src/rendering/tools/lighting.h @@ -9,12 +9,9 @@ namespace paysages { namespace system {class PackStream;} } -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct +class SurfaceMaterial { +public: ColorHSL base; double hardness; @@ -24,7 +21,7 @@ typedef struct double receive_shadows; Color _rgb; -} SurfaceMaterial; +}; typedef struct { @@ -56,8 +53,4 @@ RENDERINGSHARED_EXPORT void materialSave(PackStream* stream, SurfaceMaterial* ma RENDERINGSHARED_EXPORT void materialLoad(PackStream* stream, SurfaceMaterial* material); RENDERINGSHARED_EXPORT void materialValidate(SurfaceMaterial* material); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/rendering/tools/memory.h b/src/rendering/tools/memory.h index 96d4bc0..d5134b9 100644 --- a/src/rendering/tools/memory.h +++ b/src/rendering/tools/memory.h @@ -7,14 +7,6 @@ #include "../rendering_global.h" -#ifdef __cplusplus -extern "C" { -#endif - RENDERINGSHARED_EXPORT void* memory2dRealloc(void* data, int datasize, int oldxsize, int oldysize, int newxsize, int newysize, int xoffset, int yoffset); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/rendering/tools/parallel.h b/src/rendering/tools/parallel.h index 004cad2..44f8c00 100644 --- a/src/rendering/tools/parallel.h +++ b/src/rendering/tools/parallel.h @@ -11,10 +11,6 @@ * shared data from unit functions. */ -#ifdef __cplusplus -extern "C" { -#endif - typedef struct ParallelWork ParallelWork; typedef int (*ParallelUnitFunction)(ParallelWork* work, int unit, void* data); @@ -106,8 +102,4 @@ RENDERINGSHARED_EXPORT int parallelQueueAddJob(ParallelQueue* queue, FuncParalle */ RENDERINGSHARED_EXPORT int parallelQueueCollectJobs(FuncParallelJob func_collect); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/rendering/tools/texture.cpp b/src/rendering/tools/texture.cpp index 6f202ba..1148143 100644 --- a/src/rendering/tools/texture.cpp +++ b/src/rendering/tools/texture.cpp @@ -4,6 +4,7 @@ #include #include #include "System.h" +#include "PackStream.h" #include "PictureFile.h" struct Texture2D diff --git a/src/rendering/tools/texture.h b/src/rendering/tools/texture.h index 4ceea67..7f21f37 100644 --- a/src/rendering/tools/texture.h +++ b/src/rendering/tools/texture.h @@ -7,11 +7,12 @@ #include "../rendering_global.h" #include "color.h" -#include "PackStream.h" -#ifdef __cplusplus -extern "C" { -#endif +namespace paysages { +namespace system { +class PackStream; +} +} typedef struct Texture2D Texture2D; typedef struct Texture3D Texture3D; @@ -59,8 +60,4 @@ 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 -} -#endif - #endif diff --git a/src/rendering/tools/zone.cpp b/src/rendering/tools/zone.cpp index 3fce831..00de0ed 100644 --- a/src/rendering/tools/zone.cpp +++ b/src/rendering/tools/zone.cpp @@ -1,8 +1,9 @@ #include "zone.h" -#include -#include -#include +#include +#include +#include +#include "PackStream.h" #include "tools.h" #define MAX_CIRCLES 20 diff --git a/src/rendering/tools/zone.h b/src/rendering/tools/zone.h index 43bf798..d5c0b99 100644 --- a/src/rendering/tools/zone.h +++ b/src/rendering/tools/zone.h @@ -8,11 +8,12 @@ #include "../rendering_global.h" #include "rendering/tools/euclid.h" #include "rendering/tools/curve.h" -#include "PackStream.h" -#ifdef __cplusplus -extern "C" { -#endif +namespace paysages { +namespace system { +class PackStream; +} +} typedef struct Zone Zone; @@ -39,8 +40,4 @@ RENDERINGSHARED_EXPORT void zoneAddSlopeRangeQuick(Zone* zone, double value, dou RENDERINGSHARED_EXPORT double zoneGetValue(Zone* zone, Vector3 location, Vector3 normal); -#ifdef __cplusplus -} -#endif - #endif diff --git a/src/rendering/water/public.h b/src/rendering/water/public.h index 124612f..d4f6445 100644 --- a/src/rendering/water/public.h +++ b/src/rendering/water/public.h @@ -19,8 +19,9 @@ typedef enum WATER_PRESET_SEA } WaterPreset; -typedef struct +class WaterDefinition { +public: double transparency; double reflection; SurfaceMaterial material; @@ -37,7 +38,7 @@ typedef struct SurfaceMaterial foam_material; NoiseGenerator* _waves_noise; -} WaterDefinition; +}; typedef struct { @@ -53,14 +54,15 @@ typedef HeightInfo (*FuncWaterGetHeightInfo)(Renderer* renderer); typedef double (*FuncWaterGetHeight)(Renderer* renderer, double x, double z); typedef WaterResult (*FuncWaterGetResult)(Renderer* renderer, double x, double z); -typedef struct +class WaterRenderer { +public: WaterDefinition* definition; FuncWaterGetHeightInfo getHeightInfo; FuncWaterGetHeight getHeight; FuncWaterGetResult getResult; -} WaterRenderer; +}; RENDERINGSHARED_EXPORT extern StandardDefinition WaterDefinitionClass; diff --git a/src/rendering/water/wat_render.cpp b/src/rendering/water/wat_render.cpp index 23c7ebc..034d5b7 100644 --- a/src/rendering/water/wat_render.cpp +++ b/src/rendering/water/wat_render.cpp @@ -4,6 +4,7 @@ #include "../tools.h" #include "../renderer.h" #include "NoiseGenerator.h" +#include "rendering/terrain/public.h" static HeightInfo _FAKE_HEIGHT_INFO = {0.0, 0.0, 0.0}; diff --git a/src/system/PictureFile.h b/src/system/PictureFile.h index 9a0dc2a..86dee6f 100644 --- a/src/system/PictureFile.h +++ b/src/system/PictureFile.h @@ -3,8 +3,6 @@ #include "system_global.h" -#ifdef __cplusplus - namespace paysages { namespace system @@ -19,9 +17,6 @@ public: } } -extern "C" { -#endif - // Transitional C-API #ifndef TYPEDEF_COLOR @@ -37,8 +32,4 @@ typedef struct typedef Color (*PictureCallbackSavePixel)(void* data, int x, int y); SYSTEMSHARED_EXPORT int systemSavePictureFile(const char* filepath, PictureCallbackSavePixel callback_pixel, void* data, int width, int height); -#ifdef __cplusplus -} -#endif - #endif // PICTUREFILE_H