More collision stubs

Add *.autosave to gitignore
Update specter
This commit is contained in:
Phillip Stephens 2016-06-25 18:11:09 -07:00
parent d3563ea86d
commit f470b7de93
12 changed files with 159 additions and 5 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
version.h
*.user
.DS_Store
*.autosave

View File

@ -5,6 +5,12 @@
namespace urde
{
namespace Collide
{
bool AABox_AABox(const CInternalCollisionStructure&, CCollisionInfoList&);
bool AABox_AABox_Bool(const CInternalCollisionStructure&, CCollisionInfoList&);
}
class CCollidableAABox : public CCollisionPrimitive
{
static const Type sType;

View File

@ -0,0 +1,6 @@
#include "CCollisionInfo.hpp"
namespace urde
{
}

View File

@ -1,11 +1,14 @@
#ifndef __URDE_CCOLLISIONINFO_HPP__
#define __URDE_CCOLLISIONINFO_HPP__
#include "zeus/CAABox.hpp"
namespace urde
{
class CMaterialList;
class CCollisionInfo
{
public:
};
}

View File

View File

@ -0,0 +1,30 @@
#ifndef __URDE_CCOLLISIONINFOLIST_HPP__
#define __URDE_CCOLLISIONINFOLIST_HPP__
#include "RetroTypes.hpp"
namespace urde
{
class CCollisionInfo;
class CCollisionInfoList
{
rstl::reserved_vector<CCollisionInfo, 32> x0_list;
public:
CCollisionInfoList() = default;
void GetAverageLeftNormal() const;
void GetAveragePoint() const;
void GetUnionOfAllLeftMaterials() const;
s32 GetCount() const;
void Swap(s32);
void Add(const CCollisionInfo&, bool);
void Clear();
void End();
void End() const;
void Begin();
void Begin() const;
};
}
#endif // __URDE_CCOLLISIONINFOLIST_HPP__

View File

@ -50,7 +50,7 @@ void CCollisionPrimitive::InitEndTypes()
sTypesAdding = false;
}
CCollisionPrimitive::Type::Type(std::function<void (unsigned int)> setter, const char *info)
CCollisionPrimitive::Type::Type(const std::function<void(u32)>& setter, const char *info)
: x0_setter(setter),
x4_info(info)
{

View File

@ -11,6 +11,9 @@ namespace urde
{
class COBBTree;
class CInternalCollisionStructure;
class CCollisionInfo;
class CCollisionInfoList;
class CInternalRayCastStructure;
class CMaterialFilter;
class CCollisionPrimitive
@ -29,13 +32,73 @@ public:
const char* x4_info;
public:
Type() = default;
Type(std::function<void(unsigned int)> setter, const char * info);
Type(const std::function<void(u32)>& setter, const char * info);
const char* GetInfo() const;
std::function<void(u32)> GetSetter() const;
};
class Comparison
{
std::function<bool(const CInternalCollisionStructure&, CCollisionInfoList&)> x0_collider;
const char* x4_type1;
const char* x8_type2;
public:
Comparison(const std::function<bool(const CInternalCollisionStructure&, CCollisionInfoList&)>& collider,
const char* type1, const char* type2)
: x0_collider(collider),
x4_type1(type1),
x8_type2(type2)
{
}
std::function<bool(const CInternalCollisionStructure&, CCollisionInfoList&)> GetCollider() const { return x0_collider; }
const char* GetType1() const { return x4_type1; }
const char* GetType2() const { return x8_type2; }
};
class MovingComparison
{
std::function<bool(const CInternalCollisionStructure&, const zeus::CVector2f&, double&,
CCollisionInfo&)> x0_collider;
const char* x4_type1;
const char* x8_type2;
public:
MovingComparison(const std::function<bool(const CInternalCollisionStructure&, const zeus::CVector2f&, double&,
CCollisionInfo&)>& collider, const char* type1, const char* type2)
: x0_collider(collider),
x4_type1(type1),
x8_type2(type2)
{
}
std::function<bool(const CInternalCollisionStructure&, const zeus::CVector2f&, double&,
CCollisionInfo&)> GetCollider() const { return x0_collider; }
const char* GetType1() const { return x4_type1; }
const char* GetType2() const { return x8_type2; }
};
class BooleanComparison
{
std::function<bool(const CInternalCollisionStructure&)> x0_collider;
const char* x4_type1;
const char* x8_type2;
public:
BooleanComparison(const std::function<bool(const CInternalCollisionStructure&)>& collider, const char* type1,
const char* type2)
: x0_collider(collider),
x4_type1(type1),
x8_type2(type2)
{
}
std::function<bool(const CInternalCollisionStructure&)> GetCollider() const { return x0_collider; }
const char* GetType1() const { return x4_type1; }
const char* GetType2() const { return x8_type2; }
};
CCollisionPrimitive()=default;
CCollisionPrimitive(const CMaterialList& list);
virtual u32 GetTableIndex() const=0;
@ -55,7 +118,9 @@ public:
static void InitEndTypes();
static void InitBeginColliders();
static void InitAddCollider(const Type& tp);
static void InitAddBooleanCollider(const BooleanComparison& cmp);
static void InitAddMovingCollider(const MovingComparison& cmp);
static void InitAddCollider(const Comparison& cmp);
static void InitEndColliders();
};

View File

@ -1,6 +1,8 @@
set(COLLISION_SOURCES
CollisionUtil.hpp CollisionUtil.cpp
CGameCollision.hpp CGameCollision.cpp
CCollisionInfo.hpp CCollisionInfo.cpp
CCollisionInfoList.hpp CCollisionInfoList.cpp
CCollisionEdge.hpp CCollisionEdge.cpp
CCollisionSurface.hpp CCollisionSurface.cpp
InternalColliders.hpp InternalColliders.cpp

View File

@ -0,0 +1,25 @@
#include "CollisionUtil.hpp"
namespace urde
{
namespace CollisionUtil
{
bool LineIntersectsOBBox(const zeus::COBBox& obb, const zeus::CMRay& ray, float& d)
{
const zeus::CVector3f transXf = obb.transform.toMatrix4f().vec[0].toVec3f();
return RayAABoxIntersection(ray.getInvUnscaledTransformRay(obb.transform), {-obb.extents, obb.extents},
transXf, d);
}
u32 RayAABoxIntersection(const zeus::CMRay& ray, const zeus::CAABox& box, const zeus::CVector3f&, float& d)
{
return 0;
}
u32 RaySphereIntersection_Double(const zeus::CSphere&, const zeus::CVector3f &, const zeus::CVector3f &, double &)
{
return 0;
}
}
}

View File

@ -0,0 +1,16 @@
#ifndef __URDE_COLLISIONUTIL_HPP__
#define __URDE_COLLISIONUTIL_HPP__
#include "GCNTypes.hpp"
#include "zeus/zeus.hpp"
namespace urde
{
namespace CollisionUtil
{
bool LineIntersectsOBBox(const zeus::COBBox&, const zeus::CMRay&, float&);
u32 RayAABoxIntersection(const zeus::CMRay&, const zeus::CAABox&, const zeus::CVector3f&, float&);
u32 RaySphereIntersection_Double(const zeus::CSphere&, const zeus::CVector3f&, const zeus::CVector3f&, double&);
}
}
#endif // __URDE_COLLISIONUTIL_HPP__

@ -1 +1 @@
Subproject commit 4dff27e3c69b11d7fa8232c4b32d28089e524b57
Subproject commit 47a6e28db624f100e8cbc6ef11f3feba2a575ec7