$darkmode
Visual shockwave effect for N-body confinement boundary impacts. More...
Go to the source code of this file.
Data Structures | |
| struct | ShockwaveEvent |
| One active shockwave expanding from an impact point. More... | |
| struct | ShockwaveRenderer |
| Manages and renders active shockwave effects. More... | |
Enumerations | |
| enum | { SHOCKWAVE_MAX_ACTIVE = 16 } |
Functions | |
| bool | shockwave_renderer_init (ShockwaveRenderer *renderer) |
| Initializes shockwave renderer (shader + GPU resources). More... | |
| void | shockwave_renderer_cleanup (ShockwaveRenderer *renderer) |
| Releases all GPU resources. More... | |
| void | shockwave_emit (ShockwaveRenderer *renderer, const vec3 position, const vec3 color, float velocity, float sim_time) |
| Registers a new shockwave at the given position. More... | |
| void | shockwave_update (ShockwaveRenderer *renderer, float sim_time) |
| Removes expired shockwaves based on current simulation time. More... | |
| void | shockwave_draw (const ShockwaveRenderer *renderer, mat4 view, mat4 proj, vec3 camera_pos, float sim_time, int screen_w, int screen_h) |
| Draws all active shockwaves as billboard quads with lensing. More... | |
Variables | |
| static const float | SHOCKWAVE_DURATION = 1.2F * 3.0F |
| static const float | SHOCKWAVE_MAX_RADIUS = 6.0F |
| static const float | SHOCKWAVE_MIN_VELOCITY = 0.05F |
| static const float | SHOCKWAVE_HDR_INTENSITY = 4.0F |
Visual shockwave effect for N-body confinement boundary impacts.
When a body crosses the confinement radius, a radial energy ring expands from the impact point and fades out. Rendered as screen-aligned quads that sample the scene behind them and apply radial UV distortion with chromatic aberration — a localized lens-like refraction effect.
| void shockwave_draw | ( | const ShockwaveRenderer * | renderer, |
| mat4 | view, | ||
| mat4 | proj, | ||
| vec3 | camera_pos, | ||
| float | sim_time, | ||
| int | screen_w, | ||
| int | screen_h | ||
| ) |
Draws all active shockwaves as billboard quads with lensing.
Performs a grab pass (copies scene_color_tex to an internal texture) then draws billboard quads that sample the copy and apply radial UV distortion with chromatic aberration.
Should be called after scene geometry, before post-processing.
| renderer | Renderer state. |
| view | View matrix. |
| proj | Projection matrix. |
| camera_pos | Camera world position. |
| sim_time | Current simulation time. |
| screen_w | Viewport width in pixels. |
| screen_h | Viewport height in pixels. |
| void shockwave_emit | ( | ShockwaveRenderer * | renderer, |
| const vec3 | position, | ||
| const vec3 | color, | ||
| float | velocity, | ||
| float | sim_time | ||
| ) |
Registers a new shockwave at the given position.
Oldest event is evicted if the buffer is full.
| sw | Renderer state. |
| position | World-space impact point. |
| color | Body albedo color. |
| velocity | Radial velocity at impact (determines intensity). |
| sim_time | Current simulation time. |
| void shockwave_renderer_cleanup | ( | ShockwaveRenderer * | renderer | ) |
Releases all GPU resources.
| bool shockwave_renderer_init | ( | ShockwaveRenderer * | renderer | ) |
Initializes shockwave renderer (shader + GPU resources).
| void shockwave_update | ( | ShockwaveRenderer * | renderer, |
| float | sim_time | ||
| ) |
Removes expired shockwaves based on current simulation time.
|
static |
Shockwave lifetime in seconds.
|
static |
HDR intensity for the shockwave ring (drives bloom).
|
static |
Maximum ring expansion radius in world units.
|
static |
Minimum velocity to trigger a shockwave (avoids spam from bodies barely grazing the boundary).