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

◆ triangle_vertex_count()

uint32_t MayaFlux::Portal::Graphics::triangle_vertex_count ( PrimitiveTopology topology,
uint32_t n,
PolygonMode fill = PolygonMode::FILL )
nodiscardconstexprnoexcept

Vertices a span of n at topology yields once reduced to a TRIANGLE_LIST, with points becoming quads and line segments ribbons.

Closed form, so a caller can size a destination or budget a dispatch without inspecting vertex data. Spans too short to assemble a primitive yield zero rather than underflowing, and list topologies floor to whole primitives, so an odd LINE_LIST count drops its dangling vertex instead of reading past the span.

Definition at line 443 of file GraphicsUtils.hpp.

447{
448 if (fill == PolygonMode::POINT) {
449 if (topology == PrimitiveTopology::LINE_LIST
450 || topology == PrimitiveTopology::LINE_STRIP) {
451 return 6U * n;
452 }
453 if (topology == PrimitiveTopology::TRIANGLE_LIST) {
454 return 6U * 3U * (n / 3U);
455 }
457 || topology == PrimitiveTopology::TRIANGLE_FAN) {
458 return n < 3U ? 0U : 6U * n;
459 }
460 }
461
462 switch (topology) {
464 return 6U * n;
466 return 6U * (n / 2U);
468 return n < 2U ? 0U : 6U * (n - 1U);
470 return 3U * (n / 3U);
473 return n < 3U ? 0U : 3U * (n - 2U);
474 }
475 return 0U;
476}

References FILL, LINE_LIST, LINE_STRIP, POINT, POINT_LIST, TRIANGLE_FAN, TRIANGLE_LIST, and TRIANGLE_STRIP.

Referenced by MayaFlux::Portal::Graphics::PrimitiveMill::milled_vertex_count().

Here is the caller graph for this function: