QtCraft API C++ classes QML types Handbook

QcExplosionEffects Class

The flash and smoke of the explosions the server told about (QcMsg::Explosion, decision E-604): each explosion leaves a few bright puffs of fire that burst out and fade fast and more puffs of smoke that drift up and shrink, all as small cubes the entity frame draws. More...

Header: #include <clientcore/session/QcExplosionEffects.h>

Public Types

struct Look
struct Puff
struct Shake

Public Functions

void add(const QcMsg::Explosion &explosion, quint64 tick)
double flashAt(const QcVec3 &eye, double ticks) const
void prune(quint64 tick)
const QList<QcExplosionEffects::Puff> &puffs() const
double shakeAt(const QcVec3 &eye, double ticks) const

Static Public Members

const int flashPuffs
const double flashReachPerPower
const char *const flashTexture
const int flashTicks
std::optional<QcExplosionEffects::Look> lookAt(const QcExplosionEffects::Puff &puff, double ticks)
const qsizetype maxBlasts
const int maxPuffs
const double maxShakeDegrees
QcExplosionEffects::Shake shake(double strength, double ticks)
const double shakeReachPerPower
const int shakeTicks
const int smokePuffsPerPower
const char *const smokeTexture

Detailed Description

Directions and sizes come from the explosion's position, so the same explosion looks the same; the number of puffs grows with the power and is bounded, and so is the number of puffs in all. Near the eye an explosion also lights the world in a short warm flash and shakes the camera (decision E-879).

Member Function Documentation

void QcExplosionEffects::add(const QcMsg::Explosion &explosion, quint64 tick)

Adds the puffs and the blast of explosion, which happened at client tick.

double QcExplosionEffects::flashAt(const QcVec3 &eye, double ticks) const

Returns the brightness (0..1) of the explosions' flash seen from eye at ticks (with the frame's fraction).

[static] std::optional<QcExplosionEffects::Look> QcExplosionEffects::lookAt(const QcExplosionEffects::Puff &puff, double ticks)

Returns how puff looks at ticks (client ticks with the frame's fraction); nothing when the puff is over.

void QcExplosionEffects::prune(quint64 tick)

Forgets the puffs and blasts that are over at tick.

const QList<QcExplosionEffects::Puff> &QcExplosionEffects::puffs() const

Returns the puffs that are still running or not yet pruned.

[static] QcExplosionEffects::Shake QcExplosionEffects::shake(double strength, double ticks)

Returns the camera offsets of a shake of strength at ticks: a quick, irregular tremble.

double QcExplosionEffects::shakeAt(const QcVec3 &eye, double ticks) const

Returns the strength (0..1) of the shake the explosions give a camera at eye at ticks.

Member Variable Documentation

const int QcExplosionEffects::flashPuffs

Puffs of fire per explosion.

const qsizetype QcExplosionEffects::maxBlasts

Most explosions whose flash and shake are followed at a time; a new one replaces the weakest.

const int QcExplosionEffects::maxPuffs

Most puffs at a time; an explosion that would exceed it adds none (its flash and shake still count).

const double QcExplosionEffects::maxShakeDegrees

Largest offsets of a full-strength shake.

const int QcExplosionEffects::smokePuffsPerPower

Puffs of smoke per unit of power (rounded up).