2011-12-10 13:25:22 +00:00
|
|
|
#ifndef _PAYSAGES_WATER_H_
|
|
|
|
#define _PAYSAGES_WATER_H_
|
|
|
|
|
2013-01-19 22:42:50 +00:00
|
|
|
#include "tools/color.h"
|
|
|
|
#include "tools/euclid.h"
|
|
|
|
#include "tools/lighting.h"
|
|
|
|
#include "tools/pack.h"
|
2012-01-23 23:45:33 +00:00
|
|
|
#include "renderer.h"
|
|
|
|
#include "noise.h"
|
2011-12-10 13:25:22 +00:00
|
|
|
|
2011-12-23 22:58:50 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2012-11-11 10:52:03 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
2012-11-24 12:30:51 +00:00
|
|
|
WATER_PRESET_LAKE,
|
|
|
|
WATER_PRESET_SEA
|
2012-11-11 10:52:03 +00:00
|
|
|
} WaterPreset;
|
2013-01-19 22:42:50 +00:00
|
|
|
|
2011-12-10 13:25:22 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2012-06-17 09:40:40 +00:00
|
|
|
double height;
|
|
|
|
double transparency;
|
|
|
|
double reflection;
|
2012-01-28 18:32:08 +00:00
|
|
|
SurfaceMaterial material;
|
2011-12-19 20:59:39 +00:00
|
|
|
Color depth_color;
|
2012-06-17 09:40:40 +00:00
|
|
|
double transparency_depth;
|
|
|
|
double lighting_depth;
|
2013-01-19 22:42:50 +00:00
|
|
|
|
2012-11-11 10:52:03 +00:00
|
|
|
double scaling;
|
|
|
|
double turbulence;
|
|
|
|
double waves_height;
|
|
|
|
double detail_height;
|
2013-01-19 22:42:50 +00:00
|
|
|
|
2012-11-19 20:40:57 +00:00
|
|
|
double foam_coverage;
|
|
|
|
SurfaceMaterial foam_material;
|
2013-01-19 22:42:50 +00:00
|
|
|
|
2012-11-11 10:52:03 +00:00
|
|
|
NoiseGenerator* _waves_noise;
|
2011-12-10 13:25:22 +00:00
|
|
|
} WaterDefinition;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
Vector3 location;
|
|
|
|
Color base;
|
|
|
|
Color reflected;
|
|
|
|
Color refracted;
|
2012-11-19 20:40:57 +00:00
|
|
|
Color foam;
|
2011-12-10 13:25:22 +00:00
|
|
|
Color final;
|
|
|
|
} WaterResult;
|
|
|
|
|
2012-04-22 17:12:39 +00:00
|
|
|
void waterSave(PackStream* stream, WaterDefinition* definition);
|
|
|
|
void waterLoad(PackStream* stream, WaterDefinition* definition);
|
2011-12-10 13:25:22 +00:00
|
|
|
|
|
|
|
WaterDefinition waterCreateDefinition();
|
2012-01-23 23:45:33 +00:00
|
|
|
void waterDeleteDefinition(WaterDefinition* definition);
|
2012-11-11 10:52:03 +00:00
|
|
|
void waterAutoPreset(WaterDefinition* definition, WaterPreset preset);
|
2012-01-23 23:45:33 +00:00
|
|
|
void waterCopyDefinition(WaterDefinition* source, WaterDefinition* destination);
|
|
|
|
void waterValidateDefinition(WaterDefinition* definition);
|
|
|
|
|
2012-01-29 17:53:12 +00:00
|
|
|
HeightInfo waterGetHeightInfo(WaterDefinition* definition);
|
2012-01-23 23:45:33 +00:00
|
|
|
Color waterLightFilter(WaterDefinition* definition, Renderer* renderer, Color light, Vector3 location, Vector3 light_location, Vector3 direction_to_light);
|
|
|
|
WaterResult waterGetColorDetail(WaterDefinition* definition, Renderer* renderer, Vector3 location, Vector3 look);
|
|
|
|
Color waterGetColor(WaterDefinition* definition, Renderer* renderer, Vector3 location, Vector3 look);
|
2012-01-29 21:45:58 +00:00
|
|
|
void waterRender(WaterDefinition* definition, Renderer* renderer);
|
2011-12-10 13:25:22 +00:00
|
|
|
|
2011-12-23 22:58:50 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-12-10 13:25:22 +00:00
|
|
|
#endif
|