16 #include <cglm/cglm.h>
18 #ifdef USE_SSBO_RENDERING
109 float screen_size[2];
111 float probe_grid_min[3];
113 float probe_grid_max[3];
115 int32_t probe_grid_dim[3];
117 float grid_to_idx_scale[3];
144 #ifdef USE_SSBO_RENDERING
148 #ifdef USE_TRANSPARENT_BILLBOARDS
167 #ifdef USE_SSBO_RENDERING
257 vec3 camera_pos, mat4 previous_view_proj,
int width,
Global application constants, configuration macros, and default values.
View-aligned quad rendering (billboarding) for optimized sphere drawing.
Common OpenGL definitions, RAII helpers, and utilities.
#define GL_ASSERT_UBO_ALIGNMENT(type)
Compile-time assertion that a UBO struct meets AVX alignment. Place after the typedef to catch miscon...
Definition: gl_common.h:153
#define GL_UBO_ALIGNED
Attribute to apply on UBO typedef to enforce AVX alignment. Usage: } GL_UBO_ALIGNED MyUBOType;.
Definition: gl_common.h:146
Coordinator for progressive Image-Based Lighting (IBL) generation.
Procedural icosphere geometry generation.
Mesh-based instanced rendering for spheres.
@ SH_TEXTURE_COUNT
Definition: light_probes.h:21
PBR material definitions and management.
AAMode
Specular Anti-Aliasing modes.
Definition: scene.h:50
@ AA_MODE_CURVATURE
Definition: scene.h:52
@ AA_MODE_COUNT
Definition: scene.h:53
@ AA_MODE_SCREEN_SPACE
Definition: scene.h:51
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.c:825
@ TEXTURE_UNIT_IBL_START
Definition: scene.h:62
void scene_cleanup(Scene *scene)
Cleans up scene resources.
Definition: scene.c:533
GIMode
Global Illumination sampling methods.
Definition: scene.h:39
@ GI_MODE_COUNT
Definition: scene.h:43
@ GI_MODE_3D_TEX
Definition: scene.h:41
@ GI_MODE_OFF
Definition: scene.h:40
@ GI_MODE_SSBO
Definition: scene.h:42
void scene_update_gpu_buffers(Scene *scene)
Updates GPU buffers for dynamic geometry (e.g. LOD changes).
Definition: scene.c:588
SortingMode
Sorting algorithms for transparent billboards.
Definition: scene.h:28
@ SORTING_MODE_CPU_QSORT
Definition: scene.h:29
@ SORTING_MODE_CPU_RADIX
Definition: scene.h:30
@ SORTING_MODE_GPU_BITONIC
Definition: scene.h:31
@ SORTING_MODE_COUNT
Definition: scene.h:32
@ IBL_TEXTURE_COUNT
Definition: scene.h:61
@ MAT4_FLOAT_COUNT
Definition: scene.h:101
int scene_init(Scene *scene)
Initializes the scene resources.
Definition: scene.c:408
const char * aa_mode_to_string(AAMode mode)
Returns a string representation of the AA mode.
Definition: scene.c:576
High-level OpenGL shader management with metadata and uniform caching.
Infinite-distance background rendering (fullscreen quad approach).
Back-to-front sorting for transparent geometry.
Buffer-backed instancing for ultra-large-scale rendering.
Manages a set of billboarded instances on the GPU.
Definition: billboard_rendering.h:22
GPU-side uniform buffer for billboard rendering (std140 layout).
Definition: scene.h:102
int32_t gi_mode
Definition: scene.h:112
int32_t aa_mode
Definition: scene.h:116
float _pad1
Definition: scene.h:118
int32_t debug_mode
Definition: scene.h:108
int32_t specular_aa_enabled
Definition: scene.h:114
Manages GPU timing using double-buffered queries to avoid stalls.
Definition: gpu_profiler.h:86
Manages the progressive IBL generation process.
Definition: ibl_coordinator.h:36
Container for procedural mesh data.
Definition: icosphere.h:40
Manages mesh-based instanced spheres on the GPU.
Definition: instanced_rendering.h:36
Definition: light_probes.h:30
A collection of material presets loaded from disk or defined at runtime.
Definition: material.h:34
Main pipeline state for post-processing.
Definition: postprocess.h:353
GPU resources for an SSBO-based render group.
Definition: ssbo_rendering.h:35
Encapsulates all 3D scene data, geometry, and rendering state.
Definition: scene.h:138
GLuint bound_sh_textures[SH_TEXTURE_COUNT]
Definition: scene.h:203
SortingMode sorting_mode
Definition: scene.h:209
GLuint empty_vao
Definition: scene.h:187
Skybox skybox
Definition: scene.h:154
BillboardGroup billboard_group
Definition: scene.h:143
GLuint wire_quad_vbo
Definition: scene.h:181
GLuint shader_lum_pass1
Definition: scene.h:190
Shader * debug_line_shader
Definition: scene.h:171
InstancedUniforms instanced_uniforms
Definition: scene.h:221
Shader * pbr_instanced_shader
Definition: scene.h:164
int show_probe_grid
Definition: scene.h:215
void * billboard_ubo_ptr
Definition: scene.h:197
AAMode aa_mode
Definition: scene.h:217
int subdivisions
Definition: scene.h:213
int show_envmap
Definition: scene.h:211
GLuint bound_ibl_textures[IBL_TEXTURE_COUNT]
Definition: scene.h:200
GLuint lum_ssbo[2]
Definition: scene.h:194
GLuint spec_prefiltered_tex
Definition: scene.h:184
int current_hdr_index
Definition: scene.h:158
DebugUniforms debug_uniforms
Definition: scene.h:222
GLuint hdr_texture
Definition: scene.h:182
float env_lod
Definition: scene.h:212
GLuint billboard_ubo
Definition: scene.h:196
GLuint recycled_hdr_tex
Definition: scene.h:183
SphereSorter sphere_sorter
Definition: scene.h:149
GLuint bound_probe_ssbo
Definition: scene.h:204
int sphere_instance_count
Definition: scene.h:151
int hdr_count
Definition: scene.h:157
int specular_aa_enabled
Definition: scene.h:216
GLuint irradiance_tex
Definition: scene.h:185
Shader * debug_shader
Definition: scene.h:170
GLuint shader_lum_pass2
Definition: scene.h:191
MaterialLib * material_lib
Definition: scene.h:155
SphereInstance * sphere_instances
Definition: scene.h:150
GLuint dummy_black_tex
Definition: scene.h:192
Shader * pbr_billboard_shader
Definition: scene.h:166
GLuint brdf_lut_tex
Definition: scene.h:186
int billboard_mode
Definition: scene.h:208
BillboardUniforms billboard_uniforms
Definition: scene.h:220
GLuint transition_snapshot_tex
Definition: scene.h:195
Shader * skybox_shader
Definition: scene.h:172
int pbr_debug_mode
Definition: scene.h:210
IcosphereGeometry geometry
Definition: scene.h:140
GLuint shader_irmap
Definition: scene.h:189
char ** hdr_files
Definition: scene.h:156
GLuint sphere_ebo
Definition: scene.h:178
GLuint wire_cube_vbo
Definition: scene.h:180
int wireframe
Definition: scene.h:207
GLuint sphere_nbo
Definition: scene.h:177
InstancedGroup instanced_group
Definition: scene.h:142
LightProbeGrid probe_grid
Definition: scene.h:161
GLuint sphere_vao
Definition: scene.h:175
GLuint quad_vbo
Definition: scene.h:179
GIMode gi_mode
Definition: scene.h:214
IBLCoordinator ibl_coord
Definition: scene.h:159
GLuint shader_spmap
Definition: scene.h:188
GLuint dummy_white_tex
Definition: scene.h:193
GLuint sphere_vbo
Definition: scene.h:176
Wrapper for an OpenGL program with uniform caching and automatic cleanup.
Definition: shader.h:71
Persistent state and resource handles for the environment renderer.
Definition: skybox.h:23
Per-instance data sent to the shader via an instanced VBO.
Definition: instanced_rendering.h:23
Reusable memory context for sorting operations.
Definition: sphere_sorting.h:28