|
MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
|
Write counterpart to MeshAccess. More...
#include <MeshInsertion.hpp>
Collaboration diagram for MayaFlux::Kakshya::MeshInsertion:Public Member Functions | |
| std::optional< MeshAccess > | build () const |
| Produce a MeshAccess over the current variant contents. | |
| void | clear () |
| Clear both variants and reset all internal state. | |
| void | insert_flat (std::span< const uint8_t > vertex_bytes, std::span< const uint32_t > index_data, const VertexLayout &layout) |
| Insert a single flat mesh (no submesh tracking). | |
| void | insert_submesh (std::span< const uint8_t > vertex_bytes, std::span< const uint32_t > index_data, std::string_view name={}, std::string_view material_name={}, const VertexLayout &layout=VertexLayout::for_meshes(60)) |
| Append one submesh batch, accumulating into the shared buffers. | |
| MeshInsertion (DataVariant &vertex_variant, DataVariant &index_variant) | |
| Construct with mutable references to the two storage variants. | |
Private Member Functions | |
| void | ensure_index_storage () |
| void | ensure_vertex_storage () |
| bool | validate_layout (const VertexLayout &incoming) const |
Private Attributes | |
| uint32_t | m_index_count = 0 |
| DataVariant & | m_index_variant |
| VertexLayout | m_layout |
| bool | m_layout_set = false |
| std::optional< RegionGroup > | m_submeshes |
| uint32_t | m_vertex_count = 0 |
| Running total across all submitted batches. | |
| DataVariant & | m_vertex_variant |
Write counterpart to MeshAccess.
Parallel to EigenInsertion and DataInsertion: holds mutable references to two DataVariant targets and populates them with interleaved vertex bytes and flat uint32_t index data respectively. Callers supply typed spans; the class handles memcpy into the canonical storage and constructs the VertexLayout.
Submesh structure is recorded as a RegionGroup whose Regions map to the index sub-ranges of each submitted batch. Callers accumulate batches via insert_submesh() and then call build() to obtain a MeshAccess.
The vertex DataVariant always receives vector<uint8_t> (raw bytes). The index DataVariant always receives vector<uint32_t>. Neither variant is touched until insert_submesh() or insert_flat() is called.
Usage (single mesh, no submeshes):
Usage (multi-submesh, e.g. from assimp):
Definition at line 48 of file MeshInsertion.hpp.