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-23 23:45:33 +00:00
|
|
|
#include "noise.h"
|
2012-01-22 22:06:11 +00:00
|
|
|
#include "lighting.h"
|
2012-01-03 15:40:50 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2012-01-23 23:45:33 +00:00
|
|
|
#define TERRAIN_MAX_MODIFIERS 50
|
2012-01-05 11:32:14 +00:00
|
|
|
|
2012-01-03 15:40:50 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
NoiseGenerator* height_noise;
|
2012-01-23 23:45:33 +00:00
|
|
|
double height_factor;
|
|
|
|
double scaling;
|
2012-01-05 11:32:14 +00:00
|
|
|
int height_modifiers_count;
|
2012-01-23 23:45:33 +00:00
|
|
|
HeightModifier* height_modifiers[TERRAIN_MAX_MODIFIERS];
|
2012-01-03 15:40:50 +00:00
|
|
|
|
2012-01-23 23:45:33 +00:00
|
|
|
double _max_height;
|
|
|
|
} TerrainDefinition;
|
2012-01-03 15:40:50 +00:00
|
|
|
|
|
|
|
void terrainInit();
|
2012-02-12 16:57:29 +00:00
|
|
|
void terrainQuit();
|
2012-01-23 23:45:33 +00:00
|
|
|
void terrainSave(FILE* f, TerrainDefinition* definition);
|
|
|
|
void terrainLoad(FILE* f, TerrainDefinition* definition);
|
2012-01-03 15:40:50 +00:00
|
|
|
|
|
|
|
TerrainDefinition terrainCreateDefinition();
|
2012-01-23 23:45:33 +00:00
|
|
|
void terrainDeleteDefinition(TerrainDefinition* definition);
|
|
|
|
void terrainCopyDefinition(TerrainDefinition* source, TerrainDefinition* destination);
|
|
|
|
void terrainValidateDefinition(TerrainDefinition* definition);
|
2012-01-03 15:40:50 +00:00
|
|
|
|
2012-01-05 11:32:14 +00:00
|
|
|
int terrainAddModifier(TerrainDefinition* definition, HeightModifier* modifier);
|
|
|
|
void terrainDelModifier(TerrainDefinition* definition, int modifier_position);
|
|
|
|
|
2012-01-23 23:45:33 +00:00
|
|
|
Color terrainLightFilter(TerrainDefinition* definition, Renderer* renderer, Color light, Vector3 location, Vector3 light_location, Vector3 direction_to_light);
|
|
|
|
int terrainProjectRay(TerrainDefinition* definition, Renderer* renderer, Vector3 start, Vector3 direction, Vector3* hit_point, Color* hit_color);
|
|
|
|
double terrainGetHeight(TerrainDefinition* definition, double x, double z);
|
|
|
|
double terrainGetHeightNormalized(TerrainDefinition* definition, double x, double z);
|
|
|
|
Color terrainGetColor(TerrainDefinition* definition, Renderer* renderer, double x, double z, double detail);
|
2012-01-29 21:45:58 +00:00
|
|
|
void terrainRender(TerrainDefinition* definition, Renderer* renderer);
|
2012-01-03 15:40:50 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|