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

◆ MeshBuffer() [2/2]

MayaFlux::Buffers::MeshBuffer::MeshBuffer ( std::shared_ptr< Nodes::GpuSync::MeshWriterNode node)

Construct from a MeshWriterNode.

The node is polled each graphics cycle. compute_frame() is called on the node, and if its data changed, set_mesh_data() is called internally before MeshProcessor uploads.

Definition at line 51 of file MeshBuffer.cpp.

52 : VKBuffer(
53 node ? node->get_mesh_vertex_count() * sizeof(Kakshya::MeshVertex) : 0,
56 , m_node(std::move(node))
57{
58 if (m_node) {
59 auto data = Kakshya::MeshData::empty();
60 const auto verts = m_node->get_mesh_vertices();
61 const auto indices = m_node->get_mesh_indices();
62
63 Kakshya::MeshInsertion ins(data.vertex_variant, data.index_variant);
64 ins.insert_flat(
65 std::span<const uint8_t>(
66 reinterpret_cast<const uint8_t*>(verts.data()),
67 verts.size() * sizeof(Kakshya::MeshVertex)),
68 std::span<const uint32_t>(indices),
69 Kakshya::VertexLayout::for_meshes(sizeof(Kakshya::MeshVertex)));
70 data.layout = Kakshya::VertexLayout::for_meshes(sizeof(Kakshya::MeshVertex));
71 data.layout.vertex_count = static_cast<uint32_t>(verts.size());
72 m_mesh_data = std::move(data);
73 }
74
75 RenderConfig defaults;
76 defaults.vertex_shader = "triangle.vert.spv";
80}
std::shared_ptr< Nodes::GpuSync::MeshWriterNode > m_node
Kakshya::MeshData m_mesh_data
Portal::Graphics::RenderConfig RenderConfig
Definition VKBuffer.hpp:69
void set_needs_depth_attachment(bool needs)
Mark this buffer as requiring depth testing when rendered.
Definition VKBuffer.hpp:565
void set_default_render_config(const RenderConfig &config)
Called by derived classes to set their context-specific defaults.
Definition VKBuffer.hpp:595
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.
DataModality
Data modality types for cross-modal analysis.
Definition NDData.hpp:81
static MeshData empty()
Construct an empty MeshData with the canonical 60-byte mesh layout.
Definition MeshData.hpp:49
static VertexLayout for_meshes(uint32_t stride=60)
Factory: layout for MeshVertex (position, color, weight, uv, normal, tangent)

References MayaFlux::Kakshya::MeshData::empty(), MayaFlux::Kakshya::VertexLayout::for_meshes(), MayaFlux::Kakshya::MeshInsertion::insert_flat(), m_mesh_data, m_node, MayaFlux::Buffers::VKBuffer::set_default_render_config(), MayaFlux::Buffers::VKBuffer::set_needs_depth_attachment(), MayaFlux::Portal::Graphics::RenderConfig::topology, MayaFlux::Portal::Graphics::TRIANGLE_LIST, and MayaFlux::Portal::Graphics::RenderConfig::vertex_shader.

+ Here is the call graph for this function: