14 layout.vertex_count = 0;
18 "Created MeshWriterNode with capacity for {} vertices", initial_vertex_capacity);
23 const auto* vb = std::get_if<std::vector<uint8_t>>(&data.
vertex_variant);
24 const auto* ib = std::get_if<std::vector<uint32_t>>(&data.
index_variant);
28 "MeshWriterNode::set_mesh: invalid MeshData");
34 std::span {
reinterpret_cast<const MeshVertex*
>(vb->data()), n },
35 std::span { ib->data(), ib->size() });
39 std::span<const MeshVertex> vertices,
40 std::span<const uint32_t> indices)
42 m_vertices.assign(vertices.begin(), vertices.end());
43 m_indices.assign(indices.begin(), indices.end());
50 m_vertices.assign(vertices.begin(), vertices.end());
57 m_indices.assign(indices.begin(), indices.end());
85 layout.vertex_count =
static_cast<uint32_t
>(
m_vertices.size());
89 "MeshWriterNode: uploaded {} vertices, {} indices ({} faces)",
#define MF_ERROR(comp, ctx,...)
#define MF_TRACE(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
bool m_vertex_data_dirty
Flag: vertex data or layout changed since last GPU upload.
void set_vertex_layout(const Kakshya::VertexLayout &layout)
Set cached vertex layout.
void set_indices(std::span< const uint32_t > indices)
Set index buffer for indexed drawing.
void resize_vertex_buffer(uint32_t vertex_count, bool preserve_data=false)
Resize vertex buffer to hold specified number of vertices.
void set_vertex_stride(size_t stride)
Set vertex stride (bytes per vertex)
bool m_needs_layout_update
Flag indicating if layout needs update.
Base class for nodes that generate 3D geometry data.
MeshWriterNode(size_t initial_vertex_capacity=1024)
void set_mesh(const Kakshya::MeshData &data)
Replace all vertex and index data from a MeshData owner.
std::vector< MeshVertex > m_vertices
void set_mesh_vertices(std::span< const MeshVertex > vertices)
Replace vertex array only; index array is unchanged.
Portal::Graphics::PrimitiveTopology get_primitive_topology() const override
Get primitive topology for rendering.
void set_mesh_indices(std::span< const uint32_t > indices)
Replace index array only; vertex array is unchanged.
std::vector< uint32_t > m_indices
void compute_frame() override
Compute GPU data for this frame.
@ NodeProcessing
Node graph processing (Nodes::NodeGraphManager)
@ Nodes
DSP Generator and Filter Nodes, graph pipeline, node management.
PrimitiveTopology
Vertex assembly primitive topology.
DataVariant vertex_variant
vector<uint8_t>: interleaved vertex bytes
DataVariant index_variant
vector<uint32_t>: triangle index list
Owning CPU-side representation of a loaded or generated mesh.
Vertex type for indexed triangle mesh primitives (TRIANGLE_LIST topology)
uint32_t stride_bytes
Total bytes per vertex (stride in Vulkan terms) e.g., 3 floats (position) + 3 floats (normal) = 24 by...
static VertexLayout for_meshes(uint32_t stride=60)
Factory: layout for MeshVertex (position, color, weight, uv, normal, tangent)