$darkmode
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
scene.h
Go to the documentation of this file.
1 #ifndef SCENE_H
2 #define SCENE_H
3 
4 #include "app_settings.h"
5 #include "billboard_rendering.h"
6 #include "billboard_sorting.h"
7 #include "icosphere.h"
8 #include "instanced_rendering.h"
9 #include "scene_config.h"
10 #include "scene_lighting.h"
11 #include <cglm/cglm.h>
12 
13 #ifdef USE_SSBO_RENDERING
14 #include "ssbo_rendering.h"
15 #endif
16 
17 typedef struct PostProcess PostProcess;
18 typedef struct GPUProfiler GPUProfiler;
19 typedef struct SceneSimulation SceneSimulation;
20 typedef struct SceneShaders SceneShaders;
22 typedef struct SceneVisuals SceneVisuals;
23 
28 typedef struct Scene {
29  /* --- Geometry & Meshes --- */
34 #ifdef USE_SSBO_RENDERING
35  SSBOGroup ssbo_group;
36 #endif
37 
38 #ifdef USE_TRANSPARENT_BILLBOARDS
43 #endif
44 
45  /* --- Domain Sub-Structs (opaque, heap-allocated) --- */
51  /* --- Domain Sub-Structs (by-value) --- */
55  /* --- HDR Environment --- */
56  char** hdr_files;
57  int hdr_count;
60 } Scene;
61 
67 int scene_init(Scene* scene);
68 
73 void scene_cleanup(Scene* scene);
74 
80 const char* aa_mode_to_string(AAMode mode);
81 
92 void scene_render(Scene* scene, GPUProfiler* profiler, mat4 view, mat4 proj,
93  vec3 camera_pos, mat4 previous_view_proj, int width,
94  int height);
95 
100 void scene_update_gpu_buffers(Scene* scene);
101 
106 void scene_toggle_nbody(Scene* scene);
107 
114 void scene_nbody_update(Scene* scene, float delta_time);
115 
116 #endif /* SCENE_H */
Global application constants, configuration macros, and default values.
View-aligned quad rendering (billboarding) for optimized sphere drawing.
Back-to-front sorting for transparent geometry.
Procedural icosphere geometry generation.
Mesh-based instanced rendering for spheres.
void scene_render(Scene *scene, GPUProfiler *profiler, mat4 view, mat4 proj, vec3 camera_pos, mat4 previous_view_proj, int width, int height)
Renders the scene.
Definition: scene_render.c:292
void scene_cleanup(Scene *scene)
Cleans up scene resources.
Definition: scene_cleanup.c:80
void scene_update_gpu_buffers(Scene *scene)
Updates GPU buffers for dynamic geometry (e.g. LOD changes).
Definition: scene_render.c:36
void scene_toggle_nbody(Scene *scene)
Toggles N-body simulation mode on/off.
Definition: scene_nbody.c:16
void scene_nbody_update(Scene *scene, float delta_time)
Advances the N-body simulation by one frame.
Definition: scene_nbody.c:79
int scene_init(Scene *scene)
Initializes the scene resources.
Definition: scene_init.c:416
const char * aa_mode_to_string(AAMode mode)
Returns a string representation of the AA mode.
Definition: scene_render.c:24
Render configuration flags extracted from Scene.
AAMode
Specular Anti-Aliasing modes.
Definition: scene_config.h:35
IBL, probes, and materials sub-struct extracted from Scene.
Buffer-backed instancing for ultra-large-scale rendering.
Manages a set of billboarded instances on the GPU.
Definition: billboard_rendering.h:21
Reusable memory context for sorting operations.
Definition: billboard_sorting.h:28
Manages GPU timing using double-buffered queries to avoid stalls.
Definition: gpu_profiler.h:86
Container for procedural mesh data.
Definition: icosphere.h:40
Manages mesh-based instanced spheres on the GPU.
Definition: instanced_rendering.h:20
Main pipeline state for post-processing.
Definition: postprocess_internal.h:46
GPU resources for an SSBO-based render group.
Definition: ssbo_rendering.h:35
Render configuration flags and toggles.
Definition: scene_config.h:45
All GPU resource handles owned by the scene.
Definition: scene_gpu_resources.h:23
IBL, probes, and materials grouped to reduce Scene fan-out.
Definition: scene_lighting.h:17
All shader pointers and uniform caches owned by the scene.
Definition: scene_shaders.h:16
N-body simulation state grouped to reduce Scene fan-out.
Definition: scene_simulation.h:15
Visual effects grouped into a sub-struct to reduce Scene fan-out.
Definition: scene_visuals.h:17
Encapsulates all 3D scene data, geometry, and rendering state.
Definition: scene.h:28
BillboardGroup billboard_group
Definition: scene.h:33
SceneShaders * shaders
Definition: scene.h:48
int current_hdr_index
Definition: scene.h:58
SphereInstance * billboard_instances
Definition: scene.h:41
SceneConfig config
Definition: scene.h:53
int hdr_count
Definition: scene.h:57
SceneLighting lighting
Definition: scene.h:52
BillboardSorter billboard_sorter
Definition: scene.h:39
SceneGPUResources * gpu
Definition: scene.h:47
IcosphereGeometry geometry
Definition: scene.h:30
SceneVisuals * visuals
Definition: scene.h:49
char ** hdr_files
Definition: scene.h:56
SceneSimulation * simulation
Definition: scene.h:46
InstancedGroup instanced_group
Definition: scene.h:32
int billboard_instance_count
Definition: scene.h:42
Per-instance data sent to the shader via an instanced VBO.
Definition: sphere_types.h:25