$darkmode
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
scene.h File Reference
#include "app_settings.h"
#include "billboard_rendering.h"
#include "gl_common.h"
#include "gpu_profiler.h"
#include "ibl_coordinator.h"
#include "icosphere.h"
#include "instanced_rendering.h"
#include "light_probes.h"
#include "material.h"
#include "shader.h"
#include "skybox.h"
#include "sphere_sorting.h"
#include <cglm/cglm.h>
Include dependency graph for scene.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  InstancedUniforms
 Cached uniform locations for PBR instanced rendering. More...
 
struct  DebugUniforms
 Cached uniform locations for debug line rendering. More...
 
struct  BillboardUBO
 GPU-side uniform buffer for billboard rendering (std140 layout). More...
 
struct  BillboardUniforms
 Cached uniform locations for billboard rendering. More...
 
struct  Scene
 Encapsulates all 3D scene data, geometry, and rendering state. More...
 

Enumerations

enum  SortingMode { SORTING_MODE_CPU_QSORT = 0 , SORTING_MODE_CPU_RADIX , SORTING_MODE_GPU_BITONIC , SORTING_MODE_COUNT }
 Sorting algorithms for transparent billboards. More...
 
enum  GIMode { GI_MODE_OFF = 0 , GI_MODE_3D_TEX , GI_MODE_SSBO , GI_MODE_COUNT }
 Global Illumination sampling methods. More...
 
enum  AAMode { AA_MODE_SCREEN_SPACE = 0 , AA_MODE_CURVATURE , AA_MODE_COUNT }
 Specular Anti-Aliasing modes. More...
 
enum  { IBL_TEXTURE_COUNT = 3 }
 
enum  { TEXTURE_UNIT_IBL_START = 15 }
 
enum  { MAT4_FLOAT_COUNT = 16 }
 

Functions

 _Static_assert (_Alignof(BillboardUBO) >=GL_UBO_ALIGNMENT, "BillboardUBO" " must be >= 32-byte aligned for AVX (cglm)")
 
int scene_init (Scene *scene)
 Initializes the scene resources. More...
 
void scene_cleanup (Scene *scene)
 Cleans up scene resources. More...
 
const char * aa_mode_to_string (AAMode mode)
 Returns a string representation of the AA mode. More...
 
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. More...
 
void scene_update_gpu_buffers (Scene *scene)
 Updates GPU buffers for dynamic geometry (e.g. LOD changes). More...
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
IBL_TEXTURE_COUNT 

◆ anonymous enum

anonymous enum
Enumerator
TEXTURE_UNIT_IBL_START 

◆ anonymous enum

anonymous enum
Enumerator
MAT4_FLOAT_COUNT 

◆ AAMode

enum AAMode

Specular Anti-Aliasing modes.

Enumerator
AA_MODE_SCREEN_SPACE 
AA_MODE_CURVATURE 
AA_MODE_COUNT 

◆ GIMode

enum GIMode

Global Illumination sampling methods.

Enumerator
GI_MODE_OFF 
GI_MODE_3D_TEX 
GI_MODE_SSBO 
GI_MODE_COUNT 

◆ SortingMode

Sorting algorithms for transparent billboards.

Enumerator
SORTING_MODE_CPU_QSORT 
SORTING_MODE_CPU_RADIX 
SORTING_MODE_GPU_BITONIC 
SORTING_MODE_COUNT 

Sentinel — must remain last.

Function Documentation

◆ _Static_assert()

_Static_assert ( _Alignof(BillboardUBO) >=  GL_UBO_ALIGNMENT,
"BillboardUBO" " must be >= 32-byte aligned for AVX (cglm)"   
)

◆ aa_mode_to_string()

const char* aa_mode_to_string ( AAMode  mode)

Returns a string representation of the AA mode.

Parameters
modeThe AA mode.
Returns
String representation.

◆ scene_cleanup()

void scene_cleanup ( Scene scene)

Cleans up scene resources.

Parameters
scenePointer to the scene structure.
Here is the call graph for this function:

◆ scene_init()

int scene_init ( Scene scene)

Initializes the scene resources.

Parameters
scenePointer to the scene structure.
Returns
1 on success, 0 on failure.
Here is the call graph for this function:

◆ scene_render()

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.

Parameters
scenePointer to the scene.
viewView matrix.
projProjection matrix.
camera_posCamera position.
previous_view_projPrevious frame's ViewProj matrix (for motion blur).
widthViewport width.
heightViewport height.
Here is the call graph for this function:

◆ scene_update_gpu_buffers()

void scene_update_gpu_buffers ( Scene scene)

Updates GPU buffers for dynamic geometry (e.g. LOD changes).

Parameters
scenePointer to the scene.