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

◆ window_coords() [4/4]

MAYAFLUX_API glm::vec2 MayaFlux::window_coords ( double  ndc_x,
double  ndc_y,
double  ndc_z,
uint32_t  window_width,
uint32_t  window_height 
)

Convert NDC coordinates to window pixel coordinates.

Parameters
ndc_xX coordinate in NDC space [-1, +1]
ndc_yY coordinate in NDC space [-1, +1] (center origin, +Y up)
ndc_zZ coordinate (ignored, accepted for convenience when passing vec3)
window_widthWindow width in pixels
window_heightWindow height in pixels
Returns
Window coordinates in pixels (top-left origin, +Y down)

Inverse of normalize_coords(). Z coordinate is ignored.

Definition at line 38 of file Windowing.cpp.

40{
41 (void)ndc_z;
42 float window_x = (static_cast<float>(ndc_x) + 1.0F) * 0.5F * static_cast<float>(window_width);
43 float window_y = (1.0F - static_cast<float>(ndc_y)) * 0.5F * static_cast<float>(window_height);
44 return { window_x, window_y };
45}

Referenced by window_coords(), window_coords(), and window_coords().

+ Here is the caller graph for this function: