group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
HitscanEffect Class Reference

Hitscan energy beam using fBm (fractional Brownian motion) path deviation. More...

#include <HitscanEffect.hpp>

Public Member Functions

void update (float dt, glm::vec3 camForward)
 Update all active beams, rebuilding arc vertex data each frame.
 
void spawn (glm::vec3 origin, glm::vec3 hitPos, WeaponType wt, glm::vec3 camForward)
 Fire a beam.
 
const ArcVertexarcData () const
 Get pointer to the arc vertex array for GPU upload.
 
uint32_t arcCount () const
 Get the number of arc vertices currently generated.
 
uint32_t activeBeamCount () const
 Get the number of active beams.
 
const HitscanBeambeamData () const
 
uint32_t beamCount () const
 

Detailed Description

Hitscan energy beam using fBm (fractional Brownian motion) path deviation.

Signal chain per frame: t [0,1] along Bezier spine -> optional domain warp -> 4-octave fBm (lacunarity~3, persistence~0.4) -> multiply by sin(t*pi) envelope (pinned at both endpoints) -> scale by baseAmplitude (16 % of beam length) -> apply perpendicular to Bezier tangent

Rendering: three concentric triangle-strip layers per arc (outer bloom halo, inner glow channel, white-hot core) rendered with additive blending, giving an HDR-like look without a post-process pass.

Temporal behaviour:

  • Smooth Bezier morph when a new shot is fired (80 ms interpolation).
  • Continuous fBm animation (each octave runs at 2x the speed of the one below).
  • 2-3 return strokes scheduled at 60/120/180 ms after the initial shot; each re-randomises the arc path and branches, simulating multi-strike behaviour.
  • Branches re-randomise every 45 ms for rapid flicker.

Member Function Documentation

◆ activeBeamCount()

uint32_t HitscanEffect::activeBeamCount ( ) const

Get the number of active beams.

Returns
Count of beams with active == true.
Here is the caller graph for this function:

◆ arcCount()

uint32_t HitscanEffect::arcCount ( ) const
inline

Get the number of arc vertices currently generated.

Returns
Vertex count.
Here is the caller graph for this function:

◆ arcData()

const ArcVertex * HitscanEffect::arcData ( ) const
inline

Get pointer to the arc vertex array for GPU upload.

Returns
Pointer to the first ArcVertex, or nullptr if empty.
Here is the caller graph for this function:

◆ beamCount()

uint32_t HitscanEffect::beamCount ( ) const
inline
Here is the caller graph for this function:

◆ beamData()

const HitscanBeam * HitscanEffect::beamData ( ) const
inline
Here is the caller graph for this function:

◆ spawn()

void HitscanEffect::spawn ( glm::vec3  origin,
glm::vec3  hitPos,
WeaponType  wt,
glm::vec3  camForward 
)

Fire a beam.

Consecutive shots on the same slot produce a smooth morph.

Parameters
originWorld-space beam start position.
hitPosWorld-space beam end position.
wtWeapon type (reserved for future per-weapon tuning).
camForwardCamera forward vector for control-point placement.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update()

void HitscanEffect::update ( float  dt,
glm::vec3  camForward 
)

Update all active beams, rebuilding arc vertex data each frame.

Parameters
dtFrame delta time in seconds.
camForwardCamera forward vector for billboard orientation.
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: