mirror of https://github.com/AxioDL/metaforce.git
Initial CCollidableOBBTreeGroup imps
This commit is contained in:
parent
460f4ade35
commit
bacc98d4a6
|
@ -94,7 +94,7 @@ struct MREA
|
|||
Value<float> q;
|
||||
Value<float> spotCutoff;
|
||||
Value<float> unk5;
|
||||
Value<atUint8> unk6;
|
||||
Value<bool> castShadows;
|
||||
Value<float> unk7;
|
||||
Value<Falloff> falloff;
|
||||
Value<float> unk9;
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
#include "CCollidableAABox.hpp"
|
||||
|
||||
CCollidableAABox::CCollidableAABox()
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef CCOLLIDABLEAABOX_HPP
|
||||
#define CCOLLIDABLEAABOX_HPP
|
||||
|
||||
|
||||
class CCollidableAABox
|
||||
{
|
||||
public:
|
||||
CCollidableAABox();
|
||||
};
|
||||
|
||||
#endif // CCOLLIDABLEAABOX_HPP
|
|
@ -1,4 +1,5 @@
|
|||
#include "CCollidableOBBTreeGroup.hpp"
|
||||
#include "COBBTree.hpp"
|
||||
#include "CToken.hpp"
|
||||
|
||||
namespace urde
|
||||
|
@ -6,6 +7,11 @@ namespace urde
|
|||
|
||||
CCollidableOBBTreeGroup::CCollidableOBBTreeGroup(CInputStream& in)
|
||||
{
|
||||
u32 treeCount = in.readUint32Big();
|
||||
x0_trees.reserve(treeCount);
|
||||
|
||||
for (u32 i = 0 ; i < treeCount ; i++)
|
||||
x0_trees.push_back(in);
|
||||
}
|
||||
|
||||
CFactoryFnReturn FCollidableOBBTreeGroupFactory(const SObjectTag &tag, CInputStream &in,
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
|
||||
#include "IOStreams.hpp"
|
||||
#include "CFactoryMgr.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class COBBTree;
|
||||
class CCollidableOBBTreeGroup
|
||||
{
|
||||
std::vector<COBBTree> x0_trees;
|
||||
public:
|
||||
CCollidableOBBTreeGroup(CInputStream& in);
|
||||
};
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
#include "CCollisionEdge.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
CCollisionEdge::CCollisionEdge(CInputStream& in)
|
||||
{
|
||||
x0_index1 = in.readUint16Big();
|
||||
x2_index2 = in.readUint16Big();
|
||||
}
|
||||
|
||||
u16 CCollisionEdge::GetVertIndex1() const
|
||||
{
|
||||
return x0_index1;
|
||||
}
|
||||
|
||||
u16 CCollisionEdge::GetVertIndex2() const
|
||||
{
|
||||
return x2_index2;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef __URDE_CCOLLISIONEDGE_HPP__
|
||||
#define __URDE_CCOLLISIONEDGE_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CCollisionEdge
|
||||
{
|
||||
u16 x0_index1 = -1;
|
||||
u16 x2_index2 = -1;
|
||||
public:
|
||||
CCollisionEdge()=default;
|
||||
CCollisionEdge(CInputStream&);
|
||||
|
||||
u16 GetVertIndex1() const;
|
||||
u16 GetVertIndex2() const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __URDE_CCOLLISIONEDGE_HPP__
|
|
@ -1,6 +1,8 @@
|
|||
set(COLLISION_SOURCES
|
||||
CGameCollision.hpp CGameCollision.cpp
|
||||
CCollisionInfo.hpp CCollisionInfo.cpp
|
||||
CCollisionEdge.hpp CCollisionEdge.cpp
|
||||
COBBTree.hpp COBBTree.cpp
|
||||
CCollidableOBBTree.hpp CCollidableOBBTree.cpp
|
||||
CCollidableOBBTreeGroup.hpp CCollidableOBBTreeGroup.cpp
|
||||
CMaterialList.hpp
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
#include "COBBTree.hpp"
|
||||
|
||||
|
||||
namespace urde
|
||||
{
|
||||
/* This is exactly what retro did >.< */
|
||||
u32 verify_deaf_babe(CInputStream& in)
|
||||
{
|
||||
return in.readUint32Big();
|
||||
}
|
||||
|
||||
/* This is exactly what retro did >.< */
|
||||
u32 verify_version(CInputStream& in)
|
||||
{
|
||||
return in.readUint32Big();
|
||||
}
|
||||
|
||||
COBBTree::COBBTree(const COBBTree::SIndexData&, const COBBTree::CNode*)
|
||||
{
|
||||
}
|
||||
|
||||
COBBTree::COBBTree(CInputStream& in)
|
||||
: x0_magic(verify_deaf_babe(in)),
|
||||
x4_version(verify_version(in)),
|
||||
x8_memsize(in.readUint32()),
|
||||
x18_indexData(in)
|
||||
{
|
||||
}
|
||||
|
||||
COBBTree::SIndexData::SIndexData(CInputStream& in)
|
||||
{
|
||||
u32 count = in.readUint32Big();
|
||||
x0_.reserve(count);
|
||||
for (u32 i = 0 ; i < count ; i++)
|
||||
x0_.push_back(in.readUint32Big());
|
||||
|
||||
count = in.readUint32Big();
|
||||
for (u32 i = 0 ; i < count ; i++)
|
||||
x10_.push_back(in.readUByte());
|
||||
count = in.readUint32Big();
|
||||
for (u32 i = 0 ; i < count ; i++)
|
||||
x20_.push_back(in.readUByte());
|
||||
count = in.readUint32Big();
|
||||
for (u32 i = 0 ; i < count ; i++)
|
||||
x30_.push_back(in.readUByte());
|
||||
|
||||
count = in.readUint32Big();
|
||||
for (u32 i = 0 ; i < count ; i++)
|
||||
x40_.push_back(in);
|
||||
|
||||
count = in.readUint32Big();
|
||||
for (u32 i = 0 ; i < count ; i++)
|
||||
x50_.push_back(in.readUint16Big());
|
||||
|
||||
count = in.readUint32Big();
|
||||
for (u32 i = 0 ; i < count ; i++)
|
||||
x60_.push_back(zeus::CVector3f::ReadBig(in));
|
||||
}
|
||||
|
||||
COBBTree::CNode::CNode(CInputStream& in)
|
||||
{
|
||||
x0_obb = zeus::COBBox::ReadBig(in);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
#ifndef __URDE_COBBTREE_HPP__
|
||||
#define __URDE_COBBTREE_HPP__
|
||||
#include "RetroTypes.hpp"
|
||||
#include "CCollisionEdge.hpp"
|
||||
#include "zeus/CVector3f.hpp"
|
||||
#include "zeus/COBBox.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class COBBTree
|
||||
{
|
||||
public:
|
||||
struct SIndexData
|
||||
{
|
||||
std::vector<u32> x0_;
|
||||
std::vector<u8> x10_;
|
||||
std::vector<u8> x20_;
|
||||
std::vector<u8> x30_;
|
||||
std::vector<CCollisionEdge> x40_;
|
||||
std::vector<u16> x50_;
|
||||
std::vector<zeus::CVector3f> x60_;
|
||||
SIndexData()=default;
|
||||
SIndexData(CInputStream&);
|
||||
};
|
||||
|
||||
class CNodeLeafData
|
||||
{
|
||||
};
|
||||
|
||||
class CNode
|
||||
{
|
||||
zeus::COBBox x0_obb;
|
||||
bool x3c_ = false;
|
||||
std::unique_ptr<CNode> x40_;
|
||||
std::unique_ptr<CNode> x44_;
|
||||
std::unique_ptr<CNodeLeafData> x48_;
|
||||
public:
|
||||
CNode() = default;
|
||||
CNode(CInputStream&);
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
u32 x0_magic = 0;
|
||||
u32 x4_version = 0;
|
||||
u32 x8_memsize = 0;
|
||||
/* CSimpleAllocator xc_ We're not using this but lets keep track*/
|
||||
SIndexData x18_indexData;
|
||||
std::unique_ptr<CNode> x88_root;
|
||||
public:
|
||||
|
||||
|
||||
COBBTree(const COBBTree::SIndexData&, const CNode*);
|
||||
COBBTree(CInputStream&);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __URDE_COBBTREE_HPP__
|
|
@ -1,5 +1,6 @@
|
|||
set(WORLD_SOURCES
|
||||
CWorld.hpp CWorld.cpp
|
||||
CWorldLight.hpp CWorldLight.cpp
|
||||
IGameArea.hpp IGameArea.cpp
|
||||
CGameArea.hpp CGameArea.cpp
|
||||
CAi.hpp CAi.cpp
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
#include "CWorldLight.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
CWorldLight::CWorldLight(CInputStream& in)
|
||||
: x0_type(ELightType(in.readUint32Big())),
|
||||
x4_color(zeus::CVector3f::ReadBig(in)),
|
||||
x10_position(zeus::CVector3f::ReadBig(in)),
|
||||
x1c_direction(zeus::CVector3f::ReadBig(in)),
|
||||
x28_q(in.readFloatBig()),
|
||||
x2c_cutoffAngle(in.readFloatBig()),
|
||||
x34_castShadows(in.readBool()),
|
||||
x38_(in.readFloatBig()),
|
||||
x3c_falloff(EFalloffType(in.readUint32Big())),
|
||||
x40_(in.readFloatBig())
|
||||
{
|
||||
}
|
||||
|
||||
CLight CWorldLight::GetAsCGraphicsLight() const
|
||||
{
|
||||
const float epsilon = 1.1920929e-7;
|
||||
zeus::CVector3f tmpColor = x4_color;
|
||||
zeus::CColor color(x4_color.x, x4_color.y, x4_color.z);
|
||||
float tmp = x28_q;
|
||||
if (epsilon < tmp)
|
||||
tmp = 0.0000011920929f;
|
||||
/*
|
||||
if (x0_type == ELightType::Spot)
|
||||
{
|
||||
float f2 = tmpColor.x;
|
||||
float f0 = tmpColor.y;
|
||||
float f1 = tmpColor.z;
|
||||
float f3 = f2 * tmp;
|
||||
f2 = f0 * tmp;
|
||||
f0 = 1.0f;
|
||||
f1 *= tmp;
|
||||
tmpColor.x = f3;
|
||||
tmpColor.y = f2;
|
||||
tmpColor.z = f1;
|
||||
|
||||
if (f3 >= f0)
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
#ifndef CWORLDLIGHT_HPP
|
||||
#define CWORLDLIGHT_HPP
|
||||
|
||||
#include "Graphics/CLight.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CWorldLight
|
||||
{
|
||||
ELightType x0_type = ELightType::Custom;
|
||||
zeus::CVector3f x4_color;
|
||||
zeus::CVector3f x10_position;
|
||||
zeus::CVector3f x1c_direction;
|
||||
float x28_q = 0.f;
|
||||
float x2c_cutoffAngle = 0.f;
|
||||
float x30_ = 0.f;
|
||||
bool x34_castShadows = false;
|
||||
float x38_ = 0.f;
|
||||
EFalloffType x3c_falloff = EFalloffType::Linear;
|
||||
float x40_ = 0.f;
|
||||
public:
|
||||
CWorldLight(const CWorldLight&) = default;
|
||||
CWorldLight(CInputStream& in);
|
||||
ELightType GetLightType() const;
|
||||
const zeus::CVector3f& GetDirection() const;
|
||||
const zeus::CVector3f& GetPosition() const;
|
||||
bool DoesCastShadows() const;
|
||||
|
||||
CLight GetAsCGraphicsLight() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // CWORLDLIGHT_HPP
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
|||
Subproject commit fdc5d61b4e091a8c5eefa625ea9b21d59977f633
|
||||
Subproject commit a21258cf8cc91e042c1ebee64db10c2dca3651e8
|
2
specter
2
specter
|
@ -1 +1 @@
|
|||
Subproject commit d705b8d7f4f433b0bcbc76a789b3ed7874829e56
|
||||
Subproject commit d14a7aed7bd256191ed5bfbbb9a0f9cf4a141796
|
Loading…
Reference in New Issue