struct Storm

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

Public Functions

inline Storm(math::RandomNumberGenerator *r)
void SaveToText(crossplatform::TextOutput &output) const
void LoadFromText(crossplatform::TextInput &input)
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 GetLastStrikeIndex(float game_time, float real_time) const
int GetTotalNumStrikes() const

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

float GetStrikeTime(int n) const
float GetStrikeTime(float game_time, float real_time) const
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

math::RandomNumberGenerator *random
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.

unsigned last_strike_uid
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 Attributes

static const int kStormQueryId = 827613
static LightningProperties defaultLightningProperties
struct LightningProperties

Public Members

Strike strike
StrikeState strikeState
int seed
float branch_angle_radians
float branch_cosine
float branch_sine
float strikeThicknessMetres
float roughness
float motion
int numLevels
int numBranches
int mask
int mask_bits
vec3 colour
float maxRadiance
float minPixelWidth
int strikeIndex
const Storm *storm
struct Strike

Public Members

int seed
vec3 startX

Strike start position in metres.

vec3 endX

Strike end position in metres.

float strikeStartTime
float strikeDuration
float leaderDuration
bool sheet

If true we will get an in-cloud strike, otherwise, cloud to ground (alt=0m) strike.

float magnitude
vec3 colour
struct StrikeState

Public Members

float progress
float brightness
struct ExportLightningStrike

A struct for passing lighting strike properties between trueSKY and an external engine.

Public Members

int id
vec3 pos
vec3 endpos
float brightness
vec3 colour
int age