2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-06-26 01:11:09 +00:00
|
|
|
|
2019-09-28 02:53:03 +00:00
|
|
|
#include "Runtime/GCNTypes.hpp"
|
|
|
|
#include "Runtime/Collision/CMaterialList.hpp"
|
|
|
|
|
|
|
|
#include <zeus/CAABox.hpp>
|
|
|
|
#include <zeus/CMRay.hpp>
|
|
|
|
#include <zeus/COBBox.hpp>
|
|
|
|
#include <zeus/CSphere.hpp>
|
|
|
|
#include <zeus/CVector3f.hpp>
|
2016-06-26 01:11:09 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
2017-06-18 01:58:13 +00:00
|
|
|
class CCollisionInfoList;
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace CollisionUtil {
|
2016-06-26 01:11:09 +00:00
|
|
|
bool LineIntersectsOBBox(const zeus::COBBox&, const zeus::CMRay&, float&);
|
2017-07-03 03:34:19 +00:00
|
|
|
u32 RayAABoxIntersection(const zeus::CMRay&, const zeus::CAABox&, float&, float&);
|
2017-06-26 01:36:31 +00:00
|
|
|
u32 RayAABoxIntersection(const zeus::CMRay&, const zeus::CAABox&, zeus::CVector3f&, float&);
|
|
|
|
u32 RayAABoxIntersection_Double(const zeus::CMRay&, const zeus::CAABox&, zeus::CVector3f&, double&);
|
2017-06-30 01:39:34 +00:00
|
|
|
bool RaySphereIntersection_Double(const zeus::CSphere&, const zeus::CVector3f&, const zeus::CVector3f&, double&);
|
2018-12-08 05:30:43 +00:00
|
|
|
bool RaySphereIntersection(const zeus::CSphere& sphere, const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
2017-06-18 01:58:13 +00:00
|
|
|
float mag, float& T, zeus::CVector3f& point);
|
2017-06-26 01:36:31 +00:00
|
|
|
bool RayTriangleIntersection_Double(const zeus::CVector3f& point, const zeus::CVector3f& dir,
|
2020-04-06 10:02:49 +00:00
|
|
|
const std::array<zeus::CVector3f, 3>& verts, double& d);
|
|
|
|
bool RayTriangleIntersection(const zeus::CVector3f& point, const zeus::CVector3f& dir,
|
|
|
|
const std::array<zeus::CVector3f, 3>& verts, float& d);
|
2017-06-18 01:58:13 +00:00
|
|
|
void FilterOutBackfaces(const zeus::CVector3f& vec, const CCollisionInfoList& in, CCollisionInfoList& out);
|
2017-06-19 07:00:50 +00:00
|
|
|
void FilterByClosestNormal(const zeus::CVector3f& norm, const CCollisionInfoList& in, CCollisionInfoList& out);
|
2018-12-08 05:30:43 +00:00
|
|
|
bool AABoxAABoxIntersection(const zeus::CAABox& aabb0, const CMaterialList& list0, const zeus::CAABox& aabb1,
|
|
|
|
const CMaterialList& list1, CCollisionInfoList& infoList);
|
2017-06-18 01:58:13 +00:00
|
|
|
bool AABoxAABoxIntersection(const zeus::CAABox& aabb0, const zeus::CAABox& aabb1);
|
2017-06-24 04:58:59 +00:00
|
|
|
bool TriBoxOverlap(const zeus::CVector3f& boxcenter, const zeus::CVector3f& boxhalfsize,
|
2018-12-08 05:30:43 +00:00
|
|
|
const zeus::CVector3f& trivert0, const zeus::CVector3f& trivert1, const zeus::CVector3f& trivert2);
|
|
|
|
double TriPointSqrDist(const zeus::CVector3f& point, const zeus::CVector3f& trivert0, const zeus::CVector3f& trivert1,
|
2017-06-30 01:39:34 +00:00
|
|
|
const zeus::CVector3f& trivert2, float* baryX, float* baryY);
|
2018-12-08 05:30:43 +00:00
|
|
|
bool TriSphereOverlap(const zeus::CSphere& sphere, const zeus::CVector3f& trivert0, const zeus::CVector3f& trivert1,
|
2017-06-30 01:39:34 +00:00
|
|
|
const zeus::CVector3f& trivert2);
|
2018-12-08 05:30:43 +00:00
|
|
|
bool TriSphereIntersection(const zeus::CSphere& sphere, const zeus::CVector3f& trivert0,
|
|
|
|
const zeus::CVector3f& trivert1, const zeus::CVector3f& trivert2, zeus::CVector3f& point,
|
|
|
|
zeus::CVector3f& normal);
|
|
|
|
bool BoxLineTest(const zeus::CAABox& aabb, const zeus::CVector3f& point, const zeus::CVector3f& dir, float& tMin,
|
|
|
|
float& tMax, int& axis, bool& sign);
|
2017-07-01 03:23:49 +00:00
|
|
|
bool LineCircleIntersection2d(const zeus::CVector3f& point, const zeus::CVector3f& dir, const zeus::CSphere& sphere,
|
|
|
|
int axis1, int axis2, float& d);
|
2018-12-08 05:30:43 +00:00
|
|
|
bool MovingSphereAABox(const zeus::CSphere& sphere, const zeus::CAABox& aabb, const zeus::CVector3f& dir, double& d,
|
|
|
|
zeus::CVector3f& point, zeus::CVector3f& normal);
|
|
|
|
bool AABox_AABox_Moving(const zeus::CAABox& aabb0, const zeus::CAABox& aabb1, const zeus::CVector3f& dir, double& d,
|
|
|
|
zeus::CVector3f& point, zeus::CVector3f& normal);
|
2018-04-26 21:12:20 +00:00
|
|
|
void AddAverageToFront(const CCollisionInfoList& in, CCollisionInfoList& out);
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace CollisionUtil
|
|
|
|
} // namespace urde
|