Refactoring for c++

This commit is contained in:
Michaël Lemaire 2013-11-07 09:37:11 +01:00 committed by Michael Lemaire
parent cf75e86be6
commit 5c2bc4b31e
73 changed files with 170 additions and 358 deletions

View file

@ -1,5 +0,0 @@
#include "ColorRGB.h"
ColorRGB::ColorRGB()
{
}

View file

@ -1,10 +0,0 @@
#ifndef COLORRGB_H
#define COLORRGB_H
class ColorRGB
{
public:
ColorRGB();
};
#endif // COLORRGB_H

View file

@ -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 \

View file

@ -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

View file

@ -1,11 +1,14 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#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)
{

View file

@ -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

View file

@ -2,17 +2,7 @@
#define DEFINITION_GLOBAL_H
/* Shared object helpers */
#ifdef __cplusplus
# include <QtCore/qglobal.h>
#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 <QtCore/qglobal.h>
#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

View file

@ -10,6 +10,7 @@
#include <math.h>
#include "tools.h"
#include "System.h"
#include "PackStream.h"
/*************** PreviewChunk ***************/
class PreviewChunk

View file

@ -1,6 +1,8 @@
#ifndef _PAYSAGES_QT_BASEPREVIEW_H_
#define _PAYSAGES_QT_BASEPREVIEW_H_
#include "editing_global.h"
#include <QMutex>
#include <QImage>
#include <QThread>
@ -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:

View file

@ -25,6 +25,7 @@
#include "rendering/main.h"
#include "Scenery.h"
#include "PackStream.h"
#include "tools.h"
MainWindow* MainWindow::_instance = NULL;

View file

@ -1,13 +1,19 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "editing_global.h"
#include <QMainWindow>
#include <QVector>
#include "PackStream.h"
class BaseForm;
class FormRender;
namespace paysages {
namespace system {
class PackStream;
}
}
namespace Ui {
class MainWindow;
}

View file

@ -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

View file

@ -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;

View file

@ -1,6 +1,7 @@
#include "previewterrainshape.h"
#include "basepreview.h"
#include "rendering/water/public.h"
PreviewTerrainShape::PreviewTerrainShape(TerrainDefinition* terrain)
{

View file

@ -7,6 +7,7 @@
#include <GL/glu.h>
#include "tools.h"
#include "Scenery.h"
#include "rendering/water/public.h"
#define HEIGHTMAP_RESOLUTION 256

View file

@ -4,6 +4,7 @@
#include "editing/common/previewrenderer.h"
class BasePreview;
class TexturesDefinition;
class PreviewCumul : public PreviewRenderer
{

View file

@ -4,6 +4,7 @@
#include "editing/common/previewrenderer.h"
class BasePreview;
class TexturesDefinition;
class PreviewLayerCoverage : public PreviewRenderer
{

View file

@ -4,6 +4,7 @@
#include "editing/common/previewrenderer.h"
class BasePreview;
class TexturesDefinition;
class PreviewLayerLook : public PreviewRenderer
{

View file

@ -1,9 +1,10 @@
#include "ExplorerChunkSky.h"
#include <cmath>
#include <GL/gl.h>
#include "rendering/renderer.h"
#include "rendering/camera.h"
#include <GL/gl.h>
#include "rendering/atmosphere/public.h"
ExplorerChunkSky::ExplorerChunkSky(Renderer* renderer, double size, SkyboxOrientation orientation) : BaseExplorerChunk(renderer)
{

View file

@ -4,6 +4,7 @@
#include <GL/gl.h>
#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)
{

View file

@ -5,6 +5,7 @@
#include <GL/glu.h>
#include "Scenery.h"
#include "renderer.h"
#include "rendering/camera.h"
OpenGLRenderer::OpenGLRenderer(Scenery* scenery):
scenery(scenery)

View file

@ -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"

View file

@ -3,6 +3,14 @@
#include <ctime>
#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;

View file

@ -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

View file

@ -5,16 +5,18 @@
* http://evasion.inrialpes.fr/~Eric.Bruneton/
*/
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#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 ***********************/

View file

@ -1,8 +1,8 @@
#include "private.h"
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <cstdlib>
#include "PackStream.h"
#include "../tools.h"
#include "../renderer.h"

View file

@ -1,6 +1,7 @@
#include "public.h"
#include "../renderer.h"
#include "rendering/camera.h"
/*
* Atmosphere previews.

View file

@ -5,6 +5,7 @@
#include <stdlib.h>
#include "../tools.h"
#include "../renderer.h"
#include "rendering/clouds/public.h"
static Color _postProcessFragment(Renderer* renderer, Vector3 location, void* data)
{

View file

@ -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

View file

@ -1,11 +1,15 @@
#include "camera.h"
#include <stdlib.h>
#include <math.h>
#include <cstdlib>
#include <cmath>
#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
{

View file

@ -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

View file

@ -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

View file

@ -4,6 +4,7 @@
#include "../tools/euclid.h"
#include "../renderer.h"
#include "../tools.h"
#include "rendering/atmosphere/public.h"
/*
* Clouds previews.

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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;

View file

@ -1,5 +1,6 @@
#include "geoarea.h"
#include "PackStream.h"
#include "tools.h"
GeoArea geoareaCreate()

View file

@ -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

View file

@ -1,8 +1,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include "tools/data.h"
#include "Scenery.h"
#include "PackStream.h"
#include "render.h"
#include "main.h"
#include "opencl.h"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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};

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -3,6 +3,7 @@
#include "../tools.h"
#include "../renderer.h"
#include "NoiseGenerator.h"
#include "PackStream.h"
/******************** Definition ********************/
static void _validateDefinition(TerrainDefinition* definition)

View file

@ -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.

View file

@ -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.

View file

@ -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

View file

@ -4,6 +4,7 @@
#include <math.h>
#include "../tools.h"
#include "../renderer.h"
#include "rendering/textures/public.h"
/******************** Binding ********************/
static double _fakeGetHeight(Renderer* renderer, double x, double z, int with_painting)

View file

@ -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

View file

@ -2,6 +2,7 @@
#include "Scenery.h"
#include "NoiseGenerator.h"
#include "PackStream.h"
/******************** Global definition ********************/
static void _validateDefinition(TexturesDefinition* definition)

View file

@ -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

View file

@ -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

View file

@ -5,10 +5,6 @@
#include "../shared/types.h"
#include <stdlib.h>
#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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -4,6 +4,7 @@
#include <assert.h>
#include <math.h>
#include "System.h"
#include "PackStream.h"
#include "PictureFile.h"
struct Texture2D

View file

@ -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

View file

@ -1,8 +1,9 @@
#include "zone.h"
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include "PackStream.h"
#include "tools.h"
#define MAX_CIRCLES 20

View file

@ -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

View file

@ -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;

View file

@ -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};

View file

@ -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