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

◆ snap_ortho()

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 76 of file NavigationState.cpp.

77{
78 const float dist = glm::length(st.eye);
79
80 switch (view) {
81 case 0: // front: camera on +Z looking toward -Z
82 st.eye = glm::vec3(0.0F, 0.0F, dist);
83 st.yaw = 0.0F;
84 st.pitch = 0.0F;
85 break;
86 case 1: // right: camera on +X looking toward -X
87 st.eye = glm::vec3(dist, 0.0F, 0.0F);
88 st.yaw = glm::radians(-90.0F);
89 st.pitch = 0.0F;
90 break;
91 case 2: // top: camera on +Y looking straight down
92 st.eye = glm::vec3(0.0F, dist, 0.0F);
93 st.yaw = 0.0F;
94 st.pitch = glm::radians(-89.0F);
95 break;
96 case 3: // flip: mirror through origin
97 st.eye = -st.eye;
98 st.yaw = st.yaw + glm::pi<float>();
99 st.pitch = -st.pitch;
100 break;
101 default:
102 break;
103 }
104}

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

Referenced by MayaFlux::bind_viewport_preset().

+ Here is the caller graph for this function: