2012-01-03 15:40:50 +00:00
|
|
|
#ifndef _PAYSAGES_TERRAIN_H_
|
|
|
|
#define _PAYSAGES_TERRAIN_H_
|
|
|
|
|
|
|
|
#include "shared/types.h"
|
2012-01-05 16:32:41 +00:00
|
|
|
#include "modifiers.h"
|
2012-01-03 15:40:50 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2012-01-05 11:32:14 +00:00
|
|
|
#define MAX_HEIGHT_MODIFIER_COUNT 50
|
|
|
|
|
2012-01-03 15:40:50 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
NoiseGenerator* height_noise;
|
2012-01-05 11:32:14 +00:00
|
|
|
int height_modifiers_count;
|
|
|
|
HeightModifier* height_modifiers[MAX_HEIGHT_MODIFIER_COUNT];
|
2012-01-03 15:40:50 +00:00
|
|
|
} TerrainDefinition;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
double min_chunk_size;
|
|
|
|
double visible_chunk_size;
|
|
|
|
} TerrainQuality;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int unused;
|
|
|
|
} TerrainEnvironment;
|
|
|
|
|
|
|
|
void terrainInit();
|
|
|
|
void terrainSave(FILE* f);
|
|
|
|
void terrainLoad(FILE* f);
|
|
|
|
|
|
|
|
TerrainDefinition terrainCreateDefinition();
|
|
|
|
void terrainDeleteDefinition(TerrainDefinition definition);
|
|
|
|
void terrainCopyDefinition(TerrainDefinition source, TerrainDefinition* destination);
|
|
|
|
void terrainSetDefinition(TerrainDefinition definition);
|
|
|
|
TerrainDefinition terrainGetDefinition();
|
|
|
|
|
2012-01-05 11:32:14 +00:00
|
|
|
int terrainAddModifier(TerrainDefinition* definition, HeightModifier* modifier);
|
|
|
|
void terrainDelModifier(TerrainDefinition* definition, int modifier_position);
|
|
|
|
|
2012-01-03 15:40:50 +00:00
|
|
|
void terrainSetQuality(TerrainQuality quality);
|
|
|
|
TerrainQuality terrainGetQuality();
|
|
|
|
|
|
|
|
double terrainGetShadow(Vector3 start, Vector3 direction);
|
|
|
|
int terrainProjectRay(Vector3 start, Vector3 direction, Vector3* hit_point, Color* hit_color);
|
|
|
|
double terrainGetHeightCustom(double x, double z, TerrainDefinition* definition);
|
|
|
|
double terrainGetHeight(double x, double z);
|
|
|
|
double terrainGetHeightNormalizedCustom(double x, double z, TerrainDefinition* definition);
|
|
|
|
double terrainGetHeightNormalized(double x, double z);
|
|
|
|
Color terrainGetColorCustom(double x, double z, double detail, TerrainDefinition* definition, TerrainQuality* quality, TerrainEnvironment* environment);
|
|
|
|
Color terrainGetColor(double x, double z, double detail);
|
|
|
|
void terrainRender(RenderProgressCallback callback);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|