MayaFlux 0.5.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 786 of file PhysicsOperator.cpp.

787{
788 std::vector<uint32_t> ids(get_vertex_count(), 0U);
789
790 if (m_collections.size() <= 1) {
791 return ids;
792 }
793
794 size_t offset = 0;
795 uint32_t cluster = 0;
796 for (const auto& group : m_collections) {
797 const size_t count = group.collection->get_vertex_count();
798 for (size_t i = 0; i < count && offset + i < ids.size(); ++i) {
799 ids[offset + i] = cluster;
800 }
801 offset += count;
802 ++cluster;
803 }
804
805 return ids;
806}
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< CollectionGroup > m_collections

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

+ Here is the call graph for this function: