From 2486b6e15c0380a54cddd887ff5441746095f19e Mon Sep 17 00:00:00 2001 From: Jeffrey Ventrella Date: Fri, 26 Apr 2013 13:33:36 -0700 Subject: [PATCH] moved inline functions from Camera.h to Camera.cpp as per Stephen's request --- interface/src/Camera.cpp | 42 +++++++++++++++++++++++++++++++--------- interface/src/Camera.h | 11 ++++++----- 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/interface/src/Camera.cpp b/interface/src/Camera.cpp index 6118a9ead5..fa7722df88 100644 --- a/interface/src/Camera.cpp +++ b/interface/src/Camera.cpp @@ -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() { diff --git a/interface/src/Camera.h b/interface/src/Camera.h index 51760867c0..8864df3745 100644 --- a/interface/src/Camera.h +++ b/interface/src/Camera.h @@ -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; }