2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-04-17 22:38:05 +00:00
|
|
|
|
2019-09-28 02:53:03 +00:00
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "Runtime/CFactoryMgr.hpp"
|
|
|
|
#include "Runtime/IOStreams.hpp"
|
|
|
|
#include "Runtime/Collision/COBBTree.hpp"
|
|
|
|
#include "Runtime/Collision/CCollisionPrimitive.hpp"
|
|
|
|
|
|
|
|
#include <zeus/CAABox.hpp>
|
|
|
|
#include <zeus/CVector3f.hpp>
|
2016-04-27 00:26:02 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2018-12-08 05:30:43 +00:00
|
|
|
class CCollidableOBBTreeGroupContainer {
|
|
|
|
friend class CCollidableOBBTreeGroup;
|
|
|
|
std::vector<std::unique_ptr<COBBTree>> x0_trees;
|
|
|
|
std::vector<zeus::CAABox> x10_aabbs;
|
|
|
|
zeus::CAABox x20_aabox;
|
|
|
|
|
2017-03-03 22:13:23 +00:00
|
|
|
public:
|
2020-03-31 03:52:22 +00:00
|
|
|
explicit CCollidableOBBTreeGroupContainer(CInputStream& in);
|
2018-12-08 05:30:43 +00:00
|
|
|
CCollidableOBBTreeGroupContainer(const zeus::CVector3f&, const zeus::CVector3f&);
|
2021-03-07 09:41:56 +00:00
|
|
|
u32 NumTrees() const { return x0_trees.size(); }
|
2017-03-03 22:13:23 +00:00
|
|
|
};
|
2017-01-04 04:08:30 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CCollidableOBBTreeGroup : public CCollisionPrimitive {
|
2020-08-01 09:31:23 +00:00
|
|
|
static inline u32 sTableIndex = UINT32_MAX;
|
2018-12-08 05:30:43 +00:00
|
|
|
const CCollidableOBBTreeGroupContainer* x10_container;
|
|
|
|
|
2016-04-20 21:44:18 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
CCollidableOBBTreeGroup(const CCollidableOBBTreeGroupContainer*, const CMaterialList&);
|
2019-08-09 19:46:49 +00:00
|
|
|
~CCollidableOBBTreeGroup() override = default;
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
void ResetTestStats() 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;
|
2021-03-07 09:41:56 +00:00
|
|
|
COBBTree const* GetOBBTreeAABox(int index) const { return x10_container->x0_trees[index].get(); }
|
|
|
|
CCollidableOBBTreeGroupContainer const* GetContainer() const { return x10_container; }
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
static const Type& GetType();
|
|
|
|
static void SetStaticTableIndex(u32 index);
|
|
|
|
/* Sphere Collide */
|
|
|
|
static bool SphereCollide(const CInternalCollisionStructure&, CCollisionInfoList&);
|
|
|
|
static bool SphereCollideBoolean(const CInternalCollisionStructure&);
|
|
|
|
static bool CollideMovingSphere(const CInternalCollisionStructure&, const zeus::CVector3f&, double&, CCollisionInfo&);
|
|
|
|
/* AABox Collide */
|
|
|
|
static bool AABoxCollide(const CInternalCollisionStructure&, CCollisionInfoList&);
|
|
|
|
static bool AABoxCollideBoolean(const CInternalCollisionStructure&);
|
|
|
|
static bool CollideMovingAABox(const CInternalCollisionStructure&, const zeus::CVector3f&, double&, CCollisionInfo&);
|
2016-04-17 22:38:05 +00:00
|
|
|
};
|
|
|
|
|
2017-01-04 04:08:30 +00:00
|
|
|
CFactoryFnReturn FCollidableOBBTreeGroupFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms,
|
2016-09-02 19:32:57 +00:00
|
|
|
CObjectReference* selfRef);
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|