|
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
|
GPU-accelerated ribbon trail renderer for N-body simulation. More...
Go to the source code of this file.
Data Structures | |
| struct | TrailVertex |
| Per-vertex data for the ribbon triangle strip. More... | |
| struct | TrailRing |
| Ring buffer of recorded positions for one body. More... | |
| struct | TrailNeonParams |
| Runtime-adjustable neon glow profile parameters. More... | |
| struct | TrailRenderer |
| Manages trail state and GPU resources for all bodies. More... | |
Enumerations | |
| enum | { TRAIL_MAX_POINTS = 256 } |
| enum | TrailNeonParam { TRAIL_NEON_PARAM_INTENSITY = 0 , TRAIL_NEON_PARAM_CORE , TRAIL_NEON_PARAM_WIDTH , TRAIL_NEON_PARAM_COUNT } |
| Identifies which neon parameter is being adjusted. More... | |
Functions | |
| bool | trail_renderer_init (TrailRenderer *tr, int body_count) |
| Initializes trail renderer resources. | |
| void | trail_renderer_set_color (TrailRenderer *tr, int body_index, const vec3 color) |
| Sets the trail color for a specific body. | |
| void | trail_renderer_record (TrailRenderer *tr, const NBodySim *sim, float delta_time) |
| Records current positions from the simulation. | |
| float | trail_renderer_get_duration (const TrailRenderer *tr) |
| Returns the current trail duration in seconds. | |
| void | trail_renderer_set_duration (TrailRenderer *tr, float duration) |
| Sets the trail duration in seconds (clamped to valid range). | |
| void | trail_renderer_draw (TrailRenderer *tr, mat4 view, mat4 proj, vec3 cam_pos) |
| Builds ribbon geometry and renders all trails. | |
| void | trail_renderer_clear (TrailRenderer *tr) |
| Clears all recorded trail data (e.g., on simulation reset). | |
| void | trail_renderer_cleanup (TrailRenderer *tr) |
| Releases all GPU resources. | |
Variables | |
| static const float | TRAIL_HDR_INTENSITY = 5.0F |
| static const float | TRAIL_MAX_WIDTH = 0.24F |
| static const float | TRAIL_SAMPLE_INTERVAL = 1.0F / 60.0F |
| static const float | TRAIL_DURATION_DEFAULT = 4.0F |
| static const float | TRAIL_DURATION_MIN = 0.5F |
| static const float | TRAIL_DURATION_MAX = 30.0F |
| static const float | TRAIL_DURATION_STEP = 0.5F |
| static const float | TRAIL_NEON_INTENSITY_DEFAULT = 5.0F |
| static const float | TRAIL_NEON_CORE_EXP_DEFAULT = 12.0F |
| static const float | TRAIL_NEON_WIDTH_DEFAULT = 0.24F |
| static const float | TRAIL_NEON_INTENSITY_STEP = 0.5F |
| static const float | TRAIL_NEON_CORE_STEP = 2.0F |
| static const float | TRAIL_NEON_WIDTH_STEP = 0.02F |
| static const float | TRAIL_NEON_INTENSITY_MIN = 0.5F |
| static const float | TRAIL_NEON_CORE_MIN = 2.0F |
| static const float | TRAIL_NEON_WIDTH_MIN = 0.04F |
GPU-accelerated ribbon trail renderer for N-body simulation.
Records positions over time for each body and renders camera-facing ribbon geometry with:
| enum TrailNeonParam |
| void trail_renderer_cleanup | ( | TrailRenderer * | tr | ) |
Releases all GPU resources.
| tr | Pointer to the trail renderer. |
| void trail_renderer_clear | ( | TrailRenderer * | tr | ) |
Clears all recorded trail data (e.g., on simulation reset).
| tr | Pointer to the trail renderer. |
| void trail_renderer_draw | ( | TrailRenderer * | tr, |
| mat4 | view, | ||
| mat4 | proj, | ||
| vec3 | cam_pos | ||
| ) |
Builds ribbon geometry and renders all trails.
Must be called while the HDR framebuffer is active (before post-process). Sets up additive blending and depth-read-no-write internally.
| tr | Pointer to the trail renderer. |
| view | View matrix. |
| proj | Projection matrix. |
| cam_pos | Camera world position. |
| float trail_renderer_get_duration | ( | const TrailRenderer * | tr | ) |
Returns the current trail duration in seconds.
| bool trail_renderer_init | ( | TrailRenderer * | tr, |
| int | body_count | ||
| ) |
Initializes trail renderer resources.
| tr | Pointer to the trail renderer. |
| body_count | Number of bodies to track. |
| void trail_renderer_record | ( | TrailRenderer * | tr, |
| const NBodySim * | sim, | ||
| float | delta_time | ||
| ) |
Records current positions from the simulation.
Should be called every frame. Internally rate-limits sampling.
| tr | Pointer to the trail renderer. |
| sim | Pointer to the N-body simulation. |
| delta_time | Frame delta time. |
| void trail_renderer_set_color | ( | TrailRenderer * | tr, |
| int | body_index, | ||
| const vec3 | color | ||
| ) |
Sets the trail color for a specific body.
| tr | Pointer to the trail renderer. |
| body_index | Body index. |
| color | HDR emissive color (values > 1.0 are valid for bloom). |
| void trail_renderer_set_duration | ( | TrailRenderer * | tr, |
| float | duration | ||
| ) |
Sets the trail duration in seconds (clamped to valid range).
|
static |
Default trail duration in seconds (how long a trail persists).
|
static |
|
static |
Minimum / maximum trail duration for runtime adjustment.
|
static |
|
static |
HDR intensity multiplier — drives bloom for neon glow effect.
|
static |
Maximum ribbon half-width in world units.
|
static |
|
static |
|
static |
|
static |
Default neon parameter values.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Minimum time between trail samples (seconds).