mirror of https://github.com/PrimeDecomp/prime.git
Add CCollisionPrimitive
This commit is contained in:
parent
f24314aa02
commit
c1c2083bb4
|
@ -451,7 +451,7 @@ LIBS = [
|
|||
["Collision/CCollidableCollisionSurface", True],
|
||||
["Collision/CCollisionInfo", True],
|
||||
"Collision/InternalColliders",
|
||||
"Collision/CCollisionPrimitive",
|
||||
["Collision/CCollisionPrimitive", False],
|
||||
["Collision/CMaterialList", True],
|
||||
"Collision/CollisionUtil",
|
||||
"Collision/CCollidableSphere",
|
||||
|
|
|
@ -8,12 +8,22 @@
|
|||
#include "Kyoto/IObjectStore.hpp"
|
||||
#include "Kyoto/Math/CAABox.hpp"
|
||||
#include "Kyoto/Math/CTransform4f.hpp"
|
||||
#include "rstl/single_ptr.hpp"
|
||||
#include "rstl/vector.hpp"
|
||||
|
||||
class CRayCastResult;
|
||||
class CCollisionInfoList;
|
||||
class CInternalCollisionStructure;
|
||||
class CInternalRayCastStructure;
|
||||
class CCollisionInfo;
|
||||
|
||||
typedef void (*PrimitiveSetter)(uint);
|
||||
|
||||
typedef bool (*ComparisonFunc)(const CInternalCollisionStructure&, CCollisionInfoList&);
|
||||
typedef bool (*BooleanComparisonFunc)(const CInternalCollisionStructure&);
|
||||
typedef bool (*MovingComparisonFunc)(const CInternalCollisionStructure&, const CVector3f&, double&,
|
||||
CCollisionInfo&);
|
||||
|
||||
class CCollisionPrimitive {
|
||||
public:
|
||||
class Type {
|
||||
|
@ -22,6 +32,7 @@ public:
|
|||
|
||||
PrimitiveSetter GetSetter() const { return mSetter; }
|
||||
const char* GetInfo() const { return mInfo; }
|
||||
|
||||
private:
|
||||
PrimitiveSetter mSetter;
|
||||
const char* mInfo;
|
||||
|
@ -38,9 +49,26 @@ public:
|
|||
virtual ~CCollisionPrimitive();
|
||||
virtual CRayCastResult CastRayInternal(const CInternalRayCastStructure&) const = 0;
|
||||
|
||||
static void InitBeginTypes();
|
||||
static void InitAddType(const Type& type);
|
||||
static void InitEndTypes();
|
||||
static void Uninitialize();
|
||||
|
||||
private:
|
||||
static int sNumTypes;
|
||||
static bool sInitComplete;
|
||||
static bool sTypesAdded;
|
||||
static bool sTypesAdding;
|
||||
static bool sCollidersAdded;
|
||||
static bool sCollidersAdding;
|
||||
static rstl::single_ptr< rstl::vector< Type > > sCollisionTypeList;
|
||||
static rstl::single_ptr< ComparisonFunc > sTableOfCollidables;
|
||||
static rstl::single_ptr< BooleanComparisonFunc > sTableOfBooleanCollidables;
|
||||
static rstl::single_ptr< MovingComparisonFunc > sTableOfMovingCollidables;
|
||||
static ComparisonFunc sNullCollider;
|
||||
static BooleanComparisonFunc sNullBooleanCollider;
|
||||
static MovingComparisonFunc sNullMovingCollider;
|
||||
|
||||
uint x4_;
|
||||
CMaterialList x8_material;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
|
||||
namespace InternalColliders {
|
||||
void AddTypes();
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
#include "Collision/CCollisionPrimitive.hpp"
|
||||
#include "Collision/InternalColliders.hpp"
|
||||
|
||||
int CCollisionPrimitive::sNumTypes = 0;
|
||||
bool CCollisionPrimitive::sInitComplete = false;
|
||||
bool CCollisionPrimitive::sTypesAdded = false;
|
||||
bool CCollisionPrimitive::sTypesAdding = false;
|
||||
bool CCollisionPrimitive::sCollidersAdded = false;
|
||||
bool CCollisionPrimitive::sCollidersAdding = false;
|
||||
|
||||
rstl::single_ptr< rstl::vector< CCollisionPrimitive::Type > >
|
||||
CCollisionPrimitive::sCollisionTypeList;
|
||||
rstl::single_ptr< ComparisonFunc > CCollisionPrimitive::sTableOfCollidables;
|
||||
rstl::single_ptr< BooleanComparisonFunc > CCollisionPrimitive::sTableOfBooleanCollidables;
|
||||
rstl::single_ptr< MovingComparisonFunc > CCollisionPrimitive::sTableOfMovingCollidables;
|
||||
|
||||
CCollisionPrimitive::CCollisionPrimitive(const CMaterialList& list) : x8_material(list) {}
|
||||
|
||||
void CCollisionPrimitive::InitBeginTypes() {
|
||||
sCollisionTypeList = new rstl::vector< Type >();
|
||||
sCollisionTypeList->reserve(3);
|
||||
sTypesAdding = true;
|
||||
InternalColliders::AddTypes();
|
||||
}
|
||||
|
||||
void CCollisionPrimitive::InitAddType(const Type& type) {
|
||||
type.GetSetter()(sCollisionTypeList->size());
|
||||
sCollisionTypeList->reserve(sCollisionTypeList->size() + 1);
|
||||
sCollisionTypeList->push_back(type);
|
||||
}
|
||||
|
||||
void CCollisionPrimitive::InitEndTypes() {
|
||||
|
||||
}
|
Loading…
Reference in New Issue