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;
|
|
|
|
|
|
|
|
typedef double (*CloudCoverageFunc)(CloudsLayerDefinition* definition, Vector3 position);
|
|
|
|
|
|
|
|
struct CloudsLayerDefinition
|
2011-12-10 13:25:22 +00:00
|
|
|
{
|
|
|
|
double ycenter;
|
|
|
|
double ymin;
|
|
|
|
double ymax;
|
|
|
|
NoiseGenerator* noise;
|
2012-02-07 21:03:58 +00:00
|
|
|
SurfaceMaterial material;
|
|
|
|
double transparencydepth;
|
|
|
|
double lighttraversal;
|
|
|
|
double minimumlight;
|
2011-12-10 13:25:22 +00:00
|
|
|
double scaling;
|
|
|
|
double coverage;
|
2012-02-08 14:24:53 +00:00
|
|
|
CloudCoverageFunc customcoverage;
|
|
|
|
};
|
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-01-23 23:45:33 +00:00
|
|
|
void cloudsSave(FILE* f, CloudsDefinition* definition);
|
|
|
|
void cloudsLoad(FILE* f, 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);
|
|
|
|
|
|
|
|
Color cloudsGetLayerColor(CloudsLayerDefinition* definition, Renderer* renderer, Vector3 start, Vector3 end);
|
|
|
|
Color cloudsGetColor(CloudsDefinition* definition, 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
|