mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 08:13:13 +02:00
trying to get around git confusion
This commit is contained in:
commit
0c85f832e6
2 changed files with 41 additions and 45 deletions
|
@ -9,41 +9,32 @@
|
|||
|
||||
#include "Camera.h"
|
||||
|
||||
|
||||
|
||||
//------------------------
|
||||
Camera::Camera()
|
||||
{
|
||||
mode = CAMERA_MODE_THIRD_PERSON;
|
||||
tightness = DEFAULT_CAMERA_TIGHTNESS;
|
||||
fieldOfView = 60.0; // default
|
||||
yaw = 0.0;
|
||||
pitch = 0.0;
|
||||
roll = 0.0;
|
||||
up = 0.0;
|
||||
distance = 0.0;
|
||||
idealYaw = 0.0;
|
||||
targetPosition = 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 );
|
||||
orientation.setToIdentity();
|
||||
_mode = CAMERA_MODE_THIRD_PERSON;
|
||||
_tightness = DEFAULT_CAMERA_TIGHTNESS;
|
||||
_fieldOfView = 60.0; // default
|
||||
_yaw = 0.0;
|
||||
_pitch = 0.0;
|
||||
_roll = 0.0;
|
||||
_up = 0.0;
|
||||
_distance = 0.0;
|
||||
_idealYaw = 0.0;
|
||||
_targetPosition = 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 );
|
||||
_orientation.setToIdentity();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------
|
||||
void Camera::update( float deltaTime )
|
||||
{
|
||||
float radian = ( _yaw / 180.0 ) * PIE;
|
||||
|
||||
//these need to be checked to make sure they correspond to the coordinate system.
|
||||
double x = distance * -sin( radian );
|
||||
double z = distance * cos( radian );
|
||||
double y = up;
|
||||
|
||||
idealPosition = targetPosition + glm::vec3( x, y, z );
|
||||
|
||||
double x = _distance * -sin( radian );
|
||||
double z = _distance * cos( radian );
|
||||
double y = _up;
|
||||
|
||||
_idealPosition = _targetPosition + glm::vec3( x, y, z );
|
||||
float t = _tightness * deltaTime;
|
||||
|
||||
|
@ -51,17 +42,17 @@ void Camera::update( float deltaTime )
|
|||
t = 1.0;
|
||||
}
|
||||
|
||||
position += ( idealPosition - position ) * t;
|
||||
yaw += ( idealYaw - yaw ) * t;
|
||||
_position += ( _idealPosition - _position ) * t;
|
||||
_yaw += ( _idealYaw - _yaw ) * t;
|
||||
|
||||
//roll = 20.0;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// generate the ortho-normals for the orientation based on the Euler angles
|
||||
//-------------------------------------------------------------------------
|
||||
orientation.setToIdentity();
|
||||
orientation.yaw ( yaw );
|
||||
orientation.pitch ( pitch );
|
||||
orientation.roll ( roll );
|
||||
_orientation.setToIdentity();
|
||||
_orientation.yaw ( _yaw );
|
||||
_orientation.pitch ( _pitch );
|
||||
_orientation.roll ( _roll );
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ public:
|
|||
|
||||
void update( float deltaTime );
|
||||
|
||||
/*
|
||||
void setMode ( CameraMode m ) { mode = m; }
|
||||
void setYaw ( float y ) { idealYaw = y; }
|
||||
void setPitch ( float p ) { pitch = p; }
|
||||
|
@ -39,6 +40,7 @@ public:
|
|||
void setPosition ( glm::vec3 p ) { position = p; }
|
||||
void setTightness ( float t ) { tightness = t; }
|
||||
void setOrientation ( Orientation o ) { orientation.set(o); }
|
||||
*/
|
||||
|
||||
void setMode ( CameraMode m ) { _mode = m; }
|
||||
void setYaw ( float y ) { _yaw = y; }
|
||||
|
@ -68,19 +70,22 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
CameraMode mode;
|
||||
glm::vec3 position;
|
||||
glm::vec3 idealPosition;
|
||||
glm::vec3 targetPosition;
|
||||
float fieldOfView;
|
||||
float yaw;
|
||||
float pitch;
|
||||
float roll;
|
||||
float up;
|
||||
float idealYaw;
|
||||
float distance;
|
||||
float tightness;
|
||||
Orientation orientation;
|
||||
CameraMode _mode;
|
||||
glm::vec3 _position;
|
||||
glm::vec3 _idealPosition;
|
||||
glm::vec3 _targetPosition;
|
||||
float _fieldOfView;
|
||||
float _aspectRatio;
|
||||
float _nearClip;
|
||||
float _farClip;
|
||||
float _yaw;
|
||||
float _pitch;
|
||||
float _roll;
|
||||
float _up;
|
||||
float _idealYaw;
|
||||
float _distance;
|
||||
float _tightness;
|
||||
Orientation _orientation;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue