FreeFlyCamera::FreeFlyCamera(glm::vec3 position, float nearDistance, float farDistance, float verticalFieldOfView, double leafSize){ m_Position = position; m_fPhi = PI; m_fTheta = 0; m_leafSize = leafSize; m_nearDistance = nearDistance; m_farDistance = farDistance; m_verticalFieldOfView = verticalFieldOfView; m_frustumNearPlanePoint = glm::vec3(0.f, 0.f, 0.f); m_frustumFarPlanePoint = glm::vec3(0.f, 0.f, 0.f); m_frustumTopPlanePoint = glm::vec3(0.f, 0.f, 0.f); m_frustumRightPlanePoint = glm::vec3(0.f, 0.f, 0.f); m_frustumBottomPlanePoint = glm::vec3(0.f, 0.f, 0.f); m_frustumLeftPlanePoint = glm::vec3(0.f, 0.f, 0.f); m_frustumNearPlaneNormal = glm::vec3(0.f, 0.f, 0.f); m_frustumFarPlaneNormal = glm::vec3(0.f, 0.f, 0.f); m_frustumTopPlaneNormal = glm::vec3(0.f, 0.f, 0.f); m_frustumRightPlaneNormal = glm::vec3(0.f, 0.f, 0.f); m_frustumBottomPlaneNormal = glm::vec3(0.f, 0.f, 0.f); m_frustumLeftPlaneNormal = glm::vec3(0.f, 0.f, 0.f); computeDirectionVectors(); computeFrustumPlanes(); }
Camera::Camera(const Camera &source){ position = source.position; m_fPhi = source.m_fPhi; m_fTheta = source.m_fTheta; cameraSpeed = source.cameraSpeed; computeDirectionVectors(); }
FreeFlyCamera() { m_Position = glm::vec3(5,8,5); m_Inertia = glm::vec3(0,0,0); m_fPhi = 0; m_fTheta = 0.f; computeDirectionVectors(); }
Camera::Camera(){ position = glm::vec3(0, defaultYPosition, 0); m_fPhi = M_PI; m_fTheta = 0; cameraSpeed = 2.2f; computeDirectionVectors(); }
void rotateUp(float degrees) { m_fTheta += glm::radians(degrees); computeDirectionVectors(); }
void rotateLeft(float degrees) { m_fPhi += glm::radians(degrees); computeDirectionVectors(); }
FreeflyCamera(): m_Position(0.f), m_fPhi(M_PI), m_fTheta(0.f) { computeDirectionVectors(); }
void rotateUp(float degrees){ m_fTheta+=M_PI*degrees/180; computeDirectionVectors(); }
void rotateLeft(float degrees){ m_fPhi+=M_PI*degrees/180; computeDirectionVectors(); }
void Camera::moveFront(float t){ m_Position += t * m_FrontVector; computeDirectionVectors(); }
inline void setAngles(float phi, float theta){ m_fPhi = phi; m_fTheta = theta; computeDirectionVectors(); };
void FreeFlyCamera::rotateUp(float degree){ m_fTheta = glm::radians(degree); computeDirectionVectors(); computeFrustumPlanes(); }
void FreeFlyCamera::resetView(float theta, float phi){ m_fTheta = theta; m_fPhi = phi; computeDirectionVectors(); computeFrustumPlanes(); }
void Camera::changePosition( glm::vec3 position){ m_Position = position; computeDirectionVectors(); }
Camera::Camera(){ m_Position = glm::vec3(0.0f);; m_fPhi = glm::radians(M_PI); m_fTheta = glm::radians(0.0); computeDirectionVectors(); }
void Camera::rotateLeft(float degrees){ //if(m_fPhi + glm::radians(degrees)> M_PI + 1 || m_fPhi + glm::radians(degrees)< M_PI -1) return; m_fPhi += glm::radians(degrees); computeDirectionVectors(); }
void Camera::rotateUp(float degrees){ if(m_fTeta + glm::radians(degrees) > 1.7 || m_fTeta + glm::radians(degrees) < -1.7) return; m_fTeta += glm::radians(degrees); computeDirectionVectors(); }
void FreeflyCamera::rotateUp(float degrees){ m_fTeta += glm::radians(degrees); computeDirectionVectors(); }
FreeflyCamera(){ m_Position=glm::vec3(0,5,-5); m_fPhi=M_PI; m_fTheta=0; computeDirectionVectors(); }
void Camera::moveLeft(float t){ m_Position += t * m_LeftVector; computeDirectionVectors(); }