Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
Loading...
Searching...
No Matches
scene.h
Go to the documentation of this file.
1#ifndef SCENE_H
2#define SCENE_H
3
4#include "app_settings.h"
6#include "icosphere.h"
8#include "scene_config.h"
9#include "scene_lighting.h"
10#include <cglm/cglm.h>
11
12#ifdef USE_SSBO_RENDERING
13#include "ssbo_rendering.h"
14#endif
15
16typedef struct PostProcess PostProcess;
17typedef struct GPUProfiler GPUProfiler;
18typedef struct SceneSimulation SceneSimulation;
19typedef struct SceneShaders SceneShaders;
21typedef struct SceneVisuals SceneVisuals;
22
27typedef struct Scene {
28 /* --- Geometry & Meshes --- */
34#ifdef USE_SSBO_RENDERING
35 SSBOGroup ssbo_group;
36#endif
37
38#ifdef USE_TRANSPARENT_BILLBOARDS
42#endif
43
44 /* --- Domain Sub-Structs (opaque, heap-allocated) --- */
50 /* --- Domain Sub-Structs (by-value) --- */
54 /* --- HDR Environment --- */
55 char** hdr_files;
59} Scene;
60
66int scene_init(Scene* scene);
67
72void scene_cleanup(Scene* scene);
73
79const char* aa_mode_to_string(AAMode mode);
80
91void scene_render(Scene* scene, GPUProfiler* profiler, mat4 view, mat4 proj,
92 vec3 camera_pos, mat4 previous_view_proj, int width,
93 int height);
94
100
105void scene_toggle_nbody(Scene* scene);
106
113void scene_nbody_update(Scene* scene, float delta_time);
114
115/* --- Subsystem descriptor (alloc-only Phase 1) --- */
116#include "app_subsystem.h"
117
118int scene_subsys_init(struct App* app);
119void scene_subsys_cleanup(struct App* app);
120
121#define APP_SCENE_DESCRIPTOR {"scene", scene_subsys_init, scene_subsys_cleanup}
122
123#endif /* SCENE_H */
Global application constants, configuration macros, and default values.
Subsystem descriptor pattern for structured init/cleanup.
Unified billboard sorting and rendering system.
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:315
void scene_cleanup(Scene *scene)
Cleans up scene resources.
Definition scene_cleanup.c:82
const char * aa_mode_to_string(AAMode mode)
Returns a string representation of the AA mode.
Definition scene_render.c:30
void scene_update_gpu_buffers(Scene *scene)
Updates GPU buffers for dynamic geometry (e.g. LOD changes).
Definition scene_render.c:42
void scene_toggle_nbody(Scene *scene)
Toggles N-body simulation mode on/off.
Definition scene_nbody.c:18
void scene_subsys_cleanup(struct App *app)
Definition scene_init.c:527
void scene_nbody_update(Scene *scene, float delta_time)
Advances the N-body simulation by one frame.
Definition scene_nbody.c:80
int scene_init(Scene *scene)
Initializes the scene resources.
Definition scene_init.c:427
int scene_subsys_init(struct App *app)
Definition scene_init.c:508
Render configuration flags extracted from Scene.
AAMode
Specular Anti-Aliasing modes.
Definition scene_config.h:37
IBL, probes, and materials sub-struct extracted from Scene.
Buffer-backed instancing for ultra-large-scale rendering.
The central state container for the entire application.
Definition app.h:24
Manages billboard rendering buffers, VAO state, and the internal sorter.
Definition billboard_renderer.h:48
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:47
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:27
SceneShaders * shaders
Definition scene.h:47
int current_hdr_index
Definition scene.h:57
SphereInstance * billboard_instances
Definition scene.h:40
SceneConfig config
Definition scene.h:52
int hdr_count
Definition scene.h:56
SceneLighting lighting
Definition scene.h:51
SceneGPUResources * gpu
Definition scene.h:46
BillboardRenderer billboard_renderer
Definition scene.h:32
IcosphereGeometry geometry
Definition scene.h:29
SceneVisuals * visuals
Definition scene.h:48
char ** hdr_files
Definition scene.h:55
SceneSimulation * simulation
Definition scene.h:45
InstancedGroup instanced_group
Definition scene.h:31
int billboard_instance_count
Definition scene.h:41
Per-instance data sent to the shader via an instanced VBO.
Definition sphere_types.h:25