|
Unravel Engine C++ Reference
|
Batch key structure for grouping compatible draw calls. More...
#include <batch_key.h>
Public Member Functions | |
| batch_key ()=default | |
| Default constructor. | |
| batch_key (std::shared_ptr< mesh > mesh_ptr, std::shared_ptr< material > material_ptr, uint32_t lod_index, uint32_t submesh_index) | |
| Constructor with shared pointers. | |
| batch_key (const asset_handle< mesh > &mesh_handle, const asset_handle< material > &material_handle, uint32_t lod_index, uint32_t submesh_index) | |
| Constructor with asset handles (convenience) | |
| auto | operator<=> (const batch_key &other) const =default |
| Three-way comparison operator for sorting and equality. | |
| auto | operator== (const batch_key &other) const -> bool=default |
| Equality comparison operator. | |
| auto | hash () const noexcept -> size_t |
| Generate hash value for this batch key. | |
| auto | is_valid () const -> bool |
| Check if this batch key is valid. | |
| auto | to_string () const -> std::string |
| Convert batch key to string for debugging. | |
Public Attributes | |
| std::shared_ptr< mesh > | mesh_ptr |
| Shared pointer to the mesh geometry. | |
| std::shared_ptr< material > | material_ptr |
| Shared pointer to the material. | |
| uint32_t | lod_index = 0 |
| Level of detail index. | |
| uint32_t | submesh_index = 0 |
| Submesh index within the mesh. | |
Batch key structure for grouping compatible draw calls.
Objects with identical batch keys can be rendered together in a single instanced draw call, significantly reducing CPU overhead. Uses shared_ptr to support both asset handles and material/mesh instances.
Definition at line 21 of file batch_key.h.
|
default |
Default constructor.
| unravel::batch_key::batch_key | ( | std::shared_ptr< mesh > | mesh_ptr, |
| std::shared_ptr< material > | material_ptr, | ||
| uint32_t | lod_index, | ||
| uint32_t | submesh_index ) |
Constructor with shared pointers.
| mesh_ptr | Shared pointer to mesh geometry |
| material_ptr | Shared pointer to material |
| lod_index | Level of detail index (0 = highest detail) |
| submesh_index | Submesh index within the mesh (0-based) |
Definition at line 10 of file batch_key.cpp.
| unravel::batch_key::batch_key | ( | const asset_handle< mesh > & | mesh_handle, |
| const asset_handle< material > & | material_handle, | ||
| uint32_t | lod_index, | ||
| uint32_t | submesh_index ) |
Constructor with asset handles (convenience)
| mesh_handle | Asset handle to mesh geometry |
| material_handle | Asset handle to material |
| lod_index | Level of detail index (0 = highest detail) |
| submesh_index | Submesh index within the mesh (0-based) |
Definition at line 21 of file batch_key.cpp.
|
noexcept |
Generate hash value for this batch key.
Definition at line 32 of file batch_key.cpp.
| auto unravel::batch_key::is_valid | ( | ) | const -> bool |
Check if this batch key is valid.
Definition at line 44 of file batch_key.cpp.
|
default |
Three-way comparison operator for sorting and equality.
| other | Other batch key to compare with |
|
default |
Equality comparison operator.
| other | Other batch key to compare with |
| auto unravel::batch_key::to_string | ( | ) | const -> std::string |
Convert batch key to string for debugging.
Definition at line 49 of file batch_key.cpp.
| uint32_t unravel::batch_key::lod_index = 0 |
Level of detail index.
Definition at line 30 of file batch_key.h.
| std::shared_ptr<material> unravel::batch_key::material_ptr |
Shared pointer to the material.
Definition at line 27 of file batch_key.h.
| std::shared_ptr<mesh> unravel::batch_key::mesh_ptr |
Shared pointer to the mesh geometry.
Definition at line 24 of file batch_key.h.
| uint32_t unravel::batch_key::submesh_index = 0 |
Submesh index within the mesh.
Definition at line 33 of file batch_key.h.