Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
Loading...
Searching...
No Matches
billboard_sorter.h File Reference

Back-to-front sorting for transparent billboard geometry. More...

#include "gl_common.h"
#include "scene_config.h"
#include "sphere_types.h"
#include <cglm/cglm.h>
Include dependency graph for billboard_sorter.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  BillboardSortEntry
 Lightweight proxy for sorting data without moving large structs. More...
 
struct  BillboardSorter
 Reusable memory context for sorting operations. More...
 

Functions

void billboard_sorter_init (BillboardSorter *sorter, int initial_capacity)
 Allocates internal buffers for the sorter.
 
void billboard_sorter_cleanup (BillboardSorter *sorter)
 Destroys the sorter context.
 
GLuint billboard_sorter_sort_gpu (BillboardSorter *sorter, const SphereInstance *instances, int count, const vec3 camera_pos)
 Sorts the array of instances Back-to-Front (descending depth) on GPU.
 
GLuint billboard_sorter_sort_cpu (BillboardSorter *sorter, const SphereInstance *instances, int count, const vec3 camera_pos)
 Sorts the array of instances Back-to-Front (descending depth) on CPU.
 
GLuint billboard_sorter_sort_cpu_radix (BillboardSorter *sorter, const SphereInstance *instances, int count, const vec3 camera_pos)
 Sorts the array of instances Back-to-Front (descending depth) using Radix Sort.
 
GLuint billboard_sorter_sort (BillboardSorter *sorter, const SphereInstance *instances, int count, const vec3 camera_pos, SortingMode mode)
 Dispatches the sorting task using the specified SortingMode.
 

Detailed Description

Back-to-front sorting for transparent billboard geometry.

Function Documentation

◆ billboard_sorter_cleanup()

void billboard_sorter_cleanup ( BillboardSorter *  sorter)

Destroys the sorter context.

Parameters
sorterPointer to the struct.

◆ billboard_sorter_init()

void billboard_sorter_init ( BillboardSorter *  sorter,
int  initial_capacity 
)

Allocates internal buffers for the sorter.

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

◆ billboard_sorter_sort()

GLuint billboard_sorter_sort ( BillboardSorter *  sorter,
const SphereInstance *  instances,
int  count,
const vec3  camera_pos,
SortingMode  mode 
)

Dispatches the sorting task using the specified SortingMode.

Parameters
sorterMemory context.
instancesArray of instances.
countActive element count.
camera_posWorld-space viewer position.
modeSorting algorithm choice.
Returns
The SSBO handle containing the sorted instances.
Here is the call graph for this function:

◆ billboard_sorter_sort_cpu()

GLuint billboard_sorter_sort_cpu ( BillboardSorter *  sorter,
const SphereInstance *  instances,
int  count,
const vec3  camera_pos 
)

Sorts the array of instances Back-to-Front (descending depth) on CPU.

Parameters
sorterMemory context.
instancesArray of instances (will be copied and sorted internally).
countActive element count.
camera_posWorld-space viewer position.
Returns
The SSBO handle containing the sorted instances.
Here is the call graph for this function:

◆ billboard_sorter_sort_cpu_radix()

GLuint billboard_sorter_sort_cpu_radix ( BillboardSorter *  sorter,
const SphereInstance *  instances,
int  count,
const vec3  camera_pos 
)

Sorts the array of instances Back-to-Front (descending depth) using Radix Sort.

Parameters
sorterMemory context.
instancesArray of instances.
countActive element count.
camera_posWorld-space viewer position (for depth).
Returns
The SSBO handle containing the sorted instances.
Here is the call graph for this function:

◆ billboard_sorter_sort_gpu()

GLuint billboard_sorter_sort_gpu ( BillboardSorter *  sorter,
const SphereInstance *  instances,
int  count,
const vec3  camera_pos 
)

Sorts the array of instances Back-to-Front (descending depth) on GPU.

Parameters
sorterMemory context.
instancesPointer to the array of instances to upload.
countActive element count.
camera_posWorld-space viewer position.
Returns
The SSBO handle containing the sorted instances.
Here is the call graph for this function: