Implemented a custom physics engine #316

Merged
direnbharwani merged 95 commits from SHPhysics into main 2023-01-23 15:55:45 +08:00
1 changed files with 43 additions and 10 deletions
Showing only changes of commit 50de3a8ef0 - Show all commits

View File

@ -84,21 +84,54 @@ namespace SHADE
// Sphere VS Convex // Sphere VS Convex
static FaceQuery findClosestFace (const SHSphereCollisionShape& sphere, const SHConvexPolyhedronCollisionShape& polyhedron) noexcept; static FaceQuery findClosestFace
static int32_t findClosestPoint (const SHSphereCollisionShape& sphere, const SHConvexPolyhedronCollisionShape& polyhedron, int32_t faceIndex) noexcept; (
static int32_t findVoronoiRegion (const SHSphereCollisionShape& sphere, const SHVec3& faceVertex, const SHVec3& faceNormal, const SHVec3& tangent1, const SHVec3& tangent2) noexcept; const SHSphereCollisionShape& sphere
, const SHConvexPolyhedronCollisionShape& polyhedron
static bool isMinkowskiFace(const SHVec3& a, const SHVec3& b, const SHVec3& c, const SHVec3& d) noexcept; ) noexcept;
// TODO: buildMinkowskiFace, queryEdgeDirection, distanceBetweenTwoEdges, static int32_t findClosestPoint
(
const SHSphereCollisionShape& sphere
, const SHConvexPolyhedronCollisionShape& polyhedron
, int32_t faceIndex
) noexcept;
static int32_t findVoronoiRegion
(
const SHSphereCollisionShape& sphere
, const SHVec3& faceVertex
, const SHVec3& faceNormal
, const SHVec3& tangent1
, const SHVec3& tangent2
) noexcept;
// Capsule VS Convex
// TODO: Capsule VS Convex uses the same gauss map optimisation as convex vs convex
// Convex VS Convex
static bool isMinkowskiFace
(
const SHVec3& a
, const SHVec3& b
, const SHVec3& c
, const SHVec3& d
) noexcept;
/* /*
* TODO: * TODO:
* static FaceQuery queryFaceDirections (const SHCollisionShape& A, const SHCollisionShape& B) noexcept; * static FaceQuery queryFaceDirections (const SHConvexPolyhedron& A, const SHConvexPolyhedron& B) noexcept;
* static EdgeQuery queryEdgeDirections (const SHCollisionShape& A, const SHCollisionShape& B) noexcept; * static EdgeQuery queryEdgeDirections (const SHConvexPolyhedron& A, const SHConvexPolyhedron& B) noexcept;
* static bool buildMinkowskiFace (const SHHalfEdge& edgeA, const SHHalfEdge& edgeB) noexcept; * static bool buildMinkowskiFace (const SHConvexPolyhedron::HalfEdge& edgeA, const SHConvexPolyhedron::HalfEdge& edgeB) noexcept;
* static float distanceBetweenEdges(const SHHalfEdge& edgeA, const SHHalfEdge& edgeB, SHCollisionShape& poly) noexcept; * static float distanceBetweenEdges(const SHConvexPolyhedron::HalfEdge& edgeA, const SHConvexPolyhedron::HalfEdge& edgeB, SHConvexPolyhedron& poly) noexcept;
* static uint32_t clip * static int32_t findIncidentFace (SHConvexPolyhedron& poly, const SHVec3& normal) noexcept;
* static uint32_t clip [sutherland-hodgemann clipping]
* *
* ! References * ! References
* https://ia801303.us.archive.org/30/items/GDC2013Gregorius/GDC2013-Gregorius.pdf * https://ia801303.us.archive.org/30/items/GDC2013Gregorius/GDC2013-Gregorius.pdf