MayaFlux 0.5.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 250 of file PathOperator.cpp.

251{
252 std::vector<uint32_t> ids(get_vertex_count(), 0U);
253
254 if (m_paths.size() <= 1) {
255 return ids;
256 }
257
258 size_t offset = 0;
259 uint32_t cluster = 0;
260 for (const auto& path : m_paths) {
261 const size_t count = path->get_vertex_count();
262 for (size_t i = 0; i < count && offset + i < ids.size(); ++i) {
263 ids[offset + i] = cluster;
264 }
265 offset += count;
266 ++cluster;
267 }
268
269 return ids;
270}
size_t count
float offset
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(), m_paths, and offset.

+ Here is the call graph for this function: