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();
}
示例#2
0
文件: Camera.cpp 项目: emrakul/Torus
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;

}
示例#3
0
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 * /////// * /////////// * /////////// *


}