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

◆ build_cluster_ids()

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

Per-particle collection index, global index order.

Returns
get_point_count() elements, entry i equal to the index of the CollectionGroup particle i belongs to in get_collections() order. All zero when there is at most one collection.

The single source of truth for "which complete vertex-array pack does this particle belong to", consumed by any GPU-side stage that needs to respect collection boundaries in a neighbour query (the spatial hash's ClaimProcessor/HashDensityColorProcessor, and optionally GpuFieldOperator's own cluster-scoped bindings): each such consumer uploads this once, at wiring time, into whatever state field it declares for the purpose, rather than every consumer reaching into get_collections() and re-deriving the same prefix sum independently.

Overrides GraphicsOperator::build_cluster_ids(), whose default (every entry 0) is exactly what this returns when there is at most one collection; the override only differs once a second one exists.

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

Definition at line 859 of file PhysicsOperator.cpp.

860{
861 std::vector<uint32_t> ids(get_vertex_count(), 0U);
862
863 if (m_collections.size() <= 1) {
864 return ids;
865 }
866
867 size_t offset = 0;
868 uint32_t cluster = 0;
869 for (const auto& group : m_collections) {
870 const size_t count = group.collection->get_vertex_count();
871 for (size_t i = 0; i < count && offset + i < ids.size(); ++i) {
872 ids[offset + i] = cluster;
873 }
874 offset += count;
875 ++cluster;
876 }
877
878 return ids;
879}
uint64_t offset
Definition Composite.cpp:10
std::vector< uint64_t > ids
size_t count
size_t get_vertex_count() const override
Get number of vertices (may differ from point count for topology/path)
std::vector< CollectionGroup > m_collections

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

+ Here is the call graph for this function: