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

◆ compute_pan_zoom_view_transform()

MAYAFLUX_API ViewTransform MayaFlux::Kinesis::compute_pan_zoom_view_transform ( const PanZoom2DState &  state,
float  aspect 
)

Build a ViewTransform from the current PanZoom2DState.

View matrix is identity. Projection is a symmetric ortho frustum centred on state.pan with half-height state.zoom.

Parameters
statePanZoom2D state (read-only).
aspectFramebuffer width / height.
Returns
ViewTransform ready for push constant upload.

Definition at line 20 of file PanZoom2DState.cpp.

21{
22 const float hw = st.zoom * aspect;
23 const float hh = st.zoom;
24 return {
25 .view = glm::mat4(1.0F),
26 .projection = glm::ortho(
27 st.pan.x - hw, st.pan.x + hw,
28 st.pan.y - hh, st.pan.y + hh,
29 st.near_plane, st.far_plane)
30 };
31}

References MayaFlux::Kinesis::PanZoom2DState::far_plane, MayaFlux::Kinesis::PanZoom2DState::near_plane, MayaFlux::Kinesis::PanZoom2DState::pan, and MayaFlux::Kinesis::PanZoom2DState::zoom.

Referenced by MayaFlux::bind_pan_zoom_preset().

+ Here is the caller graph for this function: