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

◆ topology_runs()

std::vector< DrawRun > MayaFlux::Nodes::Network::PhysicsOperator::topology_runs ( ) const
overridevirtual

Coalesces adjacent point collections sharing a concatenable topology into one run.

Strip and fan collections are always reported separately.

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

Definition at line 327 of file PhysicsOperator.cpp.

328{
329 std::vector<DrawRun> runs;
330 uint32_t offset = 0;
331
332 for (const auto& points : m_collections) {
333 const auto count = static_cast<uint32_t>(points.collection->get_vertex_count());
334 const auto topo = points.collection->get_primitive_topology();
335
336 if (!runs.empty() && runs.back().topology == topo && is_concatenable_topology(topo)) {
337 runs.back().vertex_count += count;
338 } else {
339 runs.push_back(DrawRun { .topology = topo, .vertex_offset = offset, .vertex_count = count });
340 }
341
342 offset += count;
343 }
344
345 return runs;
346}
std::vector< glm::vec2 > * points
size_t count
float offset
std::vector< CollectionGroup > m_collections
Portal::Graphics::DrawRun DrawRun
constexpr bool is_concatenable_topology(PrimitiveTopology topology) noexcept
Whether two adjacent spans of this topology can be concatenated without altering the primitives they ...

References count, m_collections, offset, points, and MayaFlux::Portal::Graphics::DrawRun::topology.