MayaFlux 0.4.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 18 of file PanZoom2DState.cpp.

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

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: