mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-07-05 19:55:51 +00:00
Merge branch 'master' of https://github.com/AxioDL/urde
This commit is contained in:
commit
9d62e7d9f1
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
version.h
|
version.h
|
||||||
*.user
|
*.user
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
*.autosave
|
||||||
|
@ -65,7 +65,7 @@ static const std::vector<FourCC> DecalTypes =
|
|||||||
SBIG('NCDL'),SBIG('DDCL'),SBIG('CODL'),SBIG('MEDL'),
|
SBIG('NCDL'),SBIG('DDCL'),SBIG('CODL'),SBIG('MEDL'),
|
||||||
SBIG('GRDL'),SBIG('ICDL'),SBIG('GODL'),SBIG('WODL'),
|
SBIG('GRDL'),SBIG('ICDL'),SBIG('GODL'),SBIG('WODL'),
|
||||||
SBIG('WTDL'),SBIG('3MUD'),SBIG('3LAV'),SBIG('3SAN'),
|
SBIG('WTDL'),SBIG('3MUD'),SBIG('3LAV'),SBIG('3SAN'),
|
||||||
SBIG('CHDL')
|
SBIG('CHDL'),SBIG('ENDL')
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ class CGameState
|
|||||||
{
|
{
|
||||||
int m_stateFlag = -1;
|
int m_stateFlag = -1;
|
||||||
CPlayerState m_playerState;
|
CPlayerState m_playerState;
|
||||||
CWorldTransManager m_transManager;
|
CWorldTransManager x9c_transManager;
|
||||||
float m_gameTime = 0.0;
|
float m_gameTime = 0.0;
|
||||||
CGameOptions m_gameOpts;
|
CGameOptions m_gameOpts;
|
||||||
double xa0_playTime;
|
double xa0_playTime;
|
||||||
@ -22,7 +22,7 @@ public:
|
|||||||
CGameState() {}
|
CGameState() {}
|
||||||
CGameState(CBitStreamReader& stream);
|
CGameState(CBitStreamReader& stream);
|
||||||
void SetCurrentWorldId(unsigned int id, const std::string& name);
|
void SetCurrentWorldId(unsigned int id, const std::string& name);
|
||||||
CWorldTransManager& WorldTransitionManager() {return m_transManager;}
|
CWorldTransManager& WorldTransitionManager() {return x9c_transManager;}
|
||||||
void SetTotalPlayTime(float time);
|
void SetTotalPlayTime(float time);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ add_library(RuntimeCommon
|
|||||||
${WORLD_SOURCES}
|
${WORLD_SOURCES}
|
||||||
#CMemory.hpp CMemory.cpp
|
#CMemory.hpp CMemory.cpp
|
||||||
CMemoryCardSys.hpp
|
CMemoryCardSys.hpp
|
||||||
|
CSaveWorld.hpp CSaveWorld.cpp
|
||||||
IAllocator.hpp IAllocator.cpp
|
IAllocator.hpp IAllocator.cpp
|
||||||
CGameAllocator.hpp CGameAllocator.cpp
|
CGameAllocator.hpp CGameAllocator.cpp
|
||||||
CDependencyGroup.hpp CDependencyGroup.cpp
|
CDependencyGroup.hpp CDependencyGroup.cpp
|
||||||
|
0
Runtime/CSaveWorld.cpp
Normal file
0
Runtime/CSaveWorld.cpp
Normal file
12
Runtime/CSaveWorld.hpp
Normal file
12
Runtime/CSaveWorld.hpp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#ifndef __URDE_CSAVEWORLD_HPP__
|
||||||
|
#define __URDE_CSAVEWORLD_HPP__
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
class CSaveWorld
|
||||||
|
{
|
||||||
|
CSaveWorld(CInputStream& in);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __URDE_CSAVEWORLD_HPP__
|
@ -1,6 +1,51 @@
|
|||||||
#include "CCollidableAABox.hpp"
|
#include "CCollidableAABox.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
const CCollisionPrimitive::Type CCollidableAABox::sType(CCollidableAABox::SetStaticTableIndex, "CCollidableAABox");
|
||||||
|
u32 CCollidableAABox::sTableIndex = -1;
|
||||||
|
|
||||||
CCollidableAABox::CCollidableAABox()
|
CCollidableAABox::CCollidableAABox()
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
zeus::CAABox CCollidableAABox::Transform(const zeus::CTransform& xf) const
|
||||||
|
{
|
||||||
|
return {xf.origin + x10_aabox.min, xf.origin + x10_aabox.max};
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 CCollidableAABox::GetTableIndex() const
|
||||||
|
{
|
||||||
|
return sTableIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
zeus::CAABox CCollidableAABox::CalculateAABox(const zeus::CTransform& xf) const
|
||||||
|
{
|
||||||
|
return Transform(xf);
|
||||||
|
}
|
||||||
|
|
||||||
|
zeus::CAABox CCollidableAABox::CalculateLocalAABox() const
|
||||||
|
{
|
||||||
|
return x10_aabox;
|
||||||
|
}
|
||||||
|
|
||||||
|
FourCC CCollidableAABox::GetPrimType() const
|
||||||
|
{
|
||||||
|
return SBIG('AABX');
|
||||||
|
}
|
||||||
|
|
||||||
|
CRayCastResult CCollidableAABox::CastRayInternal(const CInternalRayCastStructure &) const
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const CCollisionPrimitive::Type& CCollidableAABox::GetType()
|
||||||
|
{
|
||||||
|
return sType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCollidableAABox::SetStaticTableIndex(u32 index)
|
||||||
|
{
|
||||||
|
sTableIndex = index;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,35 @@
|
|||||||
#ifndef CCOLLIDABLEAABOX_HPP
|
#ifndef __URDE_CCOLLIDABLEAABOX_HPP__
|
||||||
#define CCOLLIDABLEAABOX_HPP
|
#define __URDE_CCOLLIDABLEAABOX_HPP__
|
||||||
|
|
||||||
|
#include "CCollisionPrimitive.hpp"
|
||||||
|
|
||||||
class CCollidableAABox
|
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;
|
||||||
|
static u32 sTableIndex;
|
||||||
|
|
||||||
|
zeus::CAABox x10_aabox;
|
||||||
public:
|
public:
|
||||||
CCollidableAABox();
|
CCollidableAABox();
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CCOLLIDABLEAABOX_HPP
|
zeus::CAABox Transform(const zeus::CTransform&) const;
|
||||||
|
virtual u32 GetTableIndex() const;
|
||||||
|
virtual zeus::CAABox CalculateAABox(const zeus::CTransform&) const;
|
||||||
|
virtual zeus::CAABox CalculateLocalAABox() const;
|
||||||
|
virtual FourCC GetPrimType() const;
|
||||||
|
virtual CRayCastResult CastRayInternal(const CInternalRayCastStructure&) const;
|
||||||
|
|
||||||
|
static const CCollisionPrimitive::Type& GetType();
|
||||||
|
static void SetStaticTableIndex(u32 index);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __URDE_CCOLLIDABLEAABOX_HPP__
|
||||||
|
17
Runtime/Collision/CCollidableCollisionSurface.cpp
Normal file
17
Runtime/Collision/CCollidableCollisionSurface.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include "CCollidableCollisionSurface.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
const CCollisionPrimitive::Type CCollidableCollisionSurface::sType(CCollidableCollisionSurface::SetStaticTableIndex, "CCollidableCollisionSurface");
|
||||||
|
u32 CCollidableCollisionSurface::sTableIndex = -1;
|
||||||
|
|
||||||
|
const CCollisionPrimitive::Type& CCollidableCollisionSurface::GetType()
|
||||||
|
{
|
||||||
|
return sType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCollidableCollisionSurface::SetStaticTableIndex(u32 index)
|
||||||
|
{
|
||||||
|
sTableIndex = index;
|
||||||
|
}
|
||||||
|
}
|
17
Runtime/Collision/CCollidableCollisionSurface.hpp
Normal file
17
Runtime/Collision/CCollidableCollisionSurface.hpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#ifndef __URDE_COLLIDABLECOLLISIONSURFACE_HPP__
|
||||||
|
#define __URDE_COLLIDABLECOLLISIONSURFACE_HPP__
|
||||||
|
|
||||||
|
#include "CCollisionPrimitive.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
class CCollidableCollisionSurface
|
||||||
|
{
|
||||||
|
static const CCollisionPrimitive::Type sType;
|
||||||
|
static u32 sTableIndex;
|
||||||
|
public:
|
||||||
|
static const CCollisionPrimitive::Type& GetType();
|
||||||
|
static void SetStaticTableIndex(u32 index);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#endif // __URDE_COLLIDABLECOLLISIONSURFACE_HPP__
|
@ -11,7 +11,7 @@ namespace urde
|
|||||||
{
|
{
|
||||||
class CCollidableOBBTreeGroup : public CCollisionPrimitive
|
class CCollidableOBBTreeGroup : public CCollisionPrimitive
|
||||||
{
|
{
|
||||||
static const CCollisionPrimitive::Type sType;
|
static const Type sType;
|
||||||
static u32 sTableIndex;
|
static u32 sTableIndex;
|
||||||
std::vector<std::unique_ptr<COBBTree>> x0_trees;
|
std::vector<std::unique_ptr<COBBTree>> x0_trees;
|
||||||
std::vector<zeus::CAABox> x10_aabbs;
|
std::vector<zeus::CAABox> x10_aabbs;
|
||||||
@ -26,7 +26,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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
43
Runtime/Collision/CCollidableSphere.cpp
Normal file
43
Runtime/Collision/CCollidableSphere.cpp
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#include "CCollidableSphere.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
const CCollisionPrimitive::Type CCollidableSphere::sType(CCollidableSphere::SetStaticTableIndex, "CCollidableSphere");
|
||||||
|
u32 CCollidableSphere::sTableIndex = -1;
|
||||||
|
|
||||||
|
u32 CCollidableSphere::GetTableIndex() const
|
||||||
|
{
|
||||||
|
return sTableIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
zeus::CAABox CCollidableSphere::CalculateAABox(const zeus::CTransform &) const
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
zeus::CAABox CCollidableSphere::CalculateLocalAABox() const
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
FourCC CCollidableSphere::GetPrimType() const
|
||||||
|
{
|
||||||
|
return SBIG('SPHR');
|
||||||
|
}
|
||||||
|
|
||||||
|
CRayCastResult CCollidableSphere::CastRayInternal(const CInternalRayCastStructure &) const
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const CCollisionPrimitive::Type& CCollidableSphere::GetType()
|
||||||
|
{
|
||||||
|
return sType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCollidableSphere::SetStaticTableIndex(u32 index)
|
||||||
|
{
|
||||||
|
sTableIndex = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
25
Runtime/Collision/CCollidableSphere.hpp
Normal file
25
Runtime/Collision/CCollidableSphere.hpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#ifndef __URDE_CCOLLIDALBESPHERE_HPP
|
||||||
|
#define __URDE_CCOLLIDALBESPHERE_HPP
|
||||||
|
|
||||||
|
#include "CCollisionPrimitive.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
class CCollidableSphere : public CCollisionPrimitive
|
||||||
|
{
|
||||||
|
static const Type sType;
|
||||||
|
static u32 sTableIndex;
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual u32 GetTableIndex() const;
|
||||||
|
virtual zeus::CAABox CalculateAABox(const zeus::CTransform&) const;
|
||||||
|
virtual zeus::CAABox CalculateLocalAABox() const;
|
||||||
|
virtual FourCC GetPrimType() const;
|
||||||
|
virtual CRayCastResult CastRayInternal(const CInternalRayCastStructure&) const;
|
||||||
|
|
||||||
|
static const Type& GetType();
|
||||||
|
static void SetStaticTableIndex(u32 index);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __URDE_CCOLLIDALBESPHERE_HPP
|
@ -0,0 +1,6 @@
|
|||||||
|
#include "CCollisionInfo.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -1,11 +1,14 @@
|
|||||||
#ifndef __URDE_CCOLLISIONINFO_HPP__
|
#ifndef __URDE_CCOLLISIONINFO_HPP__
|
||||||
#define __URDE_CCOLLISIONINFO_HPP__
|
#define __URDE_CCOLLISIONINFO_HPP__
|
||||||
|
|
||||||
|
#include "zeus/CAABox.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
class CMaterialList;
|
||||||
class CCollisionInfo
|
class CCollisionInfo
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
0
Runtime/Collision/CCollisionInfoList.cpp
Normal file
0
Runtime/Collision/CCollisionInfoList.cpp
Normal file
30
Runtime/Collision/CCollisionInfoList.hpp
Normal file
30
Runtime/Collision/CCollisionInfoList.hpp
Normal 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__
|
@ -1,9 +1,12 @@
|
|||||||
#include "CCollisionPrimitive.hpp"
|
#include "CCollisionPrimitive.hpp"
|
||||||
#include "CInternalRayCastStructure.hpp"
|
#include "CInternalRayCastStructure.hpp"
|
||||||
#include "CMaterialFilter.hpp"
|
#include "CMaterialFilter.hpp"
|
||||||
|
#include "InternalColliders.hpp"
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
@ -14,7 +17,7 @@ void CCollisionPrimitive::SetMaterial(const CMaterialList& material)
|
|||||||
x8_material = material;
|
x8_material = material;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CMaterialList&CCollisionPrimitive::GetMaterial() const
|
const CMaterialList& CCollisionPrimitive::GetMaterial() const
|
||||||
{
|
{
|
||||||
return x8_material;
|
return x8_material;
|
||||||
|
|
||||||
@ -26,4 +29,41 @@ CRayCastResult CCollisionPrimitive::CastRay(const zeus::CVector3f& start, const
|
|||||||
return CastRayInternal(CInternalRayCastStructure(start, end, d, xf, filter));
|
return CastRayInternal(CInternalRayCastStructure(start, end, d, xf, filter));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCollisionPrimitive::InitBeginTypes()
|
||||||
|
{
|
||||||
|
sCollisionTypeList.reset(new std::vector<CCollisionPrimitive::Type>());
|
||||||
|
sCollisionTypeList->reserve(3);
|
||||||
|
sTypesAdding = true;
|
||||||
|
InternalColliders::AddTypes();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCollisionPrimitive::InitAddType(const CCollisionPrimitive::Type& tp)
|
||||||
|
{
|
||||||
|
tp.GetSetter()(sCollisionTypeList->size());
|
||||||
|
|
||||||
|
sCollisionTypeList->reserve(sCollisionTypeList->size() + 1);
|
||||||
|
sCollisionTypeList->push_back(tp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCollisionPrimitive::InitEndTypes()
|
||||||
|
{
|
||||||
|
sTypesAdding = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CCollisionPrimitive::Type::Type(const std::function<void(u32)>& setter, const char *info)
|
||||||
|
: x0_setter(setter),
|
||||||
|
x4_info(info)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *CCollisionPrimitive::Type::GetInfo() const
|
||||||
|
{
|
||||||
|
return x4_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::function<void (u32)> CCollisionPrimitive::Type::GetSetter() const
|
||||||
|
{
|
||||||
|
return x0_setter;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,11 +11,20 @@ namespace urde
|
|||||||
{
|
{
|
||||||
|
|
||||||
class COBBTree;
|
class COBBTree;
|
||||||
|
class CInternalCollisionStructure;
|
||||||
|
class CCollisionInfo;
|
||||||
|
class CCollisionInfoList;
|
||||||
class CInternalRayCastStructure;
|
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
|
||||||
{
|
{
|
||||||
@ -23,21 +32,71 @@ public:
|
|||||||
const char* x4_info;
|
const char* x4_info;
|
||||||
public:
|
public:
|
||||||
Type() = default;
|
Type() = default;
|
||||||
Type(std::function<void(unsigned int)> setter, const char * info)
|
Type(const std::function<void(u32)>& setter, const char * info);
|
||||||
: x0_setter(setter),
|
|
||||||
x4_info(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)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* GetInfo() const
|
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)
|
||||||
{
|
{
|
||||||
return x4_info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::function<void(u32)> GetSetter() const
|
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)
|
||||||
{
|
{
|
||||||
return x0_setter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()=default;
|
||||||
@ -59,7 +118,10 @@ public:
|
|||||||
static void InitEndTypes();
|
static void InitEndTypes();
|
||||||
|
|
||||||
static void InitBeginColliders();
|
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();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
12
Runtime/Collision/CCollisionSurface.cpp
Normal file
12
Runtime/Collision/CCollisionSurface.cpp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include "CCollisionSurface.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
CCollisionSurface::CCollisionSurface(const zeus::CVector3f& a, const zeus::CVector3f& b, const zeus::CVector3f& c, u32 flags)
|
||||||
|
: x0_a(a),
|
||||||
|
xc_b(b),
|
||||||
|
x18_c(c),
|
||||||
|
x24_flags(flags)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
22
Runtime/Collision/CCollisionSurface.hpp
Normal file
22
Runtime/Collision/CCollisionSurface.hpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#ifndef __URDE_CCOLLISIONSURFACE_HPP__
|
||||||
|
#define __URDE_CCOLLISIONSURFACE_HPP__
|
||||||
|
|
||||||
|
#include "zeus/zeus.hpp"
|
||||||
|
#include "RetroTypes.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
class CCollisionSurface
|
||||||
|
{
|
||||||
|
zeus::CVector3f x0_a;
|
||||||
|
zeus::CVector3f xc_b;
|
||||||
|
zeus::CVector3f x18_c;
|
||||||
|
u32 x24_flags;
|
||||||
|
public:
|
||||||
|
CCollisionSurface(const zeus::CVector3f&, const zeus::CVector3f&, const zeus::CVector3f&, u32);
|
||||||
|
|
||||||
|
zeus::CVector3f GetPoint(u32) const;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __URDE_CCOLLISIONSURFACE_HPP__
|
@ -1 +1,13 @@
|
|||||||
#include "CMaterialFilter.hpp"
|
#include "CMaterialFilter.hpp"
|
||||||
|
#include "CGameCollision.hpp"
|
||||||
|
#include "CCollidableOBBTreeGroup.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
|
||||||
|
void CGameCollision::InitCollision()
|
||||||
|
{
|
||||||
|
CCollisionPrimitive::InitBeginTypes();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -24,7 +24,7 @@ public:
|
|||||||
const zeus::CMRay& GetRay() const { return x0_ray; }
|
const zeus::CMRay& GetRay() const { return x0_ray; }
|
||||||
const zeus::CVector3f& GetStart() const { return x0_ray.start; }
|
const zeus::CVector3f& GetStart() const { return x0_ray.start; }
|
||||||
const zeus::CVector3f& GetNormal() const { return x0_ray.normal; }
|
const zeus::CVector3f& GetNormal() const { return x0_ray.normal; }
|
||||||
float GetMaxTime() const { return 0.f; }
|
float GetMaxTime() const { return x38_maxTime; }
|
||||||
const zeus::CTransform& GetTransform() const { return x3c_xf; }
|
const zeus::CTransform& GetTransform() const { return x3c_xf; }
|
||||||
const CMaterialFilter& GetFilter() const { return x6c_filter; }
|
const CMaterialFilter& GetFilter() const { return x6c_filter; }
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,15 @@
|
|||||||
set(COLLISION_SOURCES
|
set(COLLISION_SOURCES
|
||||||
|
CollisionUtil.hpp CollisionUtil.cpp
|
||||||
CGameCollision.hpp CGameCollision.cpp
|
CGameCollision.hpp CGameCollision.cpp
|
||||||
CCollisionInfo.hpp CCollisionInfo.cpp
|
CCollisionInfo.hpp CCollisionInfo.cpp
|
||||||
|
CCollisionInfoList.hpp CCollisionInfoList.cpp
|
||||||
CCollisionEdge.hpp CCollisionEdge.cpp
|
CCollisionEdge.hpp CCollisionEdge.cpp
|
||||||
|
CCollisionSurface.hpp CCollisionSurface.cpp
|
||||||
|
InternalColliders.hpp InternalColliders.cpp
|
||||||
COBBTree.hpp COBBTree.cpp
|
COBBTree.hpp COBBTree.cpp
|
||||||
|
CCollidableAABox.hpp CCollidableAABox.cpp
|
||||||
|
CCollidableCollisionSurface.hpp CCollidableCollisionSurface.cpp
|
||||||
|
CCollidableSphere.hpp CCollidableSphere.cpp
|
||||||
CCollidableOBBTree.hpp CCollidableOBBTree.cpp
|
CCollidableOBBTree.hpp CCollidableOBBTree.cpp
|
||||||
CCollidableOBBTreeGroup.hpp CCollidableOBBTreeGroup.cpp
|
CCollidableOBBTreeGroup.hpp CCollidableOBBTreeGroup.cpp
|
||||||
CCollisionPrimitive.hpp CCollisionPrimitive.cpp
|
CCollisionPrimitive.hpp CCollisionPrimitive.cpp
|
||||||
|
@ -15,7 +15,9 @@ u32 verify_version(CInputStream& in)
|
|||||||
return in.readUint32Big();
|
return in.readUint32Big();
|
||||||
}
|
}
|
||||||
|
|
||||||
COBBTree::COBBTree(const COBBTree::SIndexData&, const COBBTree::CNode*)
|
COBBTree::COBBTree(const SIndexData& indexData, const CNode* root)
|
||||||
|
: x18_indexData(indexData),
|
||||||
|
x88_root((CNode*)root)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,6 +116,25 @@ const zeus::COBBox& COBBTree::CNode::GetOBB() const
|
|||||||
return x0_obb;
|
return x0_obb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t COBBTree::CNode::GetMemoryUsage() const
|
||||||
|
{
|
||||||
|
size_t ret = 0;
|
||||||
|
if (x3c_isLeaf)
|
||||||
|
ret = x48_leaf->GetMemoryUsage() + 80;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (x40_left)
|
||||||
|
ret = x40_left->GetMemoryUsage() + 80;
|
||||||
|
if (x44_right)
|
||||||
|
ret += x44_right->GetMemoryUsage();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(ret & 3))
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
return ret + ((ret & 3) - 4);
|
||||||
|
}
|
||||||
|
|
||||||
COBBTree::CLeafData::CLeafData(const std::vector<u16>& surface)
|
COBBTree::CLeafData::CLeafData(const std::vector<u16>& surface)
|
||||||
: x0_surface(surface)
|
: x0_surface(surface)
|
||||||
{
|
{
|
||||||
@ -124,6 +145,14 @@ const std::vector<u16>& COBBTree::CLeafData::GetSurfaceVector() const
|
|||||||
return x0_surface;
|
return x0_surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t COBBTree::CLeafData::GetMemoryUsage() const
|
||||||
|
{
|
||||||
|
size_t ret = (x0_surface.size() * 2) + 16;
|
||||||
|
if (!(ret & 3))
|
||||||
|
return ret;
|
||||||
|
return ret + ((ret & 3) - 4);
|
||||||
|
}
|
||||||
|
|
||||||
COBBTree::CLeafData::CLeafData(CInputStream& in)
|
COBBTree::CLeafData::CLeafData(CInputStream& in)
|
||||||
{
|
{
|
||||||
u32 edgeCount = in.readUint32Big();
|
u32 edgeCount = in.readUint32Big();
|
||||||
|
@ -32,6 +32,7 @@ public:
|
|||||||
CLeafData(CInputStream&);
|
CLeafData(CInputStream&);
|
||||||
|
|
||||||
const std::vector<u16>& GetSurfaceVector() const;
|
const std::vector<u16>& GetSurfaceVector() const;
|
||||||
|
size_t GetMemoryUsage() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CNode
|
class CNode
|
||||||
@ -48,11 +49,12 @@ public:
|
|||||||
CNode(CInputStream&);
|
CNode(CInputStream&);
|
||||||
|
|
||||||
bool WasHit() const;
|
bool WasHit() const;
|
||||||
void SetWasHit(bool) const;
|
void SetHit(bool) const;
|
||||||
CNode* GetLeft() const;
|
CNode* GetLeft() const;
|
||||||
CNode* GetRight() const;
|
CNode* GetRight() const;
|
||||||
CLeafData* GetLeafData() const;
|
CLeafData* GetLeafData() const;
|
||||||
const zeus::COBBox& GetOBB() const;
|
const zeus::COBBox& GetOBB() const;
|
||||||
|
size_t GetMemoryUsage() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
25
Runtime/Collision/CollisionUtil.cpp
Normal file
25
Runtime/Collision/CollisionUtil.cpp
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
16
Runtime/Collision/CollisionUtil.hpp
Normal file
16
Runtime/Collision/CollisionUtil.hpp
Normal 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__
|
17
Runtime/Collision/InternalColliders.cpp
Normal file
17
Runtime/Collision/InternalColliders.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include "InternalColliders.hpp"
|
||||||
|
#include "CCollidableAABox.hpp"
|
||||||
|
#include "CCollidableCollisionSurface.hpp"
|
||||||
|
#include "CCollidableSphere.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
namespace InternalColliders
|
||||||
|
{
|
||||||
|
void AddTypes()
|
||||||
|
{
|
||||||
|
CCollisionPrimitive::InitAddType(CCollidableAABox::GetType());
|
||||||
|
CCollisionPrimitive::InitAddType(CCollidableCollisionSurface::GetType());
|
||||||
|
CCollisionPrimitive::InitAddType(CCollidableSphere::GetType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Runtime/Collision/InternalColliders.hpp
Normal file
11
Runtime/Collision/InternalColliders.hpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#ifndef __URDE_INTERNALCOLLIDERS_HPP__
|
||||||
|
#define __URDE_INTERNALCOLLIDERS_HPP__
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
namespace InternalColliders
|
||||||
|
{
|
||||||
|
void AddTypes();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // __URDE_INTERNALCOLLIDERS_HPP__
|
@ -38,7 +38,7 @@ zeus::CVector3f CGuiCamera::ConvertToScreenSpace(const zeus::CVector3f& vec) con
|
|||||||
|
|
||||||
void CGuiCamera::Draw(const CGuiWidgetDrawParms& parms) const
|
void CGuiCamera::Draw(const CGuiWidgetDrawParms& parms) const
|
||||||
{
|
{
|
||||||
if (xf8_proj == Projection::Perspective)
|
if (xf8_proj == EProjection::Perspective)
|
||||||
CGraphics::SetPerspective(xfc_fov, x100_aspect, x104_znear, x108_zfar);
|
CGraphics::SetPerspective(xfc_fov, x100_aspect, x104_znear, x108_zfar);
|
||||||
else
|
else
|
||||||
CGraphics::SetOrtho(xfc_left, x100_right, x104_top, x108_bottom, x10c_znear, x110_zfar);
|
CGraphics::SetOrtho(xfc_left, x100_right, x104_top, x108_bottom, x10c_znear, x110_zfar);
|
||||||
@ -49,11 +49,11 @@ void CGuiCamera::Draw(const CGuiWidgetDrawParms& parms) const
|
|||||||
CGuiCamera* CGuiCamera::Create(CGuiFrame* frame, CInputStream& in, bool flag)
|
CGuiCamera* CGuiCamera::Create(CGuiFrame* frame, CInputStream& in, bool flag)
|
||||||
{
|
{
|
||||||
CGuiWidgetParms parms = ReadWidgetHeader(frame, in, flag);
|
CGuiWidgetParms parms = ReadWidgetHeader(frame, in, flag);
|
||||||
Projection proj = Projection(in.readUint32Big());
|
EProjection proj = EProjection(in.readUint32Big());
|
||||||
CGuiCamera* ret = nullptr;
|
CGuiCamera* ret = nullptr;
|
||||||
switch (proj)
|
switch (proj)
|
||||||
{
|
{
|
||||||
case Projection::Perspective:
|
case EProjection::Perspective:
|
||||||
{
|
{
|
||||||
float fov = in.readFloatBig();
|
float fov = in.readFloatBig();
|
||||||
float aspect = in.readFloatBig();
|
float aspect = in.readFloatBig();
|
||||||
@ -62,7 +62,7 @@ CGuiCamera* CGuiCamera::Create(CGuiFrame* frame, CInputStream& in, bool flag)
|
|||||||
ret = new CGuiCamera(parms, fov, aspect, znear, zfar);
|
ret = new CGuiCamera(parms, fov, aspect, znear, zfar);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Projection::Orthographic:
|
case EProjection::Orthographic:
|
||||||
{
|
{
|
||||||
float left = in.readFloatBig();
|
float left = in.readFloatBig();
|
||||||
float right = in.readFloatBig();
|
float right = in.readFloatBig();
|
||||||
|
@ -9,13 +9,13 @@ namespace urde
|
|||||||
class CGuiCamera : public CGuiWidget
|
class CGuiCamera : public CGuiWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum class Projection
|
enum class EProjection
|
||||||
{
|
{
|
||||||
Perspective,
|
Perspective,
|
||||||
Orthographic
|
Orthographic
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
Projection xf8_proj;
|
EProjection xf8_proj;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
|
@ -69,7 +69,7 @@ static const std::vector<FourCC> DecalTypes =
|
|||||||
SBIG('NCDL'),SBIG('DDCL'),SBIG('CODL'),SBIG('MEDL'),
|
SBIG('NCDL'),SBIG('DDCL'),SBIG('CODL'),SBIG('MEDL'),
|
||||||
SBIG('GRDL'),SBIG('ICDL'),SBIG('GODL'),SBIG('WODL'),
|
SBIG('GRDL'),SBIG('ICDL'),SBIG('GODL'),SBIG('WODL'),
|
||||||
SBIG('WTDL'),SBIG('3MUD'),SBIG('3LAV'),SBIG('3SAN'),
|
SBIG('WTDL'),SBIG('3MUD'),SBIG('3LAV'),SBIG('3SAN'),
|
||||||
SBIG('CHDL')
|
SBIG('CHDL'),SBIG('ENDL')
|
||||||
};
|
};
|
||||||
|
|
||||||
using CPF = CParticleDataFactory;
|
using CPF = CParticleDataFactory;
|
||||||
|
2
specter
2
specter
@ -1 +1 @@
|
|||||||
Subproject commit 4dff27e3c69b11d7fa8232c4b32d28089e524b57
|
Subproject commit 47a6e28db624f100e8cbc6ef11f3feba2a575ec7
|
Loading…
x
Reference in New Issue
Block a user