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

◆ set_vertex_data()

void MayaFlux::Buffers::MeshBuffer::set_vertex_data ( std::span< const uint8_t >  bytes)

Replace vertex bytes entirely and mark vertices dirty.

Intended for deformation: caller writes new interleaved bytes (same stride as the original layout) and the next graphics cycle re-uploads. Does not change index data or layout.

Parameters
bytesRaw interleaved vertex bytes. Size must be a multiple of m_mesh_data.layout.stride_bytes.

Definition at line 183 of file MeshBuffer.cpp.

184{
186 && bytes.size() % m_mesh_data.layout.stride_bytes != 0) {
188 "MeshBuffer::set_vertex_data: byte count {} not a multiple of stride {}",
189 bytes.size(), m_mesh_data.layout.stride_bytes);
190 return;
191 }
192
193 m_mesh_data.vertex_variant = std::vector<uint8_t>(bytes.begin(), bytes.end());
195 ? static_cast<uint32_t>(bytes.size() / m_mesh_data.layout.stride_bytes)
196 : 0;
197
198 m_vertices_dirty.store(true, std::memory_order_release);
199}
#define MF_ERROR(comp, ctx,...)
std::atomic< bool > m_vertices_dirty
Kakshya::MeshData m_mesh_data
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
DataVariant vertex_variant
vector<uint8_t>: interleaved vertex bytes
Definition MeshData.hpp:34
uint32_t stride_bytes
Total bytes per vertex (stride in Vulkan terms) e.g., 3 floats (position) + 3 floats (normal) = 24 by...
uint32_t vertex_count
Total number of vertices in this buffer.

References MF_ERROR.