From 800d5d0505b1c57a0c722c4221bfa7312b215516 Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Mon, 10 Feb 2014 13:01:46 +0100 Subject: [PATCH] Camera_Basic stuff --- Code/Game/DanBiasGame/GameClientState/Camera_Basic.cpp | 8 ++++++++ Code/Game/DanBiasGame/GameClientState/Camera_Basic.h | 1 + Code/OysterMath/OysterMath.h | 1 + 3 files changed, 10 insertions(+) diff --git a/Code/Game/DanBiasGame/GameClientState/Camera_Basic.cpp b/Code/Game/DanBiasGame/GameClientState/Camera_Basic.cpp index fc31545a..6c79fe6a 100644 --- a/Code/Game/DanBiasGame/GameClientState/Camera_Basic.cpp +++ b/Code/Game/DanBiasGame/GameClientState/Camera_Basic.cpp @@ -68,10 +68,18 @@ void Camera_Basic::Rotate( const Float3 &deltaAngularAxis ) this->rotationIsOutOfDate = true; } +Float3 Camera_Basic::GetNormalOf( const Float3 &axis ) const +{ + return WorldAxisOf( this->GetRotation(), axis ); +} + const Quaternion & Camera_Basic::GetRotation() const { if( this->rotationIsOutOfDate ) { + /*Float4 temp; + ::std::fmod( Float4(this->angularAxis, 0.0f) );*/ + this->rotation = Rotation( this->angularAxis ); this->rotationIsOutOfDate = false; } diff --git a/Code/Game/DanBiasGame/GameClientState/Camera_Basic.h b/Code/Game/DanBiasGame/GameClientState/Camera_Basic.h index 531a3291..ca317db0 100644 --- a/Code/Game/DanBiasGame/GameClientState/Camera_Basic.h +++ b/Code/Game/DanBiasGame/GameClientState/Camera_Basic.h @@ -21,6 +21,7 @@ public: void Move( const ::Oyster::Math::Float3 &deltaPosition ); void Rotate( const ::Oyster::Math::Float3 &deltaAngularAxis ); + ::Oyster::Math::Float3 GetNormalOf( const ::Oyster::Math::Float3 &axis ) const; const ::Oyster::Math::Quaternion & GetRotation() const; ::Oyster::Math::Float3x3 & GetRotationMatrix( ::Oyster::Math::Float3x3 &targetMem ) const; ::Oyster::Math::Float4x4 & GetRotationMatrix( ::Oyster::Math::Float4x4 &targetMem ) const; diff --git a/Code/OysterMath/OysterMath.h b/Code/OysterMath/OysterMath.h index dbc144b8..a98663cd 100644 --- a/Code/OysterMath/OysterMath.h +++ b/Code/OysterMath/OysterMath.h @@ -331,6 +331,7 @@ namespace Oyster { namespace Math3D //! Oyster's native math library specialized using ::LinearAlgebra3D::InterpolateOrientation_UsingRigidNlerp; using ::LinearAlgebra3D::InterpolateOrientation_UsingSlerp; using ::LinearAlgebra3D::SnapAngularAxis; + using ::LinearAlgebra3D::WorldAxisOf; } } #endif \ No newline at end of file