From 5cb4c547571144e94955cc89e9b7bbc30200b91b Mon Sep 17 00:00:00 2001 From: Diren D Bharwani Date: Fri, 3 Mar 2023 21:16:44 +0800 Subject: [PATCH] I didn't commit the change oop --- .../Physics/Collision/Narrowphase/SHConvexVsConvex.cpp | 8 ++++---- .../Physics/Collision/Narrowphase/SHSphereVsConvex.cpp | 8 ++++---- .../Physics/Collision/Narrowphase/SHSphereVsSphere.cpp | 8 ++++---- SHADE_Engine/src/Physics/Collision/SHCollider.cpp | 4 ++-- SHADE_Engine/src/Physics/Collision/SHCollisionSpace.cpp | 4 ++-- SHADE_Managed/src/Components/Collider.h++ | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/SHADE_Engine/src/Physics/Collision/Narrowphase/SHConvexVsConvex.cpp b/SHADE_Engine/src/Physics/Collision/Narrowphase/SHConvexVsConvex.cpp index 4d12b716..8c7ffc5e 100644 --- a/SHADE_Engine/src/Physics/Collision/Narrowphase/SHConvexVsConvex.cpp +++ b/SHADE_Engine/src/Physics/Collision/Narrowphase/SHConvexVsConvex.cpp @@ -47,8 +47,8 @@ namespace SHADE bool SHCollision::ConvexVsConvex(const SHCollisionShape& A, const SHCollisionShape& B) noexcept { - const SHConvexPolyhedron& POLY_A = dynamic_cast(A); - const SHConvexPolyhedron& POLY_B = dynamic_cast(B); + const SHConvexPolyhedron& POLY_A = reinterpret_cast(A); + const SHConvexPolyhedron& POLY_B = reinterpret_cast(B); const SHCollisionUtils::SHCollisionUtils::FaceQuery FACE_QUERY_A = queryFaceDirections(POLY_A, POLY_B); if (FACE_QUERY_A.bestDistance > 0.0f) @@ -70,8 +70,8 @@ namespace SHADE static constexpr float ABSOLUTE_TOLERANCE = 0.01f; static constexpr float RELATIVE_TOLERANCE = 0.95f; - const SHConvexPolyhedron& POLY_A = dynamic_cast(A); - const SHConvexPolyhedron& POLY_B = dynamic_cast(B); + const SHConvexPolyhedron& POLY_A = reinterpret_cast(A); + const SHConvexPolyhedron& POLY_B = reinterpret_cast(B); const SHCollisionUtils::ShapeTransform TF_A { POLY_A.GetWorldCentroid(), POLY_A.GetWorldOrientation() }; const SHCollisionUtils::ShapeTransform TF_B { POLY_B.GetWorldCentroid(), POLY_B.GetWorldOrientation() }; diff --git a/SHADE_Engine/src/Physics/Collision/Narrowphase/SHSphereVsConvex.cpp b/SHADE_Engine/src/Physics/Collision/Narrowphase/SHSphereVsConvex.cpp index 68217d8b..cb6e4a37 100644 --- a/SHADE_Engine/src/Physics/Collision/Narrowphase/SHSphereVsConvex.cpp +++ b/SHADE_Engine/src/Physics/Collision/Narrowphase/SHSphereVsConvex.cpp @@ -42,8 +42,8 @@ namespace SHADE bool SHCollision::SphereVsConvex(const SHCollisionShape& A, const SHCollisionShape& B) noexcept { - const SHSphere& SPHERE = dynamic_cast(A); - const SHConvexPolyhedron& POLYHEDRON = dynamic_cast(B); + const SHSphere& SPHERE = reinterpret_cast(A); + const SHConvexPolyhedron& POLYHEDRON = reinterpret_cast(B); const SHVec3 CENTER = SPHERE.Center; const float RADIUS = SPHERE.GetWorldRadius(); @@ -90,8 +90,8 @@ namespace SHADE { // Convert to underlying types // For the convex, we only need the convex polyhedron shape since the get vertex is pure virtual. - const SHSphere& SPHERE = dynamic_cast(A); - const SHConvexPolyhedron& POLY = dynamic_cast(B); + const SHSphere& SPHERE = reinterpret_cast(A); + const SHConvexPolyhedron& POLY = reinterpret_cast(B); const SHVec3 CENTER = SPHERE.Center; const float RADIUS = SPHERE.GetWorldRadius(); diff --git a/SHADE_Engine/src/Physics/Collision/Narrowphase/SHSphereVsSphere.cpp b/SHADE_Engine/src/Physics/Collision/Narrowphase/SHSphereVsSphere.cpp index caf974dc..cfd2bf16 100644 --- a/SHADE_Engine/src/Physics/Collision/Narrowphase/SHSphereVsSphere.cpp +++ b/SHADE_Engine/src/Physics/Collision/Narrowphase/SHSphereVsSphere.cpp @@ -26,8 +26,8 @@ namespace SHADE bool SHCollision::SphereVsSphere(const SHCollisionShape& A, const SHCollisionShape& B) noexcept { - const SHSphere& SPHERE_A = dynamic_cast(A); - const SHSphere& SPHERE_B = dynamic_cast(B); + const SHSphere& SPHERE_A = reinterpret_cast(A); + const SHSphere& SPHERE_B = reinterpret_cast(B); const SHVec3 CENTER_A = SPHERE_A.Center; const float RADIUS_A = SPHERE_A.Radius; @@ -48,8 +48,8 @@ namespace SHADE bool SHCollision::SphereVsSphere(SHManifold& manifold, const SHCollisionShape& A, const SHCollisionShape& B) noexcept { // Convert to underlying types - const SHSphere& SPHERE_A = dynamic_cast(A); - const SHSphere& SPHERE_B = dynamic_cast(B); + const SHSphere& SPHERE_A = reinterpret_cast(A); + const SHSphere& SPHERE_B = reinterpret_cast(B); const SHVec3 CENTER_A = SPHERE_A.Center; const float RADIUS_A = SPHERE_A.Radius; diff --git a/SHADE_Engine/src/Physics/Collision/SHCollider.cpp b/SHADE_Engine/src/Physics/Collision/SHCollider.cpp index 2e7cc3c6..994a61ed 100644 --- a/SHADE_Engine/src/Physics/Collision/SHCollider.cpp +++ b/SHADE_Engine/src/Physics/Collision/SHCollider.cpp @@ -338,7 +338,7 @@ namespace SHADE { case SHCollisionShape::Type::BOX: { - const SHBox* RHS_BOX = dynamic_cast(shape); + const SHBox* RHS_BOX = reinterpret_cast(shape); const SHBoxCreateInfo BOX_CREATE_INFO { @@ -361,7 +361,7 @@ namespace SHADE } case SHCollisionShape::Type::SPHERE: { - const SHSphere* RHS_SPHERE = dynamic_cast(shape); + const SHSphere* RHS_SPHERE = reinterpret_cast(shape); const SHSphereCreateInfo SPHERE_CREATE_INFO { diff --git a/SHADE_Engine/src/Physics/Collision/SHCollisionSpace.cpp b/SHADE_Engine/src/Physics/Collision/SHCollisionSpace.cpp index c643e05e..8be6786c 100644 --- a/SHADE_Engine/src/Physics/Collision/SHCollisionSpace.cpp +++ b/SHADE_Engine/src/Physics/Collision/SHCollisionSpace.cpp @@ -209,12 +209,12 @@ namespace SHADE { case SHCollisionShape::Type::SPHERE: { - baseResult = dynamic_cast(SHAPE)->Raycast(info.ray); + baseResult = reinterpret_cast(SHAPE)->Raycast(info.ray); break; } case SHCollisionShape::Type::BOX: { - baseResult = dynamic_cast(SHAPE)->Raycast(info.ray); + baseResult = reinterpret_cast(SHAPE)->Raycast(info.ray); break; } case SHCollisionShape::Type::CAPSULE: diff --git a/SHADE_Managed/src/Components/Collider.h++ b/SHADE_Managed/src/Components/Collider.h++ index c2e732f4..7d9fdca1 100644 --- a/SHADE_Managed/src/Components/Collider.h++ +++ b/SHADE_Managed/src/Components/Collider.h++ @@ -31,7 +31,7 @@ namespace SHADE if (!shape || shape->GetType() == SHCollisionShape::Type::INVALID) throw gcnew System::InvalidOperationException("Attempted to retrieve invalid CollisionShape."); - return dynamic_cast(*shape); + return reinterpret_cast(*shape); } catch (std::invalid_argument&) {