MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
TopologyOperator.hpp
Go to the documentation of this file.
1#pragma once
4
6
7class MAYAFLUX_API TopologyOperator : public GraphicsOperator {
8public:
9 explicit TopologyOperator(
10 Kinesis::ProximityMode mode = Kinesis::ProximityMode::K_NEAREST);
11
12 /**
13 * @brief Initialize a single topology with single set of vertices
14 */
15 void initialize(const std::vector<LineVertex>& vertices);
16
17 /**
18 * @brief Initialize multiple topologies with given positions and properties.
19 * @param topologies Vector of position vectors, one per topology.
20 * @param mode Proximity mode for all topologies.
21 */
22 void initialize_topologies(
23 const std::vector<std::vector<LineVertex>>& topologies,
25
26 /**
27 * @brief Add a single topology with full per-vertex control.
28 * @param vertices Vector of LineVertex defining the topology's points and attributes.
29 * @param mode Proximity mode for this topology.
30 */
31 void add_topology(
32 const std::vector<LineVertex>& vertices,
34
35 void process(float dt) override;
36
37 [[nodiscard]] std::span<const uint8_t> get_vertex_data() const override;
38 [[nodiscard]] std::span<const uint8_t> get_vertex_data_for_collection(uint32_t idx) const override;
39 [[nodiscard]] Kakshya::VertexLayout get_vertex_layout() const override;
40 [[nodiscard]] size_t get_vertex_count() const override;
41 [[nodiscard]] bool is_vertex_data_dirty() const override;
42 void mark_vertex_data_clean() override;
43
44 /**
45 * @brief Extract current vertex data as LineVertex array
46 * @return Vector of LineVertex with current positions, colors, thicknesses
47 */
48 [[nodiscard]] std::vector<LineVertex> extract_vertices() const;
49
50 void set_parameter(std::string_view param, double value) override;
51 [[nodiscard]] std::optional<double> query_state(std::string_view query) const override;
52 [[nodiscard]] std::string_view get_type_name() const override { return "Topology"; }
53 [[nodiscard]] size_t get_point_count() const override;
54
55 /**
56 * @brief Set the connection radius for topology generation.
57 * @param radius Connection radius.
58 */
59 void set_connection_radius(float radius);
60
61 /**
62 * @brief Set the number of neighbors (k) for K-Nearest topology mode.
63 * @param k Number of neighbors.
64 */
65 void set_global_line_thickness(float thickness);
66
67 /**
68 * @brief Set the line color for all topologies.
69 * @param color RGB color.
70 */
71 void set_global_line_color(const glm::vec3& color);
72
73 /**
74 * @brief Get number of topologies currently stored
75 * @return Topology count
76 */
77 [[nodiscard]] size_t get_topology_count() const { return m_topologies.size(); }
78
79 const char* get_vertex_type_name() const override { return "PathVertex"; }
80
81protected:
82 void* get_data_at(size_t global_index) override;
83
84private:
85 std::vector<std::shared_ptr<GpuSync::TopologyGeneratorNode>> m_topologies;
86
87 mutable std::vector<uint8_t> m_vertex_data_aggregate;
88
90 float m_default_thickness { 2.0F };
91};
92
93} // namespace MayaFlux::Nodes::Network
Operator that produces GPU-renderable geometry.
size_t get_topology_count() const
Get number of topologies currently stored.
std::string_view get_type_name() const override
Type name for introspection.
const char * get_vertex_type_name() const override
Get human-readable vertex type name (for validation/debugging)
std::vector< std::shared_ptr< GpuSync::TopologyGeneratorNode > > m_topologies
void initialize()
Definition main.cpp:11
Complete description of vertex data layout in a buffer.