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

◆ build_cluster_ids()

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

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

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

A single PathOperator holding several independent paths is the same "many complete vertex-array packs" shape PhysicsOperator's collections and TopologyOperator's topologies are. Overriding this is what lets a cluster-scoped GpuFieldOperator binding, or the spatial hash's own cluster guard, treat each path as its own population without a dynamic_cast anywhere in the buffer layer.

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

Definition at line 277 of file PathOperator.cpp.

278{
279 std::vector<uint32_t> ids(get_vertex_count(), 0U);
280
281 if (m_paths.size() <= 1) {
282 return ids;
283 }
284
285 size_t offset = 0;
286 uint32_t cluster = 0;
287 for (const auto& path : m_paths) {
288 const size_t count = path->get_vertex_count();
289 for (size_t i = 0; i < count && offset + i < ids.size(); ++i) {
290 ids[offset + i] = cluster;
291 }
292 offset += count;
293 ++cluster;
294 }
295
296 return ids;
297}
uint64_t offset
Definition Composite.cpp:10
std::vector< uint64_t > ids
size_t count
std::vector< std::shared_ptr< GpuSync::PathGeneratorNode > > m_paths
size_t get_vertex_count() const override
Get number of vertices (may differ from point count for topology/path)

References count, get_vertex_count(), ids, m_paths, and offset.

+ Here is the call graph for this function: