Storm

struct simul::clouds::Storm

A structure representing a thunderstorm. See CloudKeyframer::AddStorm.

Public Functions

Strike GetStrike(int i) const

Return the currently active strike, or return a default strike.

int SpawnStrike(float time, vec3 startpos, vec3 endpos, float magnitude, vec3 colour, bool sh, float dur, float leader_dur)

Spawn a strike at a certain time with the given properties.

const LightningProperties &GetLightningProperties(float game_time, float real_time, float base_km, const CloudWindow *w) const

Get the properties of the currently active lightning strike.

int GetTotalNumStrikes() const

Get the approximate number of strikes that are generated over a day with the current settings.

bool HasFloat(const char *name) const

Returns true if the keyframe has the named property.

bool HasInt(const char *name) const

Returns true if the keyframe type has the named integer property.

float GetFloat(const char *name) const

Returns the named property - see HasFloat().

void SetFloat(const char *name, float val)

Set the named property - see HasFloat().

int GetInt(const char *name) const

Returns the named property - see HasInt().

void SetInt(const char *name, int val)

Set the named property - see HasFloat().

int GetDefaultInt(const char *name) const

Returns the default for the named property - see HasInt().

float GetDefaultFloat(const char *name) const

Returns the default for the named property - see HasFloat().

void Update(float game_time, float real_time)

Once per frame update to discard old strikes.

void AddStrike(float cloudbase_km, float game_time, float real_time)

Add the next random strike.

Public Members

crossplatform::Quaterniond origin

Centre of the lightning storm.

float radiusKm

Radius of the lightning storm.

float start_time

Time the storm commences.

float end_time

Time the storm ends.

bool realTime

If true, frequency and duration of strikes are in real time, not simulation time.

float sheet

What proportion of the strikes are sheet lightning as opposed to ground strikes.

float strikeFrequencyPerSecond

In simulated seconds - not necessarily realtime.

float strikeDurationSeconds

How long, in simulated seconds - not realtime - each strike should last.

float strikeThicknessMetres

Thickness of the main trunk.

float roughness

How rough/smooth to make the branches.

float motion

How much to move/animate during a strike.

int seed

Pseudo-random seed.

int numLevels

Number of levels of branching.

int numBranches

Mean number of branches to generate from each parent.

float branchAngleDegrees

Mean angle of branching.

vec3 colour

Colour of the strikes.

float maxRadiance

Maximum radiance of the strikes.

float minPixelWidth

Minimum pixel-size for strike rendering.

sky::uid unique_id

A non-persistent unique identifier.

std::map<int, Strike> strikes

We can store a stack of non-random strikes. These take precedence over pseudo-randomly generated strikes.

mutable LightningProperties lightningProperties

Current cached lightning.