2012-12-09 17:49:28 +00:00
|
|
|
#ifndef _PAYSAGES_TERRAIN_PUBLIC_H_
|
|
|
|
#define _PAYSAGES_TERRAIN_PUBLIC_H_
|
|
|
|
|
|
|
|
#include "../shared/types.h"
|
2013-01-19 22:42:50 +00:00
|
|
|
#include "../tools/color.h"
|
|
|
|
#include "../tools/euclid.h"
|
2012-12-09 17:49:28 +00:00
|
|
|
#include "../noise.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TERRAIN_PRESET_STANDARD
|
|
|
|
} TerrainPreset;
|
|
|
|
|
2013-01-10 15:41:14 +00:00
|
|
|
typedef struct TerrainHeightMap TerrainHeightMap;
|
|
|
|
|
2012-12-09 17:49:28 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
double height;
|
|
|
|
double scaling;
|
|
|
|
double shadow_smoothing;
|
|
|
|
|
2013-01-10 15:41:14 +00:00
|
|
|
TerrainHeightMap* height_map;
|
|
|
|
|
2012-12-09 17:49:28 +00:00
|
|
|
double _detail;
|
|
|
|
NoiseGenerator* _height_noise;
|
|
|
|
double _min_height;
|
|
|
|
double _max_height;
|
|
|
|
} TerrainDefinition;
|
|
|
|
|
2013-01-14 12:08:38 +00:00
|
|
|
typedef double (*FuncTerrainGetHeight)(Renderer* renderer, double x, double z, int with_painting);
|
2012-12-09 17:49:28 +00:00
|
|
|
typedef Color (*FuncTerrainGetFinalColor)(Renderer* renderer, Vector3 location, double precision);
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
TerrainDefinition* definition;
|
|
|
|
|
|
|
|
FuncGeneralCastRay castRay;
|
|
|
|
FuncTerrainGetHeight getHeight;
|
|
|
|
FuncTerrainGetFinalColor getFinalColor;
|
|
|
|
|
|
|
|
void* _internal_data;
|
|
|
|
} TerrainRenderer;
|
|
|
|
|
|
|
|
extern StandardDefinition TerrainDefinitionClass;
|
|
|
|
extern StandardRenderer TerrainRendererClass;
|
|
|
|
|
|
|
|
void terrainAutoPreset(TerrainDefinition* definition, TerrainPreset preset);
|
|
|
|
void terrainRenderSurface(Renderer* renderer);
|
2013-01-14 12:08:38 +00:00
|
|
|
double terrainGetGridHeight(TerrainDefinition* definition, int x, int z, int with_painting);
|
2012-12-28 11:28:01 +00:00
|
|
|
|
2013-01-20 15:07:45 +00:00
|
|
|
Renderer* terrainCreatePreviewRenderer();
|
2012-12-28 11:28:01 +00:00
|
|
|
Color terrainGetPreviewColor(Renderer* renderer, double x, double z, double detail);
|
2012-12-09 17:49:28 +00:00
|
|
|
|
2012-12-10 22:05:53 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
double relative_x;
|
|
|
|
double relative_z;
|
|
|
|
double hard_radius;
|
|
|
|
double smoothed_size;
|
|
|
|
double total_radius;
|
|
|
|
} TerrainBrush;
|
|
|
|
|
2013-01-10 15:41:14 +00:00
|
|
|
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);
|
2012-12-10 22:05:53 +00:00
|
|
|
|
2012-12-09 17:49:28 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|