Implemented a custom physics engine #316
|
@ -260,6 +260,8 @@ namespace SHADE
|
|||
case 1: return y;
|
||||
case 2: return z;
|
||||
case 3: return w;
|
||||
// This will never hit
|
||||
default: return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,6 +276,8 @@ namespace SHADE
|
|||
case 1: return y;
|
||||
case 2: return z;
|
||||
case 3: return w;
|
||||
// This will never hit
|
||||
default: return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -288,6 +292,8 @@ namespace SHADE
|
|||
case 1: return y;
|
||||
case 2: return z;
|
||||
case 3: return w;
|
||||
// This will never hit
|
||||
default: return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -302,6 +308,8 @@ namespace SHADE
|
|||
case 1: return y;
|
||||
case 2: return z;
|
||||
case 3: return w;
|
||||
// This will never hit
|
||||
default: return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,16 +44,6 @@ namespace SHADE
|
|||
: XMFLOAT4( _x, _y, _z, _w )
|
||||
{}
|
||||
|
||||
SHQuaternion::SHQuaternion(const reactphysics3d::Vector3& rp3dEuler) noexcept
|
||||
: XMFLOAT4( 0.0f, 0.0f, 0.0f, 1.0f )
|
||||
{
|
||||
XMStoreFloat4(this, XMQuaternionRotationRollPitchYawFromVector(SHVec3 { rp3dEuler }));
|
||||
}
|
||||
|
||||
SHQuaternion::SHQuaternion(const reactphysics3d::Quaternion& rp3dQuat) noexcept
|
||||
: XMFLOAT4( rp3dQuat.x, rp3dQuat.y, rp3dQuat.z, rp3dQuat.w )
|
||||
{}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Operator Overload Definitions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
@ -141,16 +131,6 @@ namespace SHADE
|
|||
return XMQuaternionNotEqual(*this, rhs);
|
||||
}
|
||||
|
||||
SHQuaternion::operator reactphysics3d::Quaternion() const noexcept
|
||||
{
|
||||
return reactphysics3d::Quaternion{ x, y, z, w };
|
||||
}
|
||||
|
||||
SHQuaternion::operator reactphysics3d::Vector3() const noexcept
|
||||
{
|
||||
return reactphysics3d::Vector3{ ToEuler() };
|
||||
}
|
||||
|
||||
SHQuaternion::operator XMVECTOR() const noexcept
|
||||
{
|
||||
return XMLoadFloat4(this);
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <DirectXMath.h>
|
||||
#include <reactphysics3d/mathematics/Quaternion.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
|
@ -52,11 +51,6 @@ namespace SHADE
|
|||
SHQuaternion (const SHVec4& vec4) noexcept;
|
||||
SHQuaternion (float x, float y, float z, float w) noexcept;
|
||||
|
||||
// Conversion from other math types
|
||||
|
||||
SHQuaternion (const reactphysics3d::Vector3& rp3dEuler) noexcept;
|
||||
SHQuaternion (const reactphysics3d::Quaternion& rp3dQuat) noexcept;
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Operator Overloads */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
@ -82,8 +76,6 @@ namespace SHADE
|
|||
|
||||
// Conversion to other math types used by SHADE
|
||||
|
||||
operator reactphysics3d::Quaternion () const noexcept;
|
||||
operator reactphysics3d::Vector3 () const noexcept;
|
||||
operator DirectX::XMVECTOR () const noexcept;
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
|
|
@ -30,12 +30,6 @@ namespace SHADE
|
|||
, direction { dir }
|
||||
{}
|
||||
|
||||
SHRay::SHRay(const reactphysics3d::Ray rp3dRay) noexcept
|
||||
: position { rp3dRay.point1 }
|
||||
, direction { SHVec3::Normalise(rp3dRay.point2 - rp3dRay.point1) }
|
||||
{}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Operator Overload Definitions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
@ -62,12 +56,6 @@ namespace SHADE
|
|||
return XMVector3NotEqual(LHS_POS, RHS_POS) || XMVector3NotEqual(LHS_DIR, RHS_DIR);
|
||||
}
|
||||
|
||||
SHRay::operator reactphysics3d::Ray() const noexcept
|
||||
{
|
||||
// We use 2km. Temp solution.
|
||||
return reactphysics3d::Ray{ position, position + (direction * MAX_RAYCAST_DIST) };
|
||||
}
|
||||
|
||||
SHRaycastResult::operator bool() const noexcept
|
||||
{
|
||||
return hit;
|
||||
|
|
|
@ -10,10 +10,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <reactphysics3d/mathematics/Ray.h>
|
||||
|
||||
// Project Headers
|
||||
#include "SH_API.h"
|
||||
#include "Vector/SHVec3.h"
|
||||
|
||||
namespace SHADE
|
||||
|
@ -40,7 +37,6 @@ namespace SHADE
|
|||
|
||||
SHRay () noexcept;
|
||||
SHRay (const SHVec3& pos, const SHVec3& dir) noexcept;
|
||||
SHRay (const reactphysics3d::Ray rp3dRay) noexcept;
|
||||
|
||||
SHRay (const SHRay&) noexcept = default;
|
||||
SHRay (SHRay&& ) noexcept = default;
|
||||
|
@ -55,8 +51,6 @@ namespace SHADE
|
|||
|
||||
[[nodiscard]] bool operator==(const SHRay& rhs) const noexcept;
|
||||
[[nodiscard]] bool operator!=(const SHRay& rhs) const noexcept;
|
||||
|
||||
operator reactphysics3d::Ray() const noexcept;
|
||||
};
|
||||
|
||||
struct SH_API SHRaycastResult
|
||||
|
|
|
@ -50,10 +50,6 @@ namespace SHADE
|
|||
: XMFLOAT2( _x, _y )
|
||||
{}
|
||||
|
||||
SHVec2::SHVec2(const reactphysics3d::Vector2& rp3dVec2) noexcept
|
||||
: XMFLOAT2( rp3dVec2.x, rp3dVec2.y )
|
||||
{}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Operator Overload Definitions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
@ -165,6 +161,8 @@ namespace SHADE
|
|||
{
|
||||
case 0: return x;
|
||||
case 1: return y;
|
||||
// This will never hit
|
||||
default: return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,6 +175,8 @@ namespace SHADE
|
|||
{
|
||||
case 0: return x;
|
||||
case 1: return y;
|
||||
// This will never hit
|
||||
default: return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,6 +189,8 @@ namespace SHADE
|
|||
{
|
||||
case 0: return x;
|
||||
case 1: return y;
|
||||
// This will never hit
|
||||
default: return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,14 +203,11 @@ namespace SHADE
|
|||
{
|
||||
case 0: return x;
|
||||
case 1: return y;
|
||||
// This will never hit
|
||||
default: return x;
|
||||
}
|
||||
}
|
||||
|
||||
SHVec2::operator reactphysics3d::Vector2() const noexcept
|
||||
{
|
||||
return reactphysics3d::Vector2{ x, y };
|
||||
}
|
||||
|
||||
SHVec2 operator* (float lhs, const SHVec2& rhs) noexcept
|
||||
{
|
||||
SHVec2 result;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <DirectXMath.h>
|
||||
#include <reactphysics3d/mathematics/Vector2.h>
|
||||
|
||||
#include <string>
|
||||
#include <initializer_list>
|
||||
|
@ -59,10 +58,6 @@ namespace SHADE
|
|||
SHVec2 (float n) noexcept;
|
||||
SHVec2 (float x, float y) noexcept;
|
||||
|
||||
// Conversion from other math types to SHADE
|
||||
|
||||
SHVec2 (const reactphysics3d::Vector2& rp3dVec2) noexcept;
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Operator Overloads */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
@ -73,7 +68,6 @@ namespace SHADE
|
|||
// Conversion to other math types used by SHADE
|
||||
|
||||
operator DirectX::XMVECTOR () const noexcept;
|
||||
operator reactphysics3d::Vector2 () const noexcept;
|
||||
|
||||
SHVec2& operator+= (const SHVec2& rhs) noexcept;
|
||||
SHVec2& operator-= (const SHVec2& rhs) noexcept;
|
||||
|
|
|
@ -57,14 +57,6 @@ namespace SHADE
|
|||
: XMFLOAT3( _x, _y, _z )
|
||||
{}
|
||||
|
||||
SHVec3::SHVec3(const reactphysics3d::Vector3& rp3dVec3) noexcept
|
||||
: XMFLOAT3( rp3dVec3.x, rp3dVec3.y, rp3dVec3.z )
|
||||
{}
|
||||
|
||||
SHVec3::SHVec3(const reactphysics3d::Quaternion& rp3dVec3) noexcept
|
||||
: XMFLOAT3( SHQuaternion{rp3dVec3}.ToEuler() )
|
||||
{}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Operator Overload Definitions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
@ -179,6 +171,8 @@ namespace SHADE
|
|||
case 0: return x;
|
||||
case 1: return y;
|
||||
case 2: return z;
|
||||
// This will never hit
|
||||
default: return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,6 +186,8 @@ namespace SHADE
|
|||
case 0: return x;
|
||||
case 1: return y;
|
||||
case 2: return z;
|
||||
// This will never hit
|
||||
default: return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,6 +201,8 @@ namespace SHADE
|
|||
case 0: return x;
|
||||
case 1: return y;
|
||||
case 2: return z;
|
||||
// This will never hit
|
||||
default: return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,19 +216,11 @@ namespace SHADE
|
|||
case 0: return x;
|
||||
case 1: return y;
|
||||
case 2: return z;
|
||||
// This will never hit
|
||||
default: return x;
|
||||
}
|
||||
}
|
||||
|
||||
SHVec3::operator reactphysics3d::Vector3() const noexcept
|
||||
{
|
||||
return reactphysics3d::Vector3{ x, y , z };
|
||||
}
|
||||
|
||||
SHVec3::operator reactphysics3d::Quaternion() const noexcept
|
||||
{
|
||||
return reactphysics3d::Quaternion::fromEulerAngles(x, y, z);
|
||||
}
|
||||
|
||||
SHVec3 operator* (float lhs, const SHVec3& rhs) noexcept
|
||||
{
|
||||
SHVec3 result;
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <DirectXMath.h>
|
||||
#include <reactphysics3d/mathematics/Vector3.h>
|
||||
#include <reactphysics3d/mathematics/Quaternion.h>
|
||||
|
||||
#include <string>
|
||||
#include <initializer_list>
|
||||
|
@ -69,9 +67,6 @@ namespace SHADE
|
|||
|
||||
// Conversion from other math types to SHADE
|
||||
|
||||
SHVec3 (const reactphysics3d::Vector3& rp3dVec3) noexcept;
|
||||
SHVec3 (const reactphysics3d::Quaternion& rp3dVec3) noexcept;
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Operator Overloads */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
@ -81,8 +76,6 @@ namespace SHADE
|
|||
|
||||
// Conversion to other math types used by SHADE
|
||||
|
||||
operator reactphysics3d::Vector3 () const noexcept;
|
||||
operator reactphysics3d::Quaternion () const noexcept;
|
||||
operator DirectX::XMVECTOR () const noexcept;
|
||||
|
||||
SHVec3& operator+= (const SHVec3& rhs) noexcept;
|
||||
|
|
|
@ -164,6 +164,8 @@ namespace SHADE
|
|||
case 1: return y;
|
||||
case 2: return z;
|
||||
case 3: return w;
|
||||
// This will never hit
|
||||
default: return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -178,6 +180,8 @@ namespace SHADE
|
|||
case 1: return y;
|
||||
case 2: return z;
|
||||
case 3: return w;
|
||||
// This will never hit
|
||||
default: return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,6 +196,8 @@ namespace SHADE
|
|||
case 1: return y;
|
||||
case 2: return z;
|
||||
case 3: return w;
|
||||
// This will never hit
|
||||
default: return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -206,6 +212,8 @@ namespace SHADE
|
|||
case 1: return y;
|
||||
case 2: return z;
|
||||
case 3: return w;
|
||||
// This will never hit
|
||||
default: return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue