Storm

struct 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 platform::crossplatform::Quaterniond *origin) 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 HasInt(const char *name) const

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

bool HasFloat(const char *name) const

Returns true if the keyframe has the named 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 radiusKm, float game_time, float real_time)

Add the next random strike.

Public Members

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 interp_strikeFrequencyPerSecond

In simulated seconds - not necessarily realtime - Calculated from interpolated keyframe.

float interp_strikeDurationSeconds

How long, in simulated seconds - not realtime - each strike should last - Calculated from interpolated keyframe.

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.

Public Static Functions

static bool hasFloat(const char *name)

Returns true if the keyframe has the named property.

static bool hasInt(const char *name)

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

static bool GetFloatRange(const char *name, float &val1, float &val2)

Returns the min and max value for the named property.

static bool getIntRange(const char *name, int &val1, int &val2)

Returns the min and max value for the named property.