MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
GeometryLeafNode.hpp
Go to the documentation of this file.
1#pragma once
2
4#include "VertexSpec.hpp"
5
7
8/**
9 * @class GeometryLeafNode
10 * @brief One independent, arbitrary-topology geometry item.
11 *
12 * Concrete GeometryWriterNode leaf holding a flat Vertex array, with no
13 * interpolation, connectivity, or simulation of its own: callers supply
14 * finished geometry (Kinesis generators, input, procedural code) and this
15 * just holds and uploads it. Topology comes from the inherited
16 * set_primitive_topology()/get_primitive_topology() (default POINT_LIST);
17 * the reported vertex layout tracks whichever topology is current, since
18 * Vertex/PointVertex/LineVertex/MeshVertex share one 60-byte offset table
19 * and differ only in the scalar field's name.
20 *
21 * Intended to be held in bulk by AssemblyOperator, alongside other
22 * GeometryWriterNode subclasses, with no shared layout or relation assumed
23 * between items.
24 */
25class MAYAFLUX_API GeometryLeafNode : public GeometryWriterNode {
26public:
27 explicit GeometryLeafNode(size_t initial_capacity = 64);
28 explicit GeometryLeafNode(std::vector<Vertex> vertices);
29 explicit GeometryLeafNode(std::vector<glm::vec3> positions);
30
31 /// @brief Replace geometry with plain positions (color/scalar/normal/uv default).
32 void set_positions(std::vector<glm::vec3> positions);
33
34 /// @brief Replace geometry with fully specified vertices.
35 void set_geometry(std::vector<Vertex> vertices);
36
37 void update_vertex(size_t index, const Vertex& vertex);
38
39 [[nodiscard]] const std::vector<Vertex>& get_geometry() const { return m_items; }
40
41 /**
42 * @brief Mutable access for in-place edits. Does not itself mark the
43 * node dirty -- call set_geometry() (even with the same vector)
44 * or update_vertex() afterward so compute_frame() re-uploads.
45 */
46 [[nodiscard]] std::vector<Vertex>& get_geometry() { return m_items; }
47
48 void clear_geometry();
49
50 [[nodiscard]] size_t size() const { return m_items.size(); }
51
52 /**
53 * @brief No-op unless a mutator has run since the last call, so
54 * AssemblyOperator::process() calling this on every item every
55 * frame stays cheap regardless of how many items exist.
56 */
57 void compute_frame() override;
58
59private:
60 std::vector<Vertex> m_items;
61 bool m_geometry_dirty { true };
62};
63
64} // namespace MayaFlux::Nodes::GpuSync
uint32_t index
Definition VKDevice.cpp:142
const std::vector< Vertex > & get_geometry() const
std::vector< Vertex > & get_geometry()
Mutable access for in-place edits.
One independent, arbitrary-topology geometry item.
Base class for nodes that generate 3D geometry data.
Type-neutral vertex carrying the universal 60-byte attribute layout.