Environment

class Environment

The main class that manages environment data. Usually, you will create a single instance of Environment, which will persist while your 3D game or simulation world is active.

If you use environment directly and not via TrueSkyRenderer, you must call the following each frame:

SetRealTime(time_seconds); skyKeyframer->TimeStep(step_days); Update();

Public Functions

Environment(platform::core::MemoryInterface *mem = NULL)

Constructor - initialize with an optional memory allocator.

virtual ~Environment()

Destructor.

void CreateSubObjects()

Call this to create the keyframer sub-objects. If not called before the first Update(), it will be called from there.

void SetRealTime(double rt_sec)

Call this once per frame before Update() if you use real-time updates for clouds, rain, lightning, sky keyframes etc.

void Update(double latitudeRadians, double longitudeRadians, double headingRadians)

Call this once per-frame.

void Save(simul::sky::Output &os) const

Save a sky sequence as binary (the .seq file format); this is a low-overhead method of storing and retrieving sequences, but is subject to format changes, so sequences should generally be stored as text (see SaveToText).

void Load(simul::sky::Input &is)

Load a sequence from the binary .seq format.

void SaveToText(platform::crossplatform::TextOutput &output) const

Save a sky sequence as text (the .sq file format). This is the standard means of storing sequences.

void LoadFromText(platform::crossplatform::TextInput &input)

Load a sequence from the text .sq format.

void New()

Clear the sequence.

void Reset()

Force recalculation of any cached values.

CloudKeyframer *GetCloudKeyframer(sky::uid uid)

Get the cloud keyframer with the specified uid.

bool DeleteCloudKeyframer(sky::uid uid)

Delete the specified cloud layer.

bool DeleteCloudKeyframe(sky::uid uid)

Delete the specified cloud keyframe.

unsigned GetKeyframersChecksum() const

A checksum for the keyframer setup.

virtual clouds::CloudKeyframer *CreateCloudKeyframer(platform::core::MemoryInterface *m, sky::uid uid = 0)

Override this to create a custom derived keyframer. Valid id’s are anything greater than zero.

Public Members

std::map<sky::uid, simul::clouds::CloudKeyframer*> cloudKeyframers

Map of 3D Cloud Layers.

simul::sky::SkyKeyframer *skyKeyframer

The atmosphere/sky keyframer.

Public Static Functions

static Environment *Create(platform::core::MemoryInterface *m = nullptr)

Create an Environment.

static void Destroy(Environment *env)

Destroy an Environment .