Rise
The Vieneo Province
Loading...
Searching...
No Matches
LightningTiming.h
Go to the documentation of this file.
1#pragma once
2
3// Shared visual tuning for cloud-top illumination and cloud-to-ground bolts.
4// These are the approved Vieneo presentation values, not a discharge-physics
5// prediction. Timing changes here apply to both through LightningStrike::Animation.
7{
8 constexpr int MinStrokes = 3;
9 constexpr int MaxStrokes = 4; // Uniform integer selection, mean 3.5.
10 // Connected cloud hops preceding the single ground channel. Artistic
11 // cloud-charge layout for Vieneo, not a density-scaled discharge prediction.
12 constexpr int MaxChainedBolts = 2;
13 constexpr float CloudHopMinKm = .4f, CloudHopMaxKm = 1.2f;
14 constexpr float CloudHopMaxRiseKm = .25f, CloudHopTurnRadians = .9f;
15 constexpr double MinDurationSeconds = .1;
16 constexpr double MeanDurationSeconds = .2;
17 constexpr double MaxDurationSeconds = .5;
18
19 // Scaled Beta(1,beta) duration distribution. Deriving beta from the mean
20 // keeps all three duration controls meaningful when they are adjusted.
21 constexpr double DurationBeta =
23
24 struct Phase
25 {
27 double weightMin, weightMax; // Relative weights, not additional seconds.
28 double Weight(double uniform) const {return weightMin+(weightMax-weightMin)*uniform;}
29 constexpr bool Valid() const
30 {return minimumSeconds>0 && weightMin>0 && weightMax>=weightMin;}
31 };
32 // Reserve minimum visible phases, then distribute the remaining duration
33 // using independent random weights. Their sum always fits the chosen total.
34 constexpr Phase Leader { .008, .035, .080 };
35 constexpr Phase Tail { .006, .060, .110 };
36 constexpr Phase Attack { .0015, .004, .010 };
37 constexpr Phase Hold { .006, .022, .038 };
38 constexpr Phase Decay { .004, .035, .060 };
39 constexpr Phase Gap { .005, .015, .090 };
40 constexpr float LeaderBrightness = .12f;
41 constexpr float AfterglowBrightness = .025f;
42 constexpr float ReturnStrokeMinPeak = .55f, ReturnStrokeMaxPeak = .95f;
43
44 constexpr double MinimumPhasesSeconds(int strokes)
45 {
48 +(strokes-1)*Gap.minimumSeconds;
49 }
50 static_assert(MinStrokes>=1 && MaxStrokes>=MinStrokes, "Invalid lightning stroke range");
52 && MeanDurationSeconds<MaxDurationSeconds, "Lightning mean must lie between duration bounds");
53 static_assert(Leader.Valid() && Tail.Valid() && Attack.Valid() && Hold.Valid()
54 && Decay.Valid() && Gap.Valid(), "Invalid lightning phase tuning");
56 "Minimum lightning phases do not fit the shortest flash; adjust duration or phases");
57}
constexpr float ReturnStrokeMinPeak
constexpr float ReturnStrokeMaxPeak
constexpr Phase Attack
constexpr int MaxStrokes
constexpr int MinStrokes
constexpr float CloudHopMaxRiseKm
constexpr double MeanDurationSeconds
constexpr Phase Decay
constexpr int MaxChainedBolts
constexpr float AfterglowBrightness
constexpr Phase Gap
constexpr double MaxDurationSeconds
constexpr Phase Leader
constexpr float LeaderBrightness
constexpr float CloudHopMinKm
constexpr double MinimumPhasesSeconds(int strokes)
constexpr double DurationBeta
constexpr Phase Hold
constexpr float CloudHopMaxKm
constexpr double MinDurationSeconds
constexpr float CloudHopTurnRadians
constexpr Phase Tail
constexpr bool Valid() const
double Weight(double uniform) const