Stuff
This commit is contained in:
parent
c740bd5935
commit
c854b1af58
|
@ -166,6 +166,8 @@
|
|||
<ClInclude Include="Implementation\SimpleRigidBody.h" />
|
||||
<ClInclude Include="Implementation\SphericalRigidBody.h" />
|
||||
<ClInclude Include="PhysicsAPI.h" />
|
||||
<ClInclude Include="PhysicsFormula-Impl.h" />
|
||||
<ClInclude Include="PhysicsFormula.h" />
|
||||
<ClInclude Include="PhysicsStructs-Impl.h" />
|
||||
<ClInclude Include="PhysicsStructs.h" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -42,6 +42,12 @@
|
|||
<ClInclude Include="PhysicsStructs-Impl.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PhysicsFormula.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PhysicsFormula-Impl.h">
|
||||
<Filter>Header Files\Include</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Implementation\PhysicsAPI_Impl.cpp">
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include "SphericalRigidBody.h"
|
||||
|
||||
using namespace ::Oyster::Physics;
|
||||
using namespace ::Oyster::Physics3D;
|
||||
using namespace ::Oyster::Math;
|
||||
using namespace ::Oyster::Collision3D;
|
||||
using namespace ::Utility::DynamicMemory;
|
||||
|
@ -27,31 +26,6 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
Float4x4 & MomentOfInertia::CreateSphereMatrix( const Float mass, const Float radius, ::Oyster::Math::Float4x4 &targetMem )
|
||||
{
|
||||
return targetMem = Formula::MomentOfInertia::Sphere(mass, radius);
|
||||
}
|
||||
|
||||
Float4x4 & MomentOfInertia::CreateHollowSphereMatrix( const Float mass, const Float radius, ::Oyster::Math::Float4x4 &targetMem )
|
||||
{
|
||||
return targetMem = Formula::MomentOfInertia::HollowSphere(mass, radius);
|
||||
}
|
||||
|
||||
Float4x4 & MomentOfInertia::CreateCuboidMatrix( const Float mass, const Float height, const Float width, const Float depth, ::Oyster::Math::Float4x4 &targetMem )
|
||||
{
|
||||
return targetMem = Formula::MomentOfInertia::Cuboid(mass, height, width, depth);
|
||||
}
|
||||
|
||||
Float4x4 & MomentOfInertia::CreateCylinderMatrix( const Float mass, const Float height, const Float radius, ::Oyster::Math::Float4x4 &targetMem )
|
||||
{
|
||||
return targetMem = Formula::MomentOfInertia::Cylinder(mass, height, radius);
|
||||
}
|
||||
|
||||
Float4x4 & MomentOfInertia::CreateRodMatrix( const Float mass, const Float length, ::Oyster::Math::Float4x4 &targetMem )
|
||||
{
|
||||
return targetMem = Formula::MomentOfInertia::RodCenter(mass, length);
|
||||
}
|
||||
|
||||
API & API::Instance()
|
||||
{
|
||||
return API_instance;
|
||||
|
|
|
@ -21,7 +21,7 @@ SphericalRigidBody::SphericalRigidBody( const API::SphericalBodyDescription &des
|
|||
{
|
||||
this->rigid = RigidBody( Box( desc.rotation, desc.centerPosition, Float3(2.0f * desc.radius) ),
|
||||
desc.mass,
|
||||
MomentOfInertia::CreateSphereMatrix( desc.mass, desc.radius ) );
|
||||
Formula::MomentOfInertia::CreateSphereMatrix( desc.mass, desc.radius ) );
|
||||
this->gravityNormal = Float3::null;
|
||||
|
||||
if( desc.subscription )
|
||||
|
|
|
@ -35,20 +35,6 @@ namespace Oyster
|
|||
const float gravity_constant = (const float)6.67284e-11; //!< The _big_G_! ( N(m/kg)^2 ) Used in real gravityforcefields.
|
||||
}
|
||||
|
||||
class PHYSICS_DLL_USAGE MomentOfInertia
|
||||
{
|
||||
public:
|
||||
static ::Oyster::Math::Float4x4 & CreateSphereMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float radius, ::Oyster::Math::Float4x4 &targetMem = ::Oyster::Math::Float4x4() );
|
||||
|
||||
static ::Oyster::Math::Float4x4 & CreateHollowSphereMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float radius, ::Oyster::Math::Float4x4 &targetMem = ::Oyster::Math::Float4x4() );
|
||||
|
||||
static ::Oyster::Math::Float4x4 & CreateCuboidMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float height, const ::Oyster::Math::Float width, const ::Oyster::Math::Float depth, ::Oyster::Math::Float4x4 &targetMem = ::Oyster::Math::Float4x4() );
|
||||
|
||||
static ::Oyster::Math::Float4x4 & CreateCylinderMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float height, const ::Oyster::Math::Float radius, ::Oyster::Math::Float4x4 &targetMem = ::Oyster::Math::Float4x4() );
|
||||
|
||||
static ::Oyster::Math::Float4x4 & CreateRodMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float length, ::Oyster::Math::Float4x4 &targetMem = ::Oyster::Math::Float4x4() );
|
||||
};
|
||||
|
||||
class PHYSICS_DLL_USAGE API
|
||||
{
|
||||
public:
|
||||
|
@ -436,5 +422,6 @@ namespace Oyster
|
|||
}
|
||||
|
||||
#include "PhysicsStructs.h"
|
||||
#include "PhysicsFormula.h"
|
||||
|
||||
#endif
|
|
@ -0,0 +1,46 @@
|
|||
#ifndef PHYSICS_FORMULA_IMPL_H
|
||||
#define PHYSICS_FORMULA_IMPL_H
|
||||
|
||||
#include "PhysicsFormula.h"
|
||||
#include "OysterPhysics3D.h"
|
||||
|
||||
namespace Oyster { namespace Physics { namespace Formula
|
||||
{
|
||||
namespace MomentOfInertia
|
||||
{
|
||||
inline ::Oyster::Math::Float4x4 CreateSphereMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float radius )
|
||||
{
|
||||
return ::Oyster::Physics3D::Formula::MomentOfInertia::Sphere(mass, radius);
|
||||
}
|
||||
|
||||
inline ::Oyster::Math::Float4x4 CreateHollowSphereMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float radius )
|
||||
{
|
||||
return ::Oyster::Physics3D::Formula::MomentOfInertia::HollowSphere(mass, radius);
|
||||
}
|
||||
|
||||
inline ::Oyster::Math::Float4x4 CreateCuboidMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float height, const ::Oyster::Math::Float width, const ::Oyster::Math::Float depth )
|
||||
{
|
||||
return ::Oyster::Physics3D::Formula::MomentOfInertia::Cuboid(mass, height, width, depth);
|
||||
}
|
||||
|
||||
inline ::Oyster::Math::Float4x4 CreateCylinderMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float height, const ::Oyster::Math::Float radius )
|
||||
{
|
||||
return ::Oyster::Physics3D::Formula::MomentOfInertia::Cylinder(mass, height, radius);
|
||||
}
|
||||
|
||||
inline ::Oyster::Math::Float4x4 CreateRodMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float length )
|
||||
{
|
||||
return ::Oyster::Physics3D::Formula::MomentOfInertia::RodCenter(mass, length);
|
||||
}
|
||||
}
|
||||
|
||||
namespace CollisionResponse
|
||||
{
|
||||
inline ::Oyster::Math::Float Impulse( ::Oyster::Math::Float e, ::Oyster::Math::Float mA, ::Oyster::Math::Float gA, ::Oyster::Math::Float mB, ::Oyster::Math::Float gB )
|
||||
{
|
||||
return (e+1) * (mB*gA - mA*gB) / (mA + mB);
|
||||
}
|
||||
}
|
||||
} } }
|
||||
|
||||
#endif
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef PHYSICS_FORMULA_H
|
||||
#define PHYSICS_FORMULA_H
|
||||
|
||||
#include "OysterMath.h"
|
||||
|
||||
namespace Oyster { namespace Physics { namespace Formula
|
||||
{
|
||||
namespace MomentOfInertia
|
||||
{
|
||||
::Oyster::Math::Float4x4 CreateSphereMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float radius );
|
||||
::Oyster::Math::Float4x4 CreateHollowSphereMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float radius );
|
||||
::Oyster::Math::Float4x4 CreateCuboidMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float height, const ::Oyster::Math::Float width, const ::Oyster::Math::Float depth );
|
||||
::Oyster::Math::Float4x4 CreateCylinderMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float height, const ::Oyster::Math::Float radius );
|
||||
::Oyster::Math::Float4x4 CreateRodMatrix( const ::Oyster::Math::Float mass, const ::Oyster::Math::Float length );
|
||||
}
|
||||
|
||||
namespace CollisionResponse
|
||||
{
|
||||
::Oyster::Math::Float Impulse( ::Oyster::Math::Float coeffOfRestitution,
|
||||
::Oyster::Math::Float massA, ::Oyster::Math::Float momentumA,
|
||||
::Oyster::Math::Float massB, ::Oyster::Math::Float momentumB );
|
||||
}
|
||||
} } }
|
||||
|
||||
#include "PhysicsFormula-Impl.h"
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue