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

◆ snap_ortho()

MAYAFLUX_API void MayaFlux::Kinesis::snap_ortho ( NavigationState state,
int  view 
)

Snap to a named ortho view.

Preserves the current distance from the origin. Yaw/pitch are set to exact axis-aligned values. The top view uses pitch = -89 degrees to avoid the degenerate lookAt case at exactly -90 degrees.

Parameters
stateNavigation state (eye, yaw, pitch mutated)
view0 = front (+Z), 1 = right (+X), 2 = top (+Y), 3 = flip opposite

Definition at line 48 of file NavigationState.cpp.

49{
50 const float dist = glm::length(st.eye);
51
52 switch (view) {
53 case 0: // front: camera on +Z looking toward -Z
54 st.eye = glm::vec3(0.0F, 0.0F, dist);
55 st.yaw = 0.0F;
56 st.pitch = 0.0F;
57 break;
58 case 1: // right: camera on +X looking toward -X
59 st.eye = glm::vec3(dist, 0.0F, 0.0F);
60 st.yaw = glm::radians(-90.0F);
61 st.pitch = 0.0F;
62 break;
63 case 2: // top: camera on +Y looking straight down
64 st.eye = glm::vec3(0.0F, dist, 0.0F);
65 st.yaw = 0.0F;
66 st.pitch = glm::radians(-89.0F);
67 break;
68 case 3: // flip: mirror through origin
69 st.eye = -st.eye;
70 st.yaw = st.yaw + glm::pi<float>();
71 st.pitch = -st.pitch;
72 break;
73 default:
74 break;
75 }
76}

References MayaFlux::Kinesis::NavigationState::eye, MayaFlux::Kinesis::NavigationState::pitch, and MayaFlux::Kinesis::NavigationState::yaw.