2013-12-06 09:46:30 +01:00
|
|
|
#ifndef PHYSICS_STRUCTS_H
|
|
|
|
#define PHYSICS_STRUCTS_H
|
|
|
|
|
|
|
|
#include "OysterMath.h"
|
|
|
|
#include "PhysicsAPI.h"
|
|
|
|
|
|
|
|
namespace Oyster { namespace Physics
|
|
|
|
{
|
|
|
|
namespace Struct
|
|
|
|
{
|
|
|
|
struct SimpleBodyDescription
|
|
|
|
{
|
|
|
|
::Oyster::Math::Float4x4 rotation;
|
|
|
|
::Oyster::Math::Float3 centerPosition;
|
|
|
|
::Oyster::Math::Float3 size;
|
|
|
|
::Oyster::Math::Float mass;
|
|
|
|
::Oyster::Math::Float4x4 inertiaTensor;
|
|
|
|
::Oyster::Physics::ICustomBody::EventAction_Collision subscription;
|
|
|
|
bool ignoreGravity;
|
|
|
|
|
|
|
|
SimpleBodyDescription();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SphericalBodyDescription
|
|
|
|
{
|
|
|
|
::Oyster::Math::Float4x4 rotation;
|
|
|
|
::Oyster::Math::Float3 centerPosition;
|
|
|
|
::Oyster::Math::Float radius;
|
|
|
|
::Oyster::Math::Float mass;
|
|
|
|
::Oyster::Physics::ICustomBody::EventAction_Collision subscription;
|
|
|
|
bool ignoreGravity;
|
|
|
|
|
|
|
|
SphericalBodyDescription();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CustomBodyState
|
|
|
|
{
|
|
|
|
public:
|
2013-12-18 08:57:27 +01:00
|
|
|
CustomBodyState( const ::Oyster::Math::Float3 &reach = ::Oyster::Math::Float3::null,
|
|
|
|
const ::Oyster::Math::Float3 ¢erPos = ::Oyster::Math::Float3::null,
|
|
|
|
const ::Oyster::Math::Float3 &rotation = ::Oyster::Math::Float3::null,
|
|
|
|
const ::Oyster::Math::Float3 &linearMomentum = ::Oyster::Math::Float3::null,
|
|
|
|
const ::Oyster::Math::Float3 &angularMomentum = ::Oyster::Math::Float3::null );
|
2013-12-06 09:46:30 +01:00
|
|
|
|
|
|
|
CustomBodyState & operator = ( const CustomBodyState &state );
|
|
|
|
|
|
|
|
const ::Oyster::Math::Float4 & GetReach() const;
|
|
|
|
::Oyster::Math::Float4 GetSize() const;
|
|
|
|
const ::Oyster::Math::Float4 & GetCenterPosition() const;
|
|
|
|
const ::Oyster::Math::Float4 & GetAngularAxis() const;
|
|
|
|
::Oyster::Math::Float4x4 GetRotation() const;
|
2013-12-18 08:57:27 +01:00
|
|
|
const ::Oyster::Math::Float GetMass() const;
|
|
|
|
const ::Oyster::Math::Float GetRestitutionCoeff() const;
|
|
|
|
const ::Oyster::Math::Float4 & GetLinearMomentum() const;
|
|
|
|
::Oyster::Math::Float4 GetLinearMomentum( const ::Oyster::Math::Float3 &at ) const;
|
|
|
|
::Oyster::Math::Float4 GetLinearMomentum( const ::Oyster::Math::Float4 &at ) const;
|
|
|
|
const ::Oyster::Math::Float4 & GetAngularMomentum() const;
|
|
|
|
|
2013-12-06 09:46:30 +01:00
|
|
|
|
|
|
|
void SetSize( const ::Oyster::Math::Float3 &size );
|
|
|
|
void SetReach( const ::Oyster::Math::Float3 &halfSize );
|
|
|
|
void SetCenterPosition( const ::Oyster::Math::Float3 ¢erPos );
|
|
|
|
void SetRotation( const ::Oyster::Math::Float3 &angularAxis );
|
|
|
|
void SetRotation( const ::Oyster::Math::Float4x4 &rotation );
|
2013-12-18 08:57:27 +01:00
|
|
|
void SetMass( ::Oyster::Math::Float m );
|
|
|
|
void SetRestitutionCoeff( ::Oyster::Math::Float e );
|
|
|
|
void SetLinearMomentum( const ::Oyster::Math::Float3 &g );
|
|
|
|
void SetAngularMomentum( const ::Oyster::Math::Float3 &h );
|
|
|
|
|
|
|
|
void ApplyImpulse( const ::Oyster::Math::Float4 &j );
|
|
|
|
void ApplyImpulse( const ::Oyster::Math::Float4 &j, const ::Oyster::Math::Float4 &at, const ::Oyster::Math::Float4 &normal );
|
2013-12-06 09:46:30 +01:00
|
|
|
|
|
|
|
bool IsSpatiallyAltered() const;
|
|
|
|
bool IsDisturbed() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
::Oyster::Math::Float4 reach, centerPos, angularAxis;
|
2013-12-18 08:57:27 +01:00
|
|
|
::Oyster::Math::Float4 linearMomentum, angularMomentum;
|
2013-12-06 09:46:30 +01:00
|
|
|
|
|
|
|
bool isSpatiallyAltered, isDisturbed;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
} }
|
|
|
|
|
|
|
|
#include "PhysicsStructs-Impl.h"
|
|
|
|
|
|
|
|
#endif
|