Danbias/Code/GamePhysics/PhysicsStructs-Impl.h

60 lines
1.8 KiB
C
Raw Normal View History

#ifndef PHYSICS_STRUCTS_IMPL_H
#define PHYSICS_STRUCTS_IMPL_H
#include "PhysicsStructs.h"
2014-01-14 10:34:22 +01:00
#include "OysterPhysics3D.h"
namespace Oyster
{
namespace Physics
{
namespace Struct
{
2014-02-09 21:24:09 +01:00
inline CustomBodyState::CustomBodyState( ::Oyster::Math::Float mass, ::Oyster::Math::Float restitutionCoeff, ::Oyster::Math::Float staticFrictionCoeff, ::Oyster::Math::Float dynamicFrictionCoeff, const ::Oyster::Math::Float3 &centerPos, const ::Oyster::Math::Quaternion& quaternion)
{
this->mass = mass;
this->restitutionCoeff = restitutionCoeff;
this->staticFrictionCoeff = staticFrictionCoeff;
2014-02-09 21:24:09 +01:00
this->dynamicFrictionCoeff = dynamicFrictionCoeff;
this->centerPos = centerPos;
2014-02-09 21:24:09 +01:00
this->quaternion = quaternion;
}
inline CustomBodyState & CustomBodyState::operator = ( const CustomBodyState &state )
{
this->mass = state.mass;
this->restitutionCoeff = state.restitutionCoeff;
this->staticFrictionCoeff = state.staticFrictionCoeff;
2014-02-09 21:24:09 +01:00
this->dynamicFrictionCoeff = state.dynamicFrictionCoeff;
this->centerPos = state.centerPos;
2014-02-09 21:24:09 +01:00
this->quaternion = state.quaternion;
2014-02-09 21:24:09 +01:00
return *this;
}
inline ::Oyster::Math::Float4x4 CustomBodyState::GetRotation() const
{
2014-02-09 21:24:09 +01:00
return ::Oyster::Math3D::RotationMatrix( this->quaternion );
}
inline ::Oyster::Math::Float4x4 CustomBodyState::GetOrientation() const
{
2014-02-09 21:24:09 +01:00
return ::Oyster::Math3D::OrientationMatrix( this->quaternion, this->centerPos );
}
inline ::Oyster::Math::Float4x4 CustomBodyState::GetView() const
{
2014-02-09 21:24:09 +01:00
return ::Oyster::Math3D::ViewMatrix( this->quaternion, this->centerPos );
}
2014-01-28 09:52:58 +01:00
inline ::Oyster::Math::Float4x4 CustomBodyState::GetView( const ::Oyster::Math::Float3 &offset ) const
{
2014-02-09 21:24:09 +01:00
return ::Oyster::Math3D::ViewMatrix( this->quaternion, (this->centerPos + offset) );
}
}
}
}
#endif