SBgl 0.1.0
A graphics framework in C99
Loading...
Searching...
No Matches
sbgl_voxel.h
Go to the documentation of this file.
1#ifndef SBGL_VOXEL_H
2#define SBGL_VOXEL_H
3
9#include "sbgl.h"
10
17
21typedef struct {
26 uint32_t max_slots;
27
32 uint32_t chunk_radius;
33
39
40typedef struct {
42 float roughness;
43 float metalness;
44 uint32_t textureID;
45 uint32_t _pad;
47
57
65void sbgl_Voxel_Update(sbgl_VoxelSystem* sys, sbgl_Vec3 camera_pos);
66
74void sbgl_Voxel_Cull(sbgl_VoxelSystem* sys, sbgl_Mat4 view_proj);
75
83
90
93
96
99
100#endif // SBGL_VOXEL_H
API for the SiputBiru Graphics Library (SBgl).
uint64_t sbgl_Voxel_GetInstanceAddress(sbgl_VoxelSystem *sys)
Returns the device address of the instance buffer.
Definition sbgl_voxel.c:563
void sbgl_Voxel_Cull(sbgl_VoxelSystem *sys, sbgl_Mat4 view_proj)
Performs GPU-driven frustum culling on voxel chunks. MUST be called BEFORE sbgl_BeginDrawing.
Definition sbgl_voxel.c:436
uint64_t sbgl_Voxel_GetPaletteAddress(sbgl_VoxelSystem *sys)
Returns the device address of the material palette buffer.
Definition sbgl_voxel.c:568
uint64_t sbgl_Voxel_GetAABBAddress(sbgl_VoxelSystem *sys)
Returns the device address of the AABB buffer.
Definition sbgl_voxel.c:558
void sbgl_Voxel_Update(sbgl_VoxelSystem *sys, sbgl_Vec3 camera_pos)
Updates the voxel system state based on the current camera position. This function handles chunk gene...
Definition sbgl_voxel.c:286
void sbgl_Voxel_Render(sbgl_VoxelSystem *sys)
Issues the indirect draw calls for visible voxel chunks. MUST be called BETWEEN sbgl_BeginDrawing and...
Definition sbgl_voxel.c:487
void sbgl_Voxel_Destroy(sbgl_VoxelSystem *sys)
Destroys the voxel system and releases all associated resources.
Definition sbgl_voxel.c:525
sbgl_VoxelSystem * sbgl_Voxel_Create(sbgl_Context *ctx, const sbgl_VoxelConfig *config)
Creates and initializes a new voxel system. This operation allocates GPU resources and internal track...
Definition sbgl_voxel.c:143
Engine context.
Definition sbgl_types.h:268
4x4 Matrix, 16-byte aligned, column-major.
Definition sbgl_math.h:83
float roughness
Definition sbgl_voxel.h:42
uint32_t _pad
Definition sbgl_voxel.h:45
uint32_t textureID
Definition sbgl_voxel.h:44
float metalness
Definition sbgl_voxel.h:43
sbgl_Vec4 color
Definition sbgl_voxel.h:41
Configuration parameters for initializing the voxel system.
Definition sbgl_voxel.h:21
bool enable_telemetry
Enables console output for performance metrics and visible chunk counts.
Definition sbgl_voxel.h:37
uint32_t max_slots
Maximum number of chunk slots to manage in the GPU-side pool. This value determines the total memory ...
Definition sbgl_voxel.h:26
uint32_t chunk_radius
Radius (in chunks) around the camera that should be maintained. Chunks outside this radius are candid...
Definition sbgl_voxel.h:32
Internal state for the voxel system. This structure adheres to Data-Oriented Design principles by mai...
Definition sbgl_voxel.c:70
3D Vector, 16-byte aligned and padded for SIMD safety.
Definition sbgl_math.h:49
4D Vector, 16-byte aligned.
Definition sbgl_math.h:61