2011-12-10 13:25:22 +00:00
|
|
|
#ifndef _PAYSAGES_CLOUDS_H_
|
|
|
|
#define _PAYSAGES_CLOUDS_H_
|
|
|
|
|
|
|
|
#include "shared/types.h"
|
2012-08-26 13:36:46 +00:00
|
|
|
#include "layers.h"
|
2012-01-23 23:45:33 +00:00
|
|
|
#include "noise.h"
|
|
|
|
#include "renderer.h"
|
2011-12-10 13:25:22 +00:00
|
|
|
|
2011-12-23 22:58:50 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2012-11-24 12:30:51 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
CLOUDS_PRESET_CIRRUS,
|
2012-11-24 16:04:33 +00:00
|
|
|
CLOUDS_PRESET_CUMULUS,
|
|
|
|
CLOUDS_PRESET_STRATOCUMULUS,
|
2012-11-24 12:30:51 +00:00
|
|
|
CLOUDS_PRESET_STRATUS
|
|
|
|
} CloudsPreset;
|
|
|
|
|
2012-02-08 14:24:53 +00:00
|
|
|
typedef struct CloudsLayerDefinition CloudsLayerDefinition;
|
|
|
|
|
2012-06-17 09:40:40 +00:00
|
|
|
typedef double (*CloudCoverageFunc)(CloudsLayerDefinition* definition, Vector3 position);
|
2012-02-08 14:24:53 +00:00
|
|
|
|
|
|
|
struct CloudsLayerDefinition
|
2011-12-10 13:25:22 +00:00
|
|
|
{
|
2012-07-01 13:27:57 +00:00
|
|
|
double lower_altitude;
|
|
|
|
double thickness;
|
2012-06-17 09:40:40 +00:00
|
|
|
double base_coverage;
|
2012-06-10 09:30:30 +00:00
|
|
|
Curve* coverage_by_altitude;
|
|
|
|
NoiseGenerator* shape_noise;
|
2012-06-17 09:40:40 +00:00
|
|
|
double shape_scaling;
|
2012-06-10 09:30:30 +00:00
|
|
|
NoiseGenerator* edge_noise;
|
2012-06-17 09:40:40 +00:00
|
|
|
double edge_scaling;
|
|
|
|
double edge_length;
|
2012-02-07 21:03:58 +00:00
|
|
|
SurfaceMaterial material;
|
2012-06-17 09:40:40 +00:00
|
|
|
double hardness;
|
|
|
|
double transparencydepth;
|
|
|
|
double lighttraversal;
|
|
|
|
double minimumlight;
|
2012-06-10 09:30:30 +00:00
|
|
|
CloudCoverageFunc _custom_coverage;
|
2012-02-08 14:24:53 +00:00
|
|
|
};
|
2011-12-10 13:25:22 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2012-08-26 13:36:46 +00:00
|
|
|
Layers* layers;
|
2012-01-23 23:45:33 +00:00
|
|
|
} CloudsDefinition;
|
2011-12-10 13:25:22 +00:00
|
|
|
|
|
|
|
CloudsDefinition cloudsCreateDefinition();
|
2012-01-23 23:45:33 +00:00
|
|
|
void cloudsDeleteDefinition(CloudsDefinition* definition);
|
|
|
|
void cloudsCopyDefinition(CloudsDefinition* source, CloudsDefinition* destination);
|
|
|
|
void cloudsValidateDefinition(CloudsDefinition* definition);
|
2012-08-26 13:36:46 +00:00
|
|
|
void cloudsSave(PackStream* stream, CloudsDefinition* definition);
|
|
|
|
void cloudsLoad(PackStream* stream, CloudsDefinition* definition);
|
2012-01-23 23:45:33 +00:00
|
|
|
|
2012-08-26 13:36:46 +00:00
|
|
|
CloudsLayerDefinition* cloudsLayerCreateDefinition();
|
2012-01-23 23:45:33 +00:00
|
|
|
void cloudsLayerDeleteDefinition(CloudsLayerDefinition* definition);
|
2012-11-24 12:30:51 +00:00
|
|
|
void cloudsLayerAutoPreset(CloudsLayerDefinition* definition, CloudsPreset preset);
|
2012-01-23 23:45:33 +00:00
|
|
|
void cloudsLayerCopyDefinition(CloudsLayerDefinition* source, CloudsLayerDefinition* destination);
|
|
|
|
void cloudsLayerValidateDefinition(CloudsLayerDefinition* definition);
|
2012-07-05 17:05:03 +00:00
|
|
|
void cloudsLayerSetName(CloudsLayerDefinition* definition, const char* name);
|
2012-08-26 13:36:46 +00:00
|
|
|
LayerType cloudsGetLayerType();
|
2012-01-23 23:45:33 +00:00
|
|
|
|
2012-07-01 13:27:57 +00:00
|
|
|
Color cloudsApplyLayer(CloudsLayerDefinition* definition, Color base, Renderer* renderer, Vector3 start, Vector3 end);
|
|
|
|
Color cloudsApply(CloudsDefinition* definition, Color base, Renderer* renderer, Vector3 start, Vector3 end);
|
2012-01-24 13:59:54 +00:00
|
|
|
Color cloudsLayerFilterLight(CloudsLayerDefinition* definition, Renderer* renderer, Color light, Vector3 location, Vector3 light_location, Vector3 direction_to_light);
|
|
|
|
Color cloudsFilterLight(CloudsDefinition* definition, Renderer* renderer, Color light, Vector3 location, Vector3 light_location, Vector3 direction_to_light);
|
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
|