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

◆ ndc_size_to_pixels() [2/2]

glm::uvec2 MayaFlux::Kinesis::ndc_size_to_pixels ( const glm::vec2 &  ndc_size,
uint32_t  width,
uint32_t  height 
)
inline

Convert an NDC-space size (extent) to integer pixel dimensions.

NDC spans 2.0 across each axis. An NDC size of (1.8, 0.1) on a 1280x720 window resolves to (1152, 36) pixels. Both components are clamped to at least 1 pixel so degenerate textures and zero-extent images are avoided.

Size counterpart to to_window(), which converts an NDC position. Use to_window for positions, ndc_size_to_pixels for extents (text image budgets, capture target dimensions, offscreen image sizes matched to an on-screen NDC region).

Parameters
ndc_sizeNDC extent (each component in [0, 2]).
widthWindow width in pixels.
heightWindow height in pixels.
Returns
Integer pixel dimensions, each at least 1.

Definition at line 201 of file ViewTransform.hpp.

204{
205 const auto px = static_cast<uint32_t>(ndc_size.x * 0.5F * static_cast<float>(width));
206 const auto py = static_cast<uint32_t>(ndc_size.y * 0.5F * static_cast<float>(height));
207 return { std::max(px, 1U), std::max(py, 1U) };
208}
uint32_t width
Definition Decoder.cpp:59

References width.