mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 19:04:32 +02:00
moved inline functions from Camera.h to Camera.cpp as per Stephen's request
This commit is contained in:
parent
59ef9e5d7e
commit
2486b6e15c
2 changed files with 39 additions and 14 deletions
|
@ -65,25 +65,49 @@ void Camera::updateFollowMode( float deltaTime ) {
|
|||
}
|
||||
|
||||
// update _yaw (before position!)
|
||||
_yaw += ( _idealYaw - _yaw ) * t;
|
||||
_orientation.yaw ( _yaw );
|
||||
_yaw += (_idealYaw - _yaw) * t;
|
||||
_orientation.yaw(_yaw);
|
||||
|
||||
float radian = ( _yaw / 180.0 ) * PIE;
|
||||
float radian = (_yaw / 180.0) * PIE;
|
||||
|
||||
// update _position
|
||||
//these need to be checked to make sure they correspond to the correct coordinate system.
|
||||
double x = _distance * -sin( radian );
|
||||
double z = _distance * cos( radian );
|
||||
double x = _distance * -sin(radian);
|
||||
double z = _distance * cos(radian);
|
||||
double y = _upShift;
|
||||
|
||||
_idealPosition = _targetPosition + glm::vec3( x, y, z );
|
||||
//_idealPosition += _orientation.getRight() * _rightShift;
|
||||
//_idealPosition += _orientation.getUp () * _upShift;
|
||||
_idealPosition = _targetPosition + glm::vec3(x, y, z);
|
||||
|
||||
// pull position towards ideal position
|
||||
_position += ( _idealPosition - _position ) * t;
|
||||
_position += (_idealPosition - _position) * t;
|
||||
}
|
||||
|
||||
void Camera::setMode(CameraMode m) {
|
||||
_mode = m;
|
||||
_modeShift = 0.0f;
|
||||
}
|
||||
|
||||
void Camera::setFieldOfView(float f) {
|
||||
_fieldOfView = f;
|
||||
_frustumNeedsReshape = true;
|
||||
}
|
||||
|
||||
void Camera::setAspectRatio(float a) {
|
||||
_aspectRatio = a;
|
||||
_frustumNeedsReshape = true;
|
||||
}
|
||||
|
||||
void Camera::setNearClip (float n) {
|
||||
_nearClip = n;
|
||||
_frustumNeedsReshape = true;
|
||||
}
|
||||
|
||||
void Camera::setFarClip (float f) {
|
||||
_farClip = f;
|
||||
_frustumNeedsReshape = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// call to find out if the view frustum needs to be reshaped
|
||||
bool Camera::getFrustumNeedsReshape() {
|
||||
|
|
|
@ -29,7 +29,6 @@ public:
|
|||
|
||||
void update( float deltaTime );
|
||||
|
||||
void setMode ( CameraMode m ) { _mode = m; _modeShift = 0.0f; }
|
||||
void setYaw ( float y ) { _yaw = y; }
|
||||
void setPitch ( float p ) { _pitch = p; }
|
||||
void setRoll ( float r ) { _roll = r; }
|
||||
|
@ -41,10 +40,12 @@ public:
|
|||
void setPosition ( glm::vec3 p ) { _position = p; }
|
||||
void setOrientation ( Orientation o ) { _orientation.set(o); }
|
||||
void setTightness ( float t ) { _tightness = t; }
|
||||
void setFieldOfView ( float f ) { _fieldOfView = f; _frustumNeedsReshape = true; }
|
||||
void setAspectRatio ( float a ) { _aspectRatio = a; _frustumNeedsReshape = true; }
|
||||
void setNearClip ( float n ) { _nearClip = n; _frustumNeedsReshape = true; }
|
||||
void setFarClip ( float f ) { _farClip = f; _frustumNeedsReshape = true; }
|
||||
|
||||
void setMode ( CameraMode m );
|
||||
void setFieldOfView ( float f );
|
||||
void setAspectRatio ( float a );
|
||||
void setNearClip ( float n );
|
||||
void setFarClip ( float f );
|
||||
|
||||
float getYaw () { return _yaw; }
|
||||
float getPitch () { return _pitch; }
|
||||
|
|
Loading…
Reference in a new issue