2011-12-10 13:25:22 +00:00
|
|
|
#ifndef _PAYSAGES_CLOUDS_H_
|
|
|
|
#define _PAYSAGES_CLOUDS_H_
|
|
|
|
|
|
|
|
#include "shared/types.h"
|
2012-01-23 23:45:33 +00:00
|
|
|
#include "noise.h"
|
|
|
|
#include "renderer.h"
|
2011-12-10 13:25:22 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2011-12-23 22:58:50 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2012-01-23 23:45:33 +00:00
|
|
|
#define CLOUDS_MAX_LAYERS 6
|
|
|
|
|
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-01-23 23:45:33 +00:00
|
|
|
int nblayers;
|
|
|
|
CloudsLayerDefinition layers[CLOUDS_MAX_LAYERS];
|
|
|
|
} CloudsDefinition;
|
2011-12-10 13:25:22 +00:00
|
|
|
|
|
|
|
void cloudsInit();
|
2012-02-12 16:57:29 +00:00
|
|
|
void cloudsQuit();
|
2012-04-22 17:12:39 +00:00
|
|
|
void cloudsSave(PackStream* stream, CloudsDefinition* definition);
|
|
|
|
void cloudsLoad(PackStream* stream, CloudsDefinition* definition);
|
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);
|
|
|
|
|
|
|
|
CloudsLayerDefinition cloudsLayerCreateDefinition();
|
|
|
|
void cloudsLayerDeleteDefinition(CloudsLayerDefinition* definition);
|
|
|
|
void cloudsLayerCopyDefinition(CloudsLayerDefinition* source, CloudsLayerDefinition* destination);
|
|
|
|
void cloudsLayerValidateDefinition(CloudsLayerDefinition* definition);
|
|
|
|
|
|
|
|
int cloudsGetLayerCount(CloudsDefinition* definition);
|
|
|
|
CloudsLayerDefinition* cloudsGetLayer(CloudsDefinition* definition, int layer);
|
|
|
|
int cloudsAddLayer(CloudsDefinition* definition);
|
|
|
|
void cloudsDeleteLayer(CloudsDefinition* definition, int layer);
|
|
|
|
|
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
|