Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
Loading...
Searching...
No Matches
billboard_renderer.c File Reference
#include "billboard_renderer.h"
#include "billboard_sorter.h"
#include "bool_utils.h"
#include "gl_common.h"
#include "render_utils.h"
#include "scene_uniforms.h"
#include "sphere_types.h"
#include "utils.h"
#include <assert.h>
#include <stddef.h>
#include <string.h>
Include dependency graph for billboard_renderer.c:

Functions

static void create_billboard_vao (GLuint *vao, GLuint geometry_vbo, GLuint instance_vbo)
 
void billboard_renderer_init (BillboardRenderer *renderer, int initial_capacity)
 Initializes the billboard renderer and allocates internal sorter buffers.
 
void billboard_renderer_prepare (BillboardRenderer *renderer, GLuint quad_vbo, GLuint wire_quad_vbo, GLuint wire_cube_vbo)
 Prepares the VAO by linking the shared quad, wire quad, and wire cube VBOs.
 
static void billboard_renderer_update_from_buffer (BillboardRenderer *renderer, GLuint src_buffer, int count)
 
static void update_billboard_ubo (const BillboardRenderParams *params, void *billboard_ubo_ptr)
 
static void draw_primary_pass (BillboardRenderer *renderer, GLuint pbr_billboard_shader, int instance_count)
 
static void update_debug_uniform_locations (BillboardRenderer *renderer, GLuint debug_line_shader)
 
static void draw_debug_overlays (BillboardRenderer *renderer, const BillboardRenderParams *params, GLuint debug_line_shader, GLuint sorted_ssbo)
 
void billboard_renderer_draw (BillboardRenderer *renderer, const BillboardRenderParams *params, GLuint pbr_billboard_shader, GLuint debug_line_shader, void *billboard_ubo_ptr)
 Executes the sorting, UBO upload, and drawing commands for all billboards.
 
void billboard_renderer_cleanup (BillboardRenderer *renderer)
 Releases all GPU resources allocated for the billboard renderer.
 

Variables

static const int WIRE_CUBE_VERTEX_COUNT = 24
 

Function Documentation

◆ billboard_renderer_cleanup()

void billboard_renderer_cleanup ( BillboardRenderer *  renderer)

Releases all GPU resources allocated for the billboard renderer.

Parameters
rendererPointer to the renderer struct.
Here is the call graph for this function:

◆ billboard_renderer_draw()

void billboard_renderer_draw ( BillboardRenderer *  renderer,
const BillboardRenderParams *  params,
GLuint  pbr_billboard_shader,
GLuint  debug_line_shader,
void *  billboard_ubo_ptr 
)

Executes the sorting, UBO upload, and drawing commands for all billboards.

Parameters
rendererPointer to the renderer struct.
paramsStateless parameter block.
pbr_billboard_shaderShader used for the primary PBR pass.
debug_line_shaderShader used for the wireframe debug overlays.
billboard_ubo_ptrMapped UBO pointer to copy the BillboardUBO struct to.
Here is the call graph for this function:

◆ billboard_renderer_init()

void billboard_renderer_init ( BillboardRenderer *  renderer,
int  initial_capacity 
)

Initializes the billboard renderer and allocates internal sorter buffers.

Parameters
rendererPointer to the renderer struct.
initial_capacityExpected number of instances.
Here is the call graph for this function:

◆ billboard_renderer_prepare()

void billboard_renderer_prepare ( BillboardRenderer *  renderer,
GLuint  quad_vbo,
GLuint  wire_quad_vbo,
GLuint  wire_cube_vbo 
)

Prepares the VAO by linking the shared quad, wire quad, and wire cube VBOs.

Parameters
rendererPointer to the renderer struct.
quad_vboVBO containing basic quad geometry.
wire_quad_vboVBO for debug wireframe quad.
wire_cube_vboVBO for debug wireframe unit box.
Here is the call graph for this function:

◆ billboard_renderer_update_from_buffer()

static void billboard_renderer_update_from_buffer ( BillboardRenderer *  renderer,
GLuint  src_buffer,
int  count 
)
static

◆ create_billboard_vao()

static void create_billboard_vao ( GLuint *  vao,
GLuint  geometry_vbo,
GLuint  instance_vbo 
)
static
Here is the call graph for this function:

◆ draw_debug_overlays()

static void draw_debug_overlays ( BillboardRenderer *  renderer,
const BillboardRenderParams *  params,
GLuint  debug_line_shader,
GLuint  sorted_ssbo 
)
static
Here is the call graph for this function:

◆ draw_primary_pass()

static void draw_primary_pass ( BillboardRenderer *  renderer,
GLuint  pbr_billboard_shader,
int  instance_count 
)
static

◆ update_billboard_ubo()

static void update_billboard_ubo ( const BillboardRenderParams *  params,
void *  billboard_ubo_ptr 
)
static
Here is the call graph for this function:

◆ update_debug_uniform_locations()

static void update_debug_uniform_locations ( BillboardRenderer *  renderer,
GLuint  debug_line_shader 
)
static

Variable Documentation

◆ WIRE_CUBE_VERTEX_COUNT

const int WIRE_CUBE_VERTEX_COUNT = 24
static