$darkmode
#include "shockwave.h"#include "gl_common.h"#include "log.h"#include "shader.h"#include "utils.h"#include <cglm/vec3.h>#include <math.h>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... | |
| static void | ensure_grab_texture (ShockwaveRenderer *ren, int width, int height) |
| 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 | QUAD_VERTICES [] |
| static const int | QUAD_VERTEX_COUNT = 4 |
| static const int | QUAD_FLOATS = 12 |
|
static |
| 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 |
|
static |
|
static |