2013-12-06 09:46:30 +01:00
|
|
|
#ifndef PHYSICS_STRUCTS_IMPL_H
|
|
|
|
#define PHYSICS_STRUCTS_IMPL_H
|
|
|
|
|
|
|
|
#include "PhysicsStructs.h"
|
2014-01-14 10:34:22 +01:00
|
|
|
#include "OysterPhysics3D.h"
|
2013-12-06 09:46:30 +01:00
|
|
|
|
2013-12-19 14:30:16 +01:00
|
|
|
namespace Oyster
|
|
|
|
{
|
|
|
|
namespace Physics
|
2013-12-06 09:46:30 +01:00
|
|
|
{
|
2013-12-19 14:30:16 +01:00
|
|
|
namespace Struct
|
2013-12-06 09:46:30 +01:00
|
|
|
{
|
2014-02-14 11:52:44 +01:00
|
|
|
inline CustomBodyState::CustomBodyState( ::Oyster::Math::Float mass, ::Oyster::Math::Float3 reach, ::Oyster::Math::Float restitutionCoeff, ::Oyster::Math::Float staticFrictionCoeff, ::Oyster::Math::Float dynamicFrictionCoeff, const ::Oyster::Math::Float3 ¢erPos, const ::Oyster::Math::Quaternion& quaternion)
|
2013-12-19 14:30:16 +01:00
|
|
|
{
|
2014-01-09 11:36:55 +01:00
|
|
|
this->mass = mass;
|
2014-02-14 11:52:44 +01:00
|
|
|
this->reach = reach;
|
2014-01-09 11:36:55 +01:00
|
|
|
this->restitutionCoeff = restitutionCoeff;
|
|
|
|
this->staticFrictionCoeff = staticFrictionCoeff;
|
2014-02-09 21:24:09 +01:00
|
|
|
this->dynamicFrictionCoeff = dynamicFrictionCoeff;
|
2014-01-09 11:36:55 +01:00
|
|
|
this->centerPos = centerPos;
|
2014-02-09 21:24:09 +01:00
|
|
|
this->quaternion = quaternion;
|
2013-12-19 14:30:16 +01:00
|
|
|
}
|
2013-12-06 09:46:30 +01:00
|
|
|
|
2013-12-19 14:30:16 +01:00
|
|
|
inline CustomBodyState & CustomBodyState::operator = ( const CustomBodyState &state )
|
|
|
|
{
|
2014-01-09 11:36:55 +01:00
|
|
|
this->mass = state.mass;
|
|
|
|
this->restitutionCoeff = state.restitutionCoeff;
|
2014-02-14 11:52:44 +01:00
|
|
|
this->reach = state.reach;
|
2014-01-09 11:36:55 +01:00
|
|
|
this->staticFrictionCoeff = state.staticFrictionCoeff;
|
2014-02-09 21:24:09 +01:00
|
|
|
this->dynamicFrictionCoeff = state.dynamicFrictionCoeff;
|
2013-12-19 14:30:16 +01:00
|
|
|
this->centerPos = state.centerPos;
|
2014-02-09 21:24:09 +01:00
|
|
|
this->quaternion = state.quaternion;
|
2013-12-06 09:46:30 +01:00
|
|
|
|
2014-02-09 21:24:09 +01:00
|
|
|
return *this;
|
2013-12-19 14:30:16 +01:00
|
|
|
}
|
2013-12-06 09:46:30 +01:00
|
|
|
|
|
|
|
|
2013-12-19 14:30:16 +01:00
|
|
|
inline ::Oyster::Math::Float4x4 CustomBodyState::GetRotation() const
|
|
|
|
{
|
2014-02-09 21:24:09 +01:00
|
|
|
return ::Oyster::Math3D::RotationMatrix( this->quaternion );
|
2013-12-19 14:30:16 +01:00
|
|
|
}
|
2013-12-06 09:46:30 +01:00
|
|
|
|
2014-01-09 11:36:55 +01:00
|
|
|
inline ::Oyster::Math::Float4x4 CustomBodyState::GetOrientation() const
|
|
|
|
{
|
2014-02-09 21:24:09 +01:00
|
|
|
return ::Oyster::Math3D::OrientationMatrix( this->quaternion, this->centerPos );
|
2014-01-09 11:36:55 +01:00
|
|
|
}
|
2013-12-18 08:57:27 +01:00
|
|
|
|
2014-01-09 11:36:55 +01:00
|
|
|
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-09 11:36:55 +01:00
|
|
|
}
|
2014-01-09 10:42:22 +01:00
|
|
|
|
2014-01-28 09:52:58 +01:00
|
|
|
inline ::Oyster::Math::Float4x4 CustomBodyState::GetView( const ::Oyster::Math::Float3 &offset ) const
|
2014-01-09 11:36:55 +01:00
|
|
|
{
|
2014-02-09 21:24:09 +01:00
|
|
|
return ::Oyster::Math3D::ViewMatrix( this->quaternion, (this->centerPos + offset) );
|
2014-01-15 10:44:20 +01:00
|
|
|
}
|
|
|
|
|
2013-12-20 11:13:44 +01:00
|
|
|
}
|
2013-12-19 14:30:16 +01:00
|
|
|
}
|
|
|
|
}
|
2013-12-06 09:46:30 +01:00
|
|
|
|
|
|
|
#endif
|