Sustained curved energy-arc beams, keyed by owner entity id.
More...
#include <TeslaBeamEffect.hpp>
|
| struct | Branch |
| | One forked branch diverging from the main arc. More...
|
| struct | Beam |
| | State for a single sustained, curved beam. More...
|
|
| void | drive (uint32_t key, glm::vec3 origin, glm::vec3 target) |
| | Refresh (or start) the beam owned by key for this frame.
|
| void | update (float dt, glm::vec3 camForward) |
| | Advance animation, age out undriven beams, and rebuild arc verts.
|
| const ArcVertex * | arcData () const |
| | Arc vertex array for GPU upload (nullptr if empty).
|
| uint32_t | arcCount () const |
| | Number of arc vertices generated this frame.
|
| uint32_t | activeBeamCount () const |
| | Number of beams currently alive.
|
|
| void | appendArcStrip (const std::vector< glm::vec3 > &pts, float radius, glm::vec4 color, glm::vec3 camForward) |
| | Append a camera-facing triangle-strip ribbon to arcVerts_.
|
| Beam * | findOrAllocBeam (uint32_t key) |
|
| static constexpr int | k_maxBeams = 4 |
| static constexpr int | k_bezierSegs = 28 |
| | Samples along the main arc.
|
| static constexpr int | k_branchSegs = 6 |
| | Samples along each branch.
|
| static constexpr int | k_maxBranches = 3 |
| static constexpr float | k_fadeTime = 0.08f |
| | Fade in/out window (s).
|
| static constexpr float | k_keepAlive = 0.06f |
| | Grace before an undriven beam starts fading.
|
| static constexpr float | k_bowFrac = 0.16f |
| | Spine sag as a fraction of beam length.
|
| static constexpr float | k_branchRetime = 0.05f |
| | Branch re-randomise interval (s).
|
Sustained curved energy-arc beams, keyed by owner entity id.
◆ activeBeamCount()
| uint32_t TeslaBeamEffect::activeBeamCount |
( |
| ) |
const |
|
nodiscard |
Number of beams currently alive.
◆ appendArcStrip()
| void TeslaBeamEffect::appendArcStrip |
( |
const std::vector< glm::vec3 > & | pts, |
|
|
float | radius, |
|
|
glm::vec4 | color, |
|
|
glm::vec3 | camForward ) |
|
private |
Append a camera-facing triangle-strip ribbon to arcVerts_.
◆ arcCount()
| uint32_t TeslaBeamEffect::arcCount |
( |
| ) |
const |
|
inlinenodiscard |
Number of arc vertices generated this frame.
◆ arcData()
| const ArcVertex * TeslaBeamEffect::arcData |
( |
| ) |
const |
|
inlinenodiscard |
Arc vertex array for GPU upload (nullptr if empty).
◆ drive()
| void TeslaBeamEffect::drive |
( |
uint32_t | key, |
|
|
glm::vec3 | origin, |
|
|
glm::vec3 | target ) |
Refresh (or start) the beam owned by key for this frame.
Call once per frame for every entity whose Tesla beam is firing. The beam stays alive as long as it keeps being driven; stop calling drive() and it fades out over k_fadeTime.
- Parameters
-
| key | Stable owner id (entity handle as integer). |
| origin | World-space beam start (muzzle / eye). |
| target | World-space beam end (the locked target, or a forward point). |
◆ evalBezier()
| glm::vec3 TeslaBeamEffect::evalBezier |
( |
glm::vec3 | p0, |
|
|
glm::vec3 | p1, |
|
|
glm::vec3 | p2, |
|
|
glm::vec3 | p3, |
|
|
float | t ) |
|
staticprivate |
◆ evalBezierTangent()
| glm::vec3 TeslaBeamEffect::evalBezierTangent |
( |
glm::vec3 | p0, |
|
|
glm::vec3 | p1, |
|
|
glm::vec3 | p2, |
|
|
glm::vec3 | p3, |
|
|
float | t ) |
|
staticprivate |
◆ findOrAllocBeam()
◆ rerandomizeBranches()
| void TeslaBeamEffect::rerandomizeBranches |
( |
Beam & | beam | ) |
|
|
staticprivate |
◆ update()
| void TeslaBeamEffect::update |
( |
float | dt, |
|
|
glm::vec3 | camForward ) |
Advance animation, age out undriven beams, and rebuild arc verts.
- Parameters
-
| dt | Frame delta time in seconds. |
| camForward | Camera forward vector for billboard orientation. |
◆ arcVerts_
| std::vector<ArcVertex> TeslaBeamEffect::arcVerts_ |
|
private |
◆ beams_
◆ k_bezierSegs
| int TeslaBeamEffect::k_bezierSegs = 28 |
|
staticconstexprprivate |
Samples along the main arc.
◆ k_bowFrac
| float TeslaBeamEffect::k_bowFrac = 0.16f |
|
staticconstexprprivate |
Spine sag as a fraction of beam length.
◆ k_branchRetime
| float TeslaBeamEffect::k_branchRetime = 0.05f |
|
staticconstexprprivate |
Branch re-randomise interval (s).
◆ k_branchSegs
| int TeslaBeamEffect::k_branchSegs = 6 |
|
staticconstexprprivate |
Samples along each branch.
◆ k_fadeTime
| float TeslaBeamEffect::k_fadeTime = 0.08f |
|
staticconstexprprivate |
◆ k_keepAlive
| float TeslaBeamEffect::k_keepAlive = 0.06f |
|
staticconstexprprivate |
Grace before an undriven beam starts fading.
◆ k_maxBeams
| int TeslaBeamEffect::k_maxBeams = 4 |
|
staticconstexprprivate |
◆ k_maxBranches
| int TeslaBeamEffect::k_maxBranches = 3 |
|
staticconstexprprivate |
The documentation for this class was generated from the following files: