paysages3d/src/definition/AtmosphereDefinition.h

91 lines
2.2 KiB
C
Raw Normal View History

2013-11-15 23:27:40 +00:00
#ifndef ATMOSPHEREDEFINITION_H
#define ATMOSPHEREDEFINITION_H
#include "definition_global.h"
#include "DefinitionNode.h"
2013-11-15 23:27:40 +00:00
2013-12-26 16:30:22 +00:00
#include "Vector3.h"
2013-11-15 23:27:40 +00:00
#include "Color.h"
namespace paysages {
namespace definition {
class DEFINITIONSHARED_EXPORT AtmosphereDefinition : public DefinitionNode {
public:
typedef struct {
2013-12-26 16:30:22 +00:00
Vector3 location;
double radius;
Color col;
} Star;
public:
typedef enum { ATMOSPHERE_MODEL_DISABLED = 0, ATMOSPHERE_MODEL_BRUNETON = 1 } AtmosphereModel;
typedef enum {
2013-11-15 23:27:40 +00:00
ATMOSPHERE_PRESET_CLEAR_DAY = 0,
ATMOSPHERE_PRESET_CLEAR_SUNSET = 1,
ATMOSPHERE_PRESET_HAZY_MORNING = 2,
ATMOSPHERE_PRESET_FOGGY = 3,
ATMOSPHERE_PRESET_STORMY = 4
} AtmospherePreset;
public:
AtmosphereDefinition(DefinitionNode *parent);
2013-11-15 23:27:40 +00:00
virtual void save(PackStream *stream) const override;
virtual void load(PackStream *stream) override;
2013-11-15 23:27:40 +00:00
virtual void copy(DefinitionNode *destination) const override;
inline GodRaysDefinition *childGodRays() const {
return godrays;
}
inline CelestialBodyDefinition *childSun() const {
return sun;
}
inline CelestialBodyDefinition *childMoon() const {
return moon;
}
inline FloatNode *propHumidity() const {
return humidity;
}
2013-11-15 23:27:40 +00:00
2014-08-28 13:09:47 +00:00
/**
* Set the daytime from a 0.0-1.0 value.
*/
void setDayTime(double value);
/**
* Set the daytime from hour/minute/second info.
*/
void setDayTime(int hour, int minute = 0, int second = 0);
/**
* Get the daytime info, in 0.0-1.0 value.
*/
double getDaytime() const;
/**
* Get the daytime info, in hour/minute/second.
*/
void getHMS(int *hour, int *minute, int *second) const;
2014-08-28 13:09:47 +00:00
void applyPreset(AtmospherePreset preset, RandomGenerator &random = RandomGeneratorDefault);
void generateStars(int count, RandomGenerator &random = RandomGeneratorDefault);
2013-11-15 23:27:40 +00:00
public:
2013-11-15 23:27:40 +00:00
AtmosphereModel model;
2015-08-23 23:19:19 +00:00
2013-11-15 23:27:40 +00:00
Color sun_color;
double dome_lighting;
2015-12-10 23:36:50 +00:00
vector<Star> stars;
private:
GodRaysDefinition *godrays;
CelestialBodyDefinition *sun;
CelestialBodyDefinition *moon;
2015-08-23 23:19:19 +00:00
FloatNode *humidity;
2013-11-15 23:27:40 +00:00
};
}
}
#endif // ATMOSPHEREDEFINITION_H