metaforce/DataSpec/DNAMP1/DeafBabe.hpp

102 lines
2.6 KiB
C++
Raw Normal View History

2015-09-12 07:13:40 +00:00
#ifndef _DNAMP1_DEAFBABE_HPP_
#define _DNAMP1_DEAFBABE_HPP_
#include "../DNACommon/DeafBabe.hpp"
2015-09-12 07:13:40 +00:00
2016-02-13 09:02:47 +00:00
namespace DataSpec
2015-09-12 07:13:40 +00:00
{
namespace DNAMP1
{
struct DeafBabe : BigDNA
{
DECL_DNA
2015-11-21 01:16:07 +00:00
enum class BspNodeType : atUint32
2015-09-12 07:13:40 +00:00
{
2015-11-21 01:16:07 +00:00
Invalid,
Branch,
Leaf
2015-09-12 07:13:40 +00:00
};
struct Material : BigDNA
{
DECL_DNA
Value<atUint32> material;
bool fireThrough() const {return material >> 18 & 0x1;}
2015-10-07 01:17:17 +00:00
void setFireThrough(bool v) {material &= ~0x40000; material |= v << 18;}
2015-09-12 07:13:40 +00:00
2015-11-21 01:16:07 +00:00
enum class Type
2015-09-12 07:13:40 +00:00
{
Mat0,
MatGround,
Mat2,
MatStone,
MatHardStone,
MatMetal,
Mat6,
Mat7,
Mat8,
MatLeaves
};
Type type() const {return Type(material & 0xff);}
2015-11-21 01:16:07 +00:00
void setType(Type t) {material &= ~0xff; material |= atUint32(t);}
2015-09-12 07:13:40 +00:00
};
struct Edge : BigDNA
{
DECL_DNA
Value<atUint16> verts[2];
atUint16 findCommon(const Edge& other) const
{
if (verts[0] == other.verts[0] || verts[0] == other.verts[1])
return verts[0];
if (verts[1] == other.verts[0] || verts[1] == other.verts[1])
return verts[1];
return -1;
}
};
struct Triangle : BigDNA
{
DECL_DNA
Value<atUint16> edges[3];
};
Value<atUint32> unk1;
Value<atUint32> length;
Value<atUint32> magic;
Value<atUint32> version;
Value<atVec3f> aabb[2];
Value<BspNodeType> rootNodeType;
Value<atUint32> bspSize;
Buffer<DNA_COUNT(bspSize)> bspTree;
Value<atUint32> materialCount;
Vector<Material, DNA_COUNT(materialCount)> materials;
Value<atUint32> vertMatsCount;
Vector<atUint8, DNA_COUNT(vertMatsCount)> vertMats;
Value<atUint32> edgeMatsCount;
Vector<atUint8, DNA_COUNT(edgeMatsCount)> edgeMats;
Value<atUint32> triMatsCount;
Vector<atUint8, DNA_COUNT(triMatsCount)> triMats;
Value<atUint32> edgeVertsCount;
Vector<Edge, DNA_COUNT(edgeVertsCount)> edgeVertConnections;
Value<atUint32> triangleEdgesCount;
Vector<Triangle, DNA_COUNT(triangleEdgesCount / 3)> triangleEdgeConnections;
Value<atUint32> vertCount;
Vector<atVec3f, DNA_COUNT(vertCount)> verts;
/* Dummy MP2 member */
2016-03-04 23:04:53 +00:00
void insertNoClimb(hecl::BlenderConnection::PyOutStream&) const {}
2015-09-12 07:13:40 +00:00
2016-03-04 23:04:53 +00:00
static void BlenderInit(hecl::BlenderConnection::PyOutStream& os);
void sendToBlender(hecl::BlenderConnection::PyOutStream& os) const
2015-09-12 07:13:40 +00:00
{
DeafBabeSendToBlender(os, *this);
}
};
}
}
#endif // _DNAMP1_DEAFBABE_HPP_