11 : m_default_mode(mode)
14 "TopologyOperator created with mode {}",
static_cast<int>(mode));
23 if (vertices.empty()) {
25 "Cannot initialize topology with zero vertices");
33 "TopologyOperator initialized with {} points in 1 topology",
42 const std::vector<std::vector<LineVertex>>& topologies,
45 for (
const auto& topo : topologies) {
50 "TopologyOperator initialized with {} topologies",
55 const std::vector<LineVertex>& vertices,
58 if (vertices.empty()) {
60 "Cannot add topology with zero vertices");
64 auto topology = std::make_shared<GpuSync::TopologyGeneratorNode>(mode, 1024);
66 topology->set_points(vertices);
67 topology->compute_frame();
72 "Added topology #{} with {} points, {} connections",
88 topology->compute_frame();
98 std::vector<LineVertex> positions;
101 auto points = topology->get_points();
102 for (
const auto& pt : points) {
103 positions.push_back(pt);
122 auto span = group->get_vertex_data();
125 span.begin(), span.end());
148 total += topology->get_vertex_count();
155 return std::ranges::any_of(
157 [](
const auto& group) {
return group->needs_gpu_update(); });
163 topology->mark_vertex_data_dirty(
false);
171 total += topology->get_point_count();
182 if (param ==
"connection_radius") {
184 topology->set_connection_radius(
static_cast<float>(value));
186 }
else if (param ==
"k_neighbors") {
188 topology->set_k_neighbors(
static_cast<size_t>(value));
190 }
else if (param ==
"line_thickness") {
200 if (query ==
"point_count") {
204 if (query ==
"connection_count") {
205 size_t total_connections = 0;
207 total_connections += topology->get_connection_count();
209 return static_cast<double>(total_connections);
212 if (query ==
"topology_count") {
225 topology->set_connection_radius(radius);
233 topology->set_line_thickness(thickness);
240 topology->set_line_color(color);
249 size_t local_index = global_index - offset;
250 return &group->get_points()[local_index];
252 offset += group->get_point_count();
#define MF_WARN(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
void * get_data_at(size_t global_index) override
Get mutable access to point at global index.
void add_topology(const std::vector< LineVertex > &vertices, Kinesis::ProximityMode mode)
Add a single topology with full per-vertex control.
std::span< const uint8_t > get_vertex_data_for_collection(uint32_t idx) const override
Get vertex data for specific collection (if multiple)
void initialize(const std::vector< LineVertex > &vertices)
Initialize a single topology with single set of vertices.
void process(float dt) override
Process for one batch cycle.
bool is_vertex_data_dirty() const override
Check if geometry changed this frame.
void set_parameter(std::string_view param, double value) override
Set operator parameter.
float m_default_thickness
void set_connection_radius(float radius)
Set the connection radius for topology generation.
size_t get_vertex_count() const override
Get number of vertices (may differ from point count for topology/path)
std::vector< LineVertex > extract_vertices() const
Extract current vertex data as LineVertex array.
std::vector< uint8_t > m_vertex_data_aggregate
void set_global_line_color(const glm::vec3 &color)
Set the line color for all topologies.
Kakshya::VertexLayout get_vertex_layout() const override
Get vertex layout describing vertex structure.
std::vector< std::shared_ptr< GpuSync::TopologyGeneratorNode > > m_topologies
std::span< const uint8_t > get_vertex_data() const override
Get vertex data for GPU upload.
void set_global_line_thickness(float thickness)
Set the number of neighbors (k) for K-Nearest topology mode.
Kinesis::ProximityMode m_default_mode
void mark_vertex_data_clean() override
Clear dirty flag after GPU upload.
size_t get_point_count() const override
Get source point count (before topology expansion)
void initialize_topologies(const std::vector< std::vector< LineVertex > > &topologies, Kinesis::ProximityMode mode)
Initialize multiple topologies with given positions and properties.
std::optional< double > query_state(std::string_view query) const override
Query operator internal state.
TopologyOperator(Kinesis::ProximityMode mode=Kinesis::ProximityMode::K_NEAREST)
@ NodeProcessing
Node graph processing (Nodes::NodeGraphManager)
@ Nodes
DSP Generator and Filter Nodes, graph pipeline, node management.
Complete description of vertex data layout in a buffer.