2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-06-24 20:09:38 +00:00
|
|
|
|
2019-09-28 02:53:03 +00:00
|
|
|
#include "Runtime/Collision/CCollisionPrimitive.hpp"
|
|
|
|
|
|
|
|
#include <zeus/CSphere.hpp>
|
|
|
|
#include <zeus/CVector3f.hpp>
|
2016-06-24 20:09:38 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
|
|
|
namespace Collide {
|
2017-01-04 04:08:30 +00:00
|
|
|
bool Sphere_AABox(const CInternalCollisionStructure&, CCollisionInfoList&);
|
|
|
|
bool Sphere_AABox_Bool(const CInternalCollisionStructure&);
|
|
|
|
bool Sphere_Sphere(const CInternalCollisionStructure&, CCollisionInfoList&);
|
|
|
|
bool Sphere_Sphere_Bool(const CInternalCollisionStructure&);
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace Collide
|
2019-10-29 20:12:20 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CCollidableSphere : public CCollisionPrimitive {
|
2020-08-01 09:31:23 +00:00
|
|
|
static inline u32 sTableIndex = UINT32_MAX;
|
2016-06-24 20:09:38 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
zeus::CSphere x10_sphere;
|
2017-03-01 03:42:06 +00:00
|
|
|
|
2017-01-04 04:08:30 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
CCollidableSphere(const zeus::CSphere&, const CMaterialList&);
|
|
|
|
|
|
|
|
const zeus::CSphere& GetSphere() const { return x10_sphere; }
|
|
|
|
void SetSphereCenter(const zeus::CVector3f& center) { x10_sphere.position = center; }
|
2019-11-12 20:25:21 +00:00
|
|
|
void SetSphereRadius(float radius) { x10_sphere.radius = radius; }
|
2018-12-08 05:30:43 +00:00
|
|
|
zeus::CSphere Transform(const zeus::CTransform& xf) const;
|
|
|
|
|
2019-08-09 19:46:49 +00:00
|
|
|
u32 GetTableIndex() const override;
|
|
|
|
zeus::CAABox CalculateAABox(const zeus::CTransform&) const override;
|
|
|
|
zeus::CAABox CalculateLocalAABox() const override;
|
|
|
|
FourCC GetPrimType() const override;
|
|
|
|
CRayCastResult CastRayInternal(const CInternalRayCastStructure&) const override;
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2019-10-29 20:12:20 +00:00
|
|
|
static const Type& GetType();
|
2018-12-08 05:30:43 +00:00
|
|
|
static void SetStaticTableIndex(u32 index) { sTableIndex = index; }
|
|
|
|
static bool CollideMovingAABox(const CInternalCollisionStructure&, const zeus::CVector3f&, double&, CCollisionInfo&);
|
|
|
|
static bool CollideMovingSphere(const CInternalCollisionStructure&, const zeus::CVector3f&, double&, CCollisionInfo&);
|
|
|
|
static bool Sphere_AABox_Bool(const zeus::CSphere& sphere, const zeus::CAABox& aabb);
|
2016-06-24 20:09:38 +00:00
|
|
|
};
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde
|