mirror of https://github.com/AxioDL/metaforce.git
More Collision imps
This commit is contained in:
parent
c66dac6df2
commit
d3563ea86d
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
const CCollisionPrimitive::Type CCollidableCollisionSurface::sType(CCollidableCollisionSurface::SetStaticTableIndex, "CCollidableCollisionSurface");
|
||||||
|
u32 CCollidableCollisionSurface::sTableIndex = -1;
|
||||||
|
|
||||||
const CCollisionPrimitive::Type& CCollidableCollisionSurface::GetType()
|
const CCollisionPrimitive::Type& CCollidableCollisionSurface::GetType()
|
||||||
{
|
{
|
||||||
return sType;
|
return sType;
|
||||||
|
|
|
@ -30,4 +30,14 @@ CRayCastResult CCollidableSphere::CastRayInternal(const CInternalRayCastStructur
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CCollisionPrimitive::Type& CCollidableSphere::GetType()
|
||||||
|
{
|
||||||
|
return sType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCollidableSphere::SetStaticTableIndex(u32 index)
|
||||||
|
{
|
||||||
|
sTableIndex = index;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ public:
|
||||||
virtual FourCC GetPrimType() const;
|
virtual FourCC GetPrimType() const;
|
||||||
virtual CRayCastResult CastRayInternal(const CInternalRayCastStructure&) const;
|
virtual CRayCastResult CastRayInternal(const CInternalRayCastStructure&) const;
|
||||||
|
|
||||||
static const CCollisionPrimitive::Type& GetType();
|
static const Type& GetType();
|
||||||
static void SetStaticTableIndex(u32 index);
|
static void SetStaticTableIndex(u32 index);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
std::unique_ptr<std::vector<CCollisionPrimitive::Type>> CCollisionPrimitive::sCollisionTypeList;
|
||||||
|
bool CCollisionPrimitive::sTypesAdding = false;
|
||||||
CCollisionPrimitive::CCollisionPrimitive(const CMaterialList& list)
|
CCollisionPrimitive::CCollisionPrimitive(const CMaterialList& list)
|
||||||
: x8_material(list)
|
: x8_material(list)
|
||||||
{
|
{
|
||||||
|
@ -29,17 +31,23 @@ CRayCastResult CCollisionPrimitive::CastRay(const zeus::CVector3f& start, const
|
||||||
|
|
||||||
void CCollisionPrimitive::InitBeginTypes()
|
void CCollisionPrimitive::InitBeginTypes()
|
||||||
{
|
{
|
||||||
|
sCollisionTypeList.reset(new std::vector<CCollisionPrimitive::Type>());
|
||||||
|
sCollisionTypeList->reserve(3);
|
||||||
|
sTypesAdding = true;
|
||||||
|
InternalColliders::AddTypes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCollisionPrimitive::InitAddType(const CCollisionPrimitive::Type& tp)
|
void CCollisionPrimitive::InitAddType(const CCollisionPrimitive::Type& tp)
|
||||||
{
|
{
|
||||||
|
tp.GetSetter()(sCollisionTypeList->size());
|
||||||
|
|
||||||
|
sCollisionTypeList->reserve(sCollisionTypeList->size() + 1);
|
||||||
|
sCollisionTypeList->push_back(tp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCollisionPrimitive::InitEndTypes()
|
void CCollisionPrimitive::InitEndTypes()
|
||||||
{
|
{
|
||||||
|
sTypesAdding = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CCollisionPrimitive::Type::Type(std::function<void (unsigned int)> setter, const char *info)
|
CCollisionPrimitive::Type::Type(std::function<void (unsigned int)> setter, const char *info)
|
||||||
|
|
|
@ -15,7 +15,13 @@ class CInternalRayCastStructure;
|
||||||
class CMaterialFilter;
|
class CMaterialFilter;
|
||||||
class CCollisionPrimitive
|
class CCollisionPrimitive
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
class Type;
|
||||||
|
private:
|
||||||
|
|
||||||
CMaterialList x8_material;
|
CMaterialList x8_material;
|
||||||
|
static std::unique_ptr<std::vector<Type>> sCollisionTypeList;
|
||||||
|
static bool sTypesAdding;
|
||||||
public:
|
public:
|
||||||
class Type
|
class Type
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue