QcClientWeather Class
The weather as the client shows it (decision E-395): the strengths of rain and thunder the server sent, eased so a step of a message never jumps; the climate where the player stands; the flash of the latest lightning; and the thunder still on its way (sound travels 343 m/s, so a strike 170 m away is heard half a second after its flash). More...
| Header: | #include <clientcore/weather/QcClientWeather.h> |
Public Functions
| const QcWeather::Climate & | climate() const |
| float | flash(double ticks) const |
| void | lightning(const QcMsg::Lightning &strike, const QcVec3 &listener, quint64 tick) |
| QcPrecipitation | precipitationAt(int y) const |
| float | rain() const |
| float | rainAt(int y) const |
| void | receive(QcMsg::Weather weather) |
| quint64 | strikes() const |
| float | thunder() const |
| QList<QcSoundCue> | tick(quint64 tick) |
Static Public Members
| const float | easePerTick |
| const int | flashTicks |
| const double | speedOfSound |
| const double | thunderHearing |
| const double | thunderPlacement |
Detailed Description
GUI-free; the session ticks it.
Member Function Documentation
const QcWeather::Climate &QcClientWeather::climate() const
Returns the climate where the player stands.
float QcClientWeather::flash(double ticks) const
Returns the brightness of the lightning flash in 0..1 at ticks (the client tick with its fraction): a bright stroke, a short dark gap, a second stroke, then fading out.
void QcClientWeather::lightning(const QcMsg::Lightning &strike, const QcVec3 &listener, quint64 tick)
The strike seen by a listener at listener in client tick tick: the flash begins, the thunder waits for its time.
QcPrecipitation QcClientWeather::precipitationAt(int y) const
Returns what falls at height y near the player while it rains (QcWeather::precipitationAt).
float QcClientWeather::rain() const
Returns the shown strength of the rain, 0..1.
float QcClientWeather::rainAt(int y) const
Returns the rain strength falling at height y near the player: 0 where it snows or stays dry.
void QcClientWeather::receive(QcMsg::Weather weather)
Takes the strengths and the climate the server sent in weather.
quint64 QcClientWeather::strikes() const
Returns the number of strikes seen since the session began (tests, control interface).
float QcClientWeather::thunder() const
Returns the shown strength of the thunderstorm, 0..1.
QList<QcSoundCue> QcClientWeather::tick(quint64 tick)
One client tick, tick: eases the strengths and returns the thunder due now.
Member Variable Documentation
const float QcClientWeather::easePerTick
The shown strengths move at most this much per tick towards the received ones (twice the server's fade, so they keep up with it).
const int QcClientWeather::flashTicks
A flash lights the sky for this many ticks.
const double QcClientWeather::speedOfSound
Speed of sound in metres per second.
const double QcClientWeather::thunderHearing
Thunder from strikes further away than this is not heard at all.
const double QcClientWeather::thunderPlacement
Thunder further away than this is placed at this distance (towards the strike) and quieter by the ratio, so it stays within the reach of its sound (QcSoundDefinition::maxRange).