2016-04-20 21:44:18 +00:00
|
|
|
#include "CCollidableOBBTreeGroup.hpp"
|
2016-04-27 00:26:02 +00:00
|
|
|
#include "CCollidableOBBTree.hpp"
|
2016-04-20 21:44:18 +00:00
|
|
|
#include "CToken.hpp"
|
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
2016-04-27 00:26:02 +00:00
|
|
|
const CCollisionPrimitive::Type CCollidableOBBTreeGroup::sType(CCollidableOBBTreeGroup::SetStaticTableIndex, "CCollidableOBBTreeGroup");
|
|
|
|
u32 CCollidableOBBTreeGroup::sTableIndex = -1;
|
2016-04-20 21:44:18 +00:00
|
|
|
|
2017-03-03 22:13:23 +00:00
|
|
|
CCollidableOBBTreeGroupContainer::CCollidableOBBTreeGroupContainer(CInputStream& in)
|
2016-04-20 21:44:18 +00:00
|
|
|
{
|
2016-04-26 10:40:56 +00:00
|
|
|
u32 treeCount = in.readUint32Big();
|
|
|
|
x0_trees.reserve(treeCount);
|
|
|
|
|
|
|
|
for (u32 i = 0 ; i < treeCount ; i++)
|
2016-04-27 00:26:02 +00:00
|
|
|
{
|
|
|
|
std::unique_ptr<COBBTree> tree(new COBBTree(in));
|
|
|
|
x0_trees.push_back(std::move(tree));
|
|
|
|
}
|
|
|
|
|
|
|
|
x10_aabbs.reserve(x0_trees.size());
|
|
|
|
|
|
|
|
for (const std::unique_ptr<COBBTree>& tree : x0_trees)
|
|
|
|
x10_aabbs.push_back(CCollidableOBBTree(tree.get(), CMaterialList()).CalculateLocalAABox());
|
|
|
|
}
|
|
|
|
|
2017-03-03 22:13:23 +00:00
|
|
|
CCollidableOBBTreeGroupContainer::CCollidableOBBTreeGroupContainer(const zeus::CVector3f &, const zeus::CVector3f &)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CCollidableOBBTreeGroup::CCollidableOBBTreeGroup(const CCollidableOBBTreeGroupContainer* container,
|
|
|
|
const CMaterialList& matList)
|
|
|
|
: CCollisionPrimitive(matList)
|
|
|
|
, x10_container(container)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-04-27 19:59:38 +00:00
|
|
|
void CCollidableOBBTreeGroup::ResetTestStats() const
|
2016-04-27 00:26:02 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-04-27 19:59:38 +00:00
|
|
|
u32 CCollidableOBBTreeGroup::GetTableIndex() const
|
2016-04-27 00:26:02 +00:00
|
|
|
{
|
2016-04-27 19:59:38 +00:00
|
|
|
return sTableIndex;
|
|
|
|
}
|
2016-04-27 00:26:02 +00:00
|
|
|
|
2016-04-27 19:59:38 +00:00
|
|
|
zeus::CAABox CCollidableOBBTreeGroup::CalculateAABox(const zeus::CTransform& xf) const
|
|
|
|
{
|
2017-03-03 22:13:23 +00:00
|
|
|
return x10_container->x20_aabox.getTransformedAABox(xf);
|
2016-04-27 00:26:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
zeus::CAABox CCollidableOBBTreeGroup::CalculateLocalAABox() const
|
|
|
|
{
|
2017-03-03 22:13:23 +00:00
|
|
|
return x10_container->x20_aabox;
|
2016-04-27 00:26:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FourCC CCollidableOBBTreeGroup::GetPrimType() const
|
|
|
|
{
|
|
|
|
return SBIG('OBTG');
|
|
|
|
}
|
|
|
|
|
|
|
|
CRayCastResult CCollidableOBBTreeGroup::CastRayInternal(const CInternalRayCastStructure&) const
|
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return {};
|
2016-04-27 00:26:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const CCollisionPrimitive::Type& CCollidableOBBTreeGroup::GetType()
|
|
|
|
{
|
|
|
|
return sType;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCollidableOBBTreeGroup::SetStaticTableIndex(u32 index)
|
|
|
|
{
|
|
|
|
sTableIndex = index;
|
2016-04-20 21:44:18 +00:00
|
|
|
}
|
|
|
|
|
2017-01-04 04:08:30 +00:00
|
|
|
bool CCollidableOBBTreeGroup::SphereCollide(const CInternalCollisionStructure &, CCollisionInfoList &)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CCollidableOBBTreeGroup::SphereCollideBoolean(const CInternalCollisionStructure &)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CCollidableOBBTreeGroup::CollideMovingSphere(const CInternalCollisionStructure &, const zeus::CVector3f &, double &, CCollisionInfo &)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CCollidableOBBTreeGroup::AABoxCollide(const CInternalCollisionStructure &, CCollisionInfoList &)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CCollidableOBBTreeGroup::AABoxCollideBoolean(const CInternalCollisionStructure &)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CCollidableOBBTreeGroup::CollideMovingAABox(const CInternalCollisionStructure &, const zeus::CVector3f &, double &, CCollisionInfo &)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-09-02 19:32:57 +00:00
|
|
|
CFactoryFnReturn FCollidableOBBTreeGroupFactory(const SObjectTag &tag, CInputStream& in,
|
|
|
|
const CVParamTransfer& vparms,
|
|
|
|
CObjectReference* selfRef)
|
2016-04-20 21:44:18 +00:00
|
|
|
{
|
2017-03-03 22:13:23 +00:00
|
|
|
return TToken<CCollidableOBBTreeGroupContainer>::GetIObjObjectFor(std::make_unique<CCollidableOBBTreeGroupContainer>(in));
|
2016-04-20 21:44:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|