trying to get around git confusion

This commit is contained in:
Jeffrey Ventrella 2013-04-16 14:56:49 -07:00
commit 0c85f832e6
2 changed files with 41 additions and 45 deletions

View file

@ -9,41 +9,32 @@
#include "Camera.h" #include "Camera.h"
//------------------------
Camera::Camera() Camera::Camera()
{ {
mode = CAMERA_MODE_THIRD_PERSON; _mode = CAMERA_MODE_THIRD_PERSON;
tightness = DEFAULT_CAMERA_TIGHTNESS; _tightness = DEFAULT_CAMERA_TIGHTNESS;
fieldOfView = 60.0; // default _fieldOfView = 60.0; // default
yaw = 0.0; _yaw = 0.0;
pitch = 0.0; _pitch = 0.0;
roll = 0.0; _roll = 0.0;
up = 0.0; _up = 0.0;
distance = 0.0; _distance = 0.0;
idealYaw = 0.0; _idealYaw = 0.0;
targetPosition = glm::vec3( 0.0, 0.0, 0.0 ); _targetPosition = glm::vec3( 0.0, 0.0, 0.0 );
position = glm::vec3( 0.0, 0.0, 0.0 ); _position = glm::vec3( 0.0, 0.0, 0.0 );
idealPosition = glm::vec3( 0.0, 0.0, 0.0 ); _idealPosition = glm::vec3( 0.0, 0.0, 0.0 );
orientation.setToIdentity(); _orientation.setToIdentity();
} }
//------------------------------------
void Camera::update( float deltaTime ) void Camera::update( float deltaTime )
{ {
float radian = ( _yaw / 180.0 ) * PIE; float radian = ( _yaw / 180.0 ) * PIE;
//these need to be checked to make sure they correspond to the coordinate system. //these need to be checked to make sure they correspond to the coordinate system.
double x = distance * -sin( radian ); double x = _distance * -sin( radian );
double z = distance * cos( radian ); double z = _distance * cos( radian );
double y = up; double y = _up;
idealPosition = targetPosition + glm::vec3( x, y, z );
_idealPosition = _targetPosition + glm::vec3( x, y, z ); _idealPosition = _targetPosition + glm::vec3( x, y, z );
float t = _tightness * deltaTime; float t = _tightness * deltaTime;
@ -51,17 +42,17 @@ void Camera::update( float deltaTime )
t = 1.0; t = 1.0;
} }
position += ( idealPosition - position ) * t; _position += ( _idealPosition - _position ) * t;
yaw += ( idealYaw - yaw ) * t; _yaw += ( _idealYaw - _yaw ) * t;
//roll = 20.0; //roll = 20.0;
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// generate the ortho-normals for the orientation based on the Euler angles // generate the ortho-normals for the orientation based on the Euler angles
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
orientation.setToIdentity(); _orientation.setToIdentity();
orientation.yaw ( yaw ); _orientation.yaw ( _yaw );
orientation.pitch ( pitch ); _orientation.pitch ( _pitch );
orientation.roll ( roll ); _orientation.roll ( _roll );
} }

View file

@ -29,6 +29,7 @@ public:
void update( float deltaTime ); void update( float deltaTime );
/*
void setMode ( CameraMode m ) { mode = m; } void setMode ( CameraMode m ) { mode = m; }
void setYaw ( float y ) { idealYaw = y; } void setYaw ( float y ) { idealYaw = y; }
void setPitch ( float p ) { pitch = p; } void setPitch ( float p ) { pitch = p; }
@ -39,6 +40,7 @@ public:
void setPosition ( glm::vec3 p ) { position = p; } void setPosition ( glm::vec3 p ) { position = p; }
void setTightness ( float t ) { tightness = t; } void setTightness ( float t ) { tightness = t; }
void setOrientation ( Orientation o ) { orientation.set(o); } void setOrientation ( Orientation o ) { orientation.set(o); }
*/
void setMode ( CameraMode m ) { _mode = m; } void setMode ( CameraMode m ) { _mode = m; }
void setYaw ( float y ) { _yaw = y; } void setYaw ( float y ) { _yaw = y; }
@ -68,19 +70,22 @@ public:
private: private:
CameraMode mode; CameraMode _mode;
glm::vec3 position; glm::vec3 _position;
glm::vec3 idealPosition; glm::vec3 _idealPosition;
glm::vec3 targetPosition; glm::vec3 _targetPosition;
float fieldOfView; float _fieldOfView;
float yaw; float _aspectRatio;
float pitch; float _nearClip;
float roll; float _farClip;
float up; float _yaw;
float idealYaw; float _pitch;
float distance; float _roll;
float tightness; float _up;
Orientation orientation; float _idealYaw;
float _distance;
float _tightness;
Orientation _orientation;
}; };
#endif #endif