MayaFlux 1.0.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 242 of file TopologyOperator.cpp.

243{
244 std::vector<uint32_t> ids(get_vertex_count(), 0U);
245
246 if (m_topologies.size() <= 1) {
247 return ids;
248 }
249
250 size_t offset = 0;
251 uint32_t cluster = 0;
252 for (const auto& topology : m_topologies) {
253 const size_t count = topology->get_vertex_count();
254 for (size_t i = 0; i < count && offset + i < ids.size(); ++i) {
255 ids[offset + i] = cluster;
256 }
257 offset += count;
258 ++cluster;
259 }
260
261 return ids;
262}
uint64_t offset
Definition Composite.cpp:10
std::vector< uint64_t > ids
PrimitiveTopology topology
size_t count
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(), ids, m_topologies, offset, and topology.

+ Here is the call graph for this function: