|
SleakEngine 1.0.0
C++23 multi-backend game engine
|
#include <MeshBatch.hpp>
Static Public Member Functions | |
| static void | BeginBatch (Material *material) |
| Binds the batch material and (re)uploads the shared identity-world transform buffer once per batch. | |
| static MeshHandle | CreateMesh (VertexFormatHandle format, const void *vertexData, size_t vertexBytes, const uint32_t *indices, size_t indexCount) |
| static MeshHandle | CreateMesh (VertexGroup &vertices, IndexGroup &indices) |
| Create GPU vertex+index buffers from CPU mesh data. | |
| static void | Draw (const MeshHandle &mesh, bool castsShadow=true) |
| Submits an indexed draw for a mesh already created via CreateMesh. | |
| static void | EndBatch () |
| End the batch (currently a no-op, reserved for future use). | |
| static void | Shutdown () |
| Release static resources before renderer cleanup. | |
GPU mesh handle pool for bulk static geometry. Draw through BeginBatch/Draw/EndBatch.
Use this when you have far more geometry than you want GameObjects for: terrain chunks, voxel columns, instanced scatter, anything where per-object component overhead would dominate. CreateMesh() uploads vertex and index data and hands back a MeshHandle you store yourself; MeshBatch does not track it for you.
The two CreateMesh() overloads cover the two vertex paths. The VertexGroup overload uses the engine's built-in vertex layout. The raw-bytes overload takes a VertexFormatHandle from VertexFormatRegistry::Register, and the backend binds the pipeline that matches that handle.
Drawing is a three-step batch: BeginBatch() binds the material and an identity transform once, each Draw() issues one indexed draw call, and EndBatch() closes the batch. Passing castsShadow = false keeps distant geometry out of the shadow pass.
Every entry point touches renderer state, so call them from the thread that drives the frame, and call Shutdown() before the renderer is torn down.
Definition at line 96 of file MeshBatch.hpp.
|
static |
Binds the batch material and (re)uploads the shared identity-world transform buffer once per batch.
Begin a batch: binds the material and an identity-transform constant buffer once. All subsequent Draw() calls share them.
Definition at line 68 of file MeshBatch.cpp.
|
static |
Create GPU buffers from raw vertex bytes laid out per a registered custom vertex format. The handle keys the pipeline the backend binds.
Uploads raw custom-format vertices/indices as GPU buffers, tagging the vertex buffer with the format handle. format == 0 creates a mesh using the engine's default vertex layout.
Definition at line 42 of file MeshBatch.cpp.
|
static |
Create GPU vertex+index buffers from CPU mesh data.
Uploads a vertex/index group as GPU buffers and returns a handle to them.
Definition at line 22 of file MeshBatch.cpp.
|
static |
Submits an indexed draw for a mesh already created via CreateMesh.
Submit one indexed draw call (vertex + index buffer bind + DrawIndexed). castsShadow=false makes the draw skip the shadow pass (distant geometry).
Definition at line 94 of file MeshBatch.cpp.
|
static |
End the batch (currently a no-op, reserved for future use).
Definition at line 101 of file MeshBatch.cpp.
|
static |
Release static resources before renderer cleanup.
Definition at line 105 of file MeshBatch.cpp.