MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ insert_flat()

void MayaFlux::Kakshya::MeshInsertion::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).

Replaces any existing content in both variants. layout must have stride_bytes > 0. vertex_bytes.size() must be a multiple of layout.stride_bytes. index_data.size() must be a multiple of 3.

Parameters
vertex_bytesRaw interleaved vertex data.
index_dataTriangle index list.
layoutVertex attribute layout; stride_bytes must be set.

Definition at line 59 of file MeshInsertion.cpp.

63{
64 if (layout.stride_bytes == 0) {
66 "MeshInsertion::insert_flat: layout stride_bytes is zero");
67 return;
68 }
69 if (vertex_bytes.size() % layout.stride_bytes != 0) {
71 "MeshInsertion::insert_flat: vertex_bytes {} not a multiple of stride {}",
72 vertex_bytes.size(), layout.stride_bytes);
73 return;
74 }
75 if (index_data.size() % 3 != 0) {
77 "MeshInsertion::insert_flat: index count {} is not a multiple of 3",
78 index_data.size());
79 return;
80 }
81
82 m_vertex_variant = std::vector<uint8_t>(vertex_bytes.begin(), vertex_bytes.end());
83 m_index_variant = std::vector<uint32_t>(index_data.begin(), index_data.end());
84
85 m_layout = layout;
86 m_vertex_count = static_cast<uint32_t>(vertex_bytes.size() / layout.stride_bytes);
87 m_index_count = static_cast<uint32_t>(index_data.size());
89 m_layout_set = true;
90 m_submeshes = std::nullopt;
91
93 "MeshInsertion::insert_flat: {} vertices, {} indices ({} faces)",
95}
#define MF_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
std::optional< RegionGroup > m_submeshes
uint32_t m_vertex_count
Running total across all submitted batches.
@ Runtime
General runtime operations (default fallback)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.
uint32_t vertex_count
Total number of vertices in this buffer.

References MayaFlux::Journal::Kakshya, m_index_count, m_index_variant, m_layout, m_layout_set, m_submeshes, m_vertex_count, m_vertex_variant, MF_DEBUG, MF_ERROR, MayaFlux::Journal::Runtime, MayaFlux::Kakshya::VertexLayout::stride_bytes, and MayaFlux::Kakshya::VertexLayout::vertex_count.

Referenced by MayaFlux::IO::ModelReader::extract_single_mesh().

+ Here is the caller graph for this function: