9 #ifndef SPHERE_SORTING_H
10 #define SPHERE_SORTING_H
13 #include <cglm/cglm.h>
77 const vec3 camera_pos);
92 const vec3 camera_pos);
105 const vec3 camera_pos);
Mesh-based instanced rendering for spheres.
void sphere_sorter_cleanup(SphereSorter *sorter)
Destroys the sorter context.
Definition: sphere_sorting.c:163
GLuint sphere_sorter_sort_gpu(SphereSorter *sorter, const SphereInstance *instances, int count, const vec3 camera_pos)
Sorts the array of instances Back-to-Front (descending depth) on GPU.
Definition: sphere_sorting.c:180
GLuint sphere_sorter_sort_cpu(SphereSorter *sorter, const SphereInstance *instances, int count, const vec3 camera_pos)
Sorts the array of instances Back-to-Front (descending depth) on CPU.
Definition: sphere_sorting.c:327
void sphere_sorter_init(SphereSorter *sorter, int initial_capacity)
Allocates internal buffers for the sorter.
Definition: sphere_sorting.c:123
GLuint sphere_sorter_sort_cpu_radix(SphereSorter *sorter, const SphereInstance *instances, int count, const vec3 camera_pos)
Sorts the array of instances Back-to-Front (descending depth) using Radix Sort.
Definition: sphere_sorting.c:387
Per-instance data sent to the shader via an instanced VBO.
Definition: instanced_rendering.h:23
Lightweight proxy for sorting data without moving large structs.
Definition: sphere_sorting.h:19
float depth
Definition: sphere_sorting.h:21
int original_index
Definition: sphere_sorting.h:20
Reusable memory context for sorting operations.
Definition: sphere_sorting.h:28
GLuint compute_program
Definition: sphere_sorting.h:29
GLint loc_k
Definition: sphere_sorting.h:40
SphereSortEntry * entries
Definition: sphere_sorting.h:42
int ssbo_capacity
Definition: sphere_sorting.h:45
GLint loc_stage
Definition: sphere_sorting.h:35
GLuint instance_ssbo
Definition: sphere_sorting.h:30
SphereSortEntry * entries_aux
Definition: sphere_sorting.h:43
int cpu_capacity
Definition: sphere_sorting.h:46
int min_capacity
Definition: sphere_sorting.h:47
SphereInstance * temp_instances
Definition: sphere_sorting.h:44
GLint loc_count_pot
Definition: sphere_sorting.h:37
GLuint sorted_instance_ssbo
Definition: sphere_sorting.h:32
GLuint index_ssbo
Definition: sphere_sorting.h:31
GLint loc_cam
Definition: sphere_sorting.h:38
GLint loc_count
Definition: sphere_sorting.h:36
GLint loc_j
Definition: sphere_sorting.h:39