$darkmode
Mesh-based instanced rendering for spheres. More...
Go to the source code of this file.
Data Structures | |
| struct | SphereInstance |
| Per-instance data sent to the shader via an instanced VBO. More... | |
| struct | InstancedGroup |
| Manages mesh-based instanced spheres on the GPU. More... | |
Functions | |
| void | instanced_group_init (InstancedGroup *group, const SphereInstance *data, int count) |
| Allocates the instance VBO on the GPU. More... | |
| void | instanced_group_bind_mesh (InstancedGroup *group, GLuint vbo, GLuint nbo, GLuint ebo) |
| Binds a procedural mesh (e.g., icosphere) to the instanced group. More... | |
| void | instanced_group_draw (InstancedGroup *group, size_t index_count) |
| Executes an indexed instanced draw call. More... | |
| void | instanced_group_cleanup (InstancedGroup *group) |
| Releases all GPU resources for the instanced group. More... | |
Mesh-based instanced rendering for spheres.
This module handles high-performance drawing of multiple mesh-based spheres using glDrawElementsInstanced. It uses a SIMD-aligned structure for instance data.
| void instanced_group_bind_mesh | ( | InstancedGroup * | group, |
| GLuint | vbo, | ||
| GLuint | nbo, | ||
| GLuint | ebo | ||
| ) |
Binds a procedural mesh (e.g., icosphere) to the instanced group.
| group | Pointer to the group. |
| vbo | Mesh vertex VBO. |
| nbo | Mesh normal VBO. |
| ebo | Mesh index EBO. |
| void instanced_group_cleanup | ( | InstancedGroup * | group | ) |
Releases all GPU resources for the instanced group.
| group | Pointer to the group. |
| void instanced_group_draw | ( | InstancedGroup * | group, |
| size_t | index_count | ||
| ) |
Executes an indexed instanced draw call.
| group | Pointer to the group. |
| index_count | Number of indices in the base mesh. |
| void instanced_group_init | ( | InstancedGroup * | group, |
| const SphereInstance * | data, | ||
| int | count | ||
| ) |
Allocates the instance VBO on the GPU.
| group | Pointer to the group. |
| data | Initial data (optional). |
| count | Number of instances. |