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

◆ build_cluster_ids()

std::vector< uint32_t > MayaFlux::Nodes::Network::TopologyOperator::build_cluster_ids ( ) const
overridevirtual

Overrides GraphicsOperator::build_cluster_ids() for real multi-topology scenes.

Returns
get_vertex_count() elements: entry i is the index of the topology (in initialize_topologies()/add_topology() order) vertex i belongs to, in the same concatenation order get_vertex_data() itself produces. All zero when there is at most one topology, matching the base class default exactly.

A single TopologyOperator holding several independent topologies (initialize_topologies/add_topology, each its own connected MST/KNN graph) is the same "many complete vertex-array packs" shape PhysicsOperator's collections are. Overriding this is what lets a cluster-scoped GpuFieldOperator binding, or the spatial hash's own cluster guard, treat each topology as its own population without a dynamic_cast anywhere in the buffer layer.

Reimplemented from MayaFlux::Nodes::Network::GraphicsOperator.

Definition at line 215 of file TopologyOperator.cpp.

216{
217 std::vector<uint32_t> ids(get_vertex_count(), 0U);
218
219 if (m_topologies.size() <= 1) {
220 return ids;
221 }
222
223 size_t offset = 0;
224 uint32_t cluster = 0;
225 for (const auto& topology : m_topologies) {
226 const size_t count = topology->get_vertex_count();
227 for (size_t i = 0; i < count && offset + i < ids.size(); ++i) {
228 ids[offset + i] = cluster;
229 }
230 offset += count;
231 ++cluster;
232 }
233
234 return ids;
235}
size_t count
float offset
size_t get_vertex_count() const override
Get number of vertices (may differ from point count for topology/path)
std::vector< std::shared_ptr< GpuSync::TopologyGeneratorNode > > m_topologies

References count, get_vertex_count(), m_topologies, and offset.

+ Here is the call graph for this function: