Start COBBTree

Former-commit-id: e5668e767e
This commit is contained in:
Phillip Stephens 2023-06-23 17:15:06 -07:00
parent 9a1022d016
commit cf8cb69b61
4 changed files with 67 additions and 0 deletions

View File

@ -44,6 +44,7 @@ public:
// CIEKeyframeEmitter / rstl::vector(CInputStream&)
// why?
int ReadInt32() { return static_cast< uint >(Get(TType< int >())); }
u16 ReadUint16() { return Get<u16>(); }
uint GetBlockOffset() const { return x4_blockOffset; }
@ -74,6 +75,11 @@ inline char cinput_stream_helper(const TType< char >& type, CInputStream& in) {
return in.ReadChar();
}
template <>
inline unsigned char cinput_stream_helper(const TType< unsigned char >& type, CInputStream& in) {
return in.ReadChar();
}
template <>
inline int cinput_stream_helper(const TType< int >& type, CInputStream& in) {
return in.ReadLong();

View File

@ -0,0 +1,22 @@
#ifndef _CCOLLISIONEDGE
#define _CCOLLISIONEDGE
#include "types.h"
#include "Kyoto/Streams/CInputStream.hpp"
class CCollisionEdge {
public:
CCollisionEdge(CInputStream& in){
x0_index1 = in.Get<u16>();
x2_index2 = in.Get<u16>();
}
u16 GetVertIndex1() const { return x0_index1; }
u16 GetVertIndex2() const { return x2_index2; }
private:
u16 x0_index1;
u16 x2_index2;
};
#endif // _CCOLLISIONEDGE

View File

@ -0,0 +1,25 @@
#ifndef _COBBTREE
#define _COBBTREE
#include "Kyoto/Math/CVector3f.hpp"
#include "WorldFormat/CCollisionEdge.hpp"
#include "rstl/vector.hpp"
class COBBTree {
struct SIndexData {
rstl::vector<u32> x0_materials;
rstl::vector<u8> x10_vertMaterials;
rstl::vector<u8> x20_edgeMaterials;
rstl::vector<u8> x30_surfaceMaterials;
rstl::vector<CCollisionEdge> x40_edges;
rstl::vector<u16> x50_surfaceIndices;
rstl::vector<CVector3f> x60_vertices;
SIndexData(CInputStream& in);
};
};
#endif // _COBBTREE

View File

@ -0,0 +1,14 @@
#include "WorldFormat/COBBTree.hpp"
#include "Kyoto/Streams/CInputStream.hpp"
COBBTree::SIndexData::SIndexData(CInputStream& in)
: x0_materials(in)
, x10_vertMaterials(in)
, x20_edgeMaterials(in)
, x30_surfaceMaterials(in)
, x40_edges(in)
, x50_surfaceIndices(in)
, x60_vertices(in) {
}