1 # include"TrackballCamera.h" 35 if (
m_phi > 2 * glm::pi<float>())
m_phi -= 2 * glm::pi<float>();
36 else if (
m_phi < -2 * glm::pi<float>())
m_phi += 2 * glm::pi<float>();
39 if ((
m_phi > 0 &&
m_phi < glm::pi<float>()) || (
m_phi < -glm::pi<float>() &&
m_phi > -2 * glm::pi<float>()))
m_up = 1.0f;
55 glm::vec3 worldUp = glm::vec3(0.0f,
m_up, 0.0f);
56 glm::vec3 right = glm::cross(look, worldUp);
57 glm::vec3 up = glm::cross(look, right);
59 m_target += (right * dx) + (up * dy);
glm::vec3 getCameraOrintation(void) const
glm::mat4 getViewMatrix(void)
Returns the view matrix within the camera coordinate.
void updateViewMatrix(void)
void reset(void)
Resets the camera position.
void rotate(float dTheta, float dPhi)
void pan(float dx, float dy)