From 687ffa4f99e2a7e441fca02e1b70a002c90fe41c Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Thu, 9 Jan 2014 10:42:22 +0100 Subject: [PATCH] struct State::GetView() overload Can now provide an offset vector as argument --- Code/GamePhysics/PhysicsStructs-Impl.h | 10 ++++++++++ Code/GamePhysics/PhysicsStructs.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/Code/GamePhysics/PhysicsStructs-Impl.h b/Code/GamePhysics/PhysicsStructs-Impl.h index e7704460..f7b5e83c 100644 --- a/Code/GamePhysics/PhysicsStructs-Impl.h +++ b/Code/GamePhysics/PhysicsStructs-Impl.h @@ -122,11 +122,21 @@ namespace Oyster { namespace Physics return ::Oyster::Math3D::OrientationMatrix( this->angularAxis.xyz, this->centerPos.xyz ); } + inline ::Oyster::Math::Float4x4 CustomBodyState::GetOrientation( const ::Oyster::Math::Float4 &offset ) const + { + return ::Oyster::Math3D::OrientationMatrix( this->angularAxis.xyz, (this->centerPos + offset).xyz ); + } + inline ::Oyster::Math::Float4x4 CustomBodyState::GetView() const { return ::Oyster::Math3D::ViewMatrix( this->angularAxis.xyz, this->centerPos.xyz ); } + inline ::Oyster::Math::Float4x4 CustomBodyState::GetView( const ::Oyster::Math::Float4 &offset ) const + { + return ::Oyster::Math3D::ViewMatrix( this->angularAxis.xyz, (this->centerPos + offset).xyz ); + } + inline const ::Oyster::Math::Float4 & CustomBodyState::GetLinearMomentum() const { return this->linearMomentum; diff --git a/Code/GamePhysics/PhysicsStructs.h b/Code/GamePhysics/PhysicsStructs.h index 3c17ae6d..e4d70c4f 100644 --- a/Code/GamePhysics/PhysicsStructs.h +++ b/Code/GamePhysics/PhysicsStructs.h @@ -60,7 +60,9 @@ namespace Oyster { namespace Physics const ::Oyster::Math::Float4 & GetAngularAxis() const; ::Oyster::Math::Float4x4 GetRotation() const; ::Oyster::Math::Float4x4 GetOrientation() const; + ::Oyster::Math::Float4x4 GetOrientation( const ::Oyster::Math::Float4 &offset ) const; ::Oyster::Math::Float4x4 GetView() const; + ::Oyster::Math::Float4x4 GetView( const ::Oyster::Math::Float4 &offset ) const; const ::Oyster::Math::Float4 & GetLinearMomentum() const; ::Oyster::Math::Float4 GetLinearMomentum( const ::Oyster::Math::Float4 &at ) const; const ::Oyster::Math::Float4 & GetAngularMomentum() const;