void CCamera::Update() { // Initialize a variable for the cross product result CVector3 vCross = Cross(m_vView - m_vPosition, m_vUpVector); // Normalize the strafe vector m_vStrafe = Normalize(vCross); // Move the camera's view by the mouse SetViewByMouse(); /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * // We commented this line out so the camera can't move around // in this tutorial. // This checks to see if the keyboard was pressed //CheckForMovement(); /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * // Calculate our frame rate and set our frame interval for time-based movement CalculateFrameRate(); }
void Camera::Update() { vec3 vCross = cross(viewVector - position, upVector); strVector = normalize(vCross); //position.y -= currentSpeed; //viewVector.y -= currentSpeed; //if(currentSpeed == 0.0) // currentSpeed = 0.005; //currentSpeed += 0.01*currentSpeed; previousViewMatrix = viewMatrix; previousDirection = direction; previousPosition = position; SetViewByMouse(); CheckForMovement(); viewMatrix = glm::lookAt(viewVector, position, upVector); inverseMatrix = inverse(projectionMatrix * viewMatrix); direction = viewVector - position; }
void CCamera::Update() { // Initialize a variable for the cross product result CVector3 vCross = Cross(m_vView - m_vPosition, m_vUpVector); // Normalize the strafe vector m_vStrafe = Normalize(vCross); // Move the camera's view by the mouse SetViewByMouse(); // This checks to see if the keyboard was pressed CheckForMovement(); /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * // We stick this function in our camera source file so that we can move // time base movement and camera functionality together between tutorials // relatively easily. // We calculate our frame rate and set our frame interval for time based movement CalculateFrameRate(); /////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// * }