metaforce/DataSpec/DNAMP2/DeafBabe.hpp

95 lines
2.7 KiB
C++
Raw Normal View History

2015-09-12 07:13:40 +00:00
#ifndef _DNAMP2_DEAFBABE_HPP_
#define _DNAMP2_DEAFBABE_HPP_
#include "../DNAMP1/DeafBabe.hpp"
namespace Retro
{
namespace DNAMP2
{
struct DeafBabe : BigDNA
{
DECL_DNA
using BspNodeType = DNAMP1::DeafBabe::BspNodeType;
struct Material : BigDNA
{
DECL_DNA
Value<atUint64> 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
enum Type
{
Mat0,
MatGround,
Mat2,
MatStone,
MatHardStone,
MatMetal,
Mat6,
Mat7,
Mat8,
MatLeaves
};
Type type() const {return Type(material & 0xff);}
2015-10-07 01:17:17 +00:00
void setType(Type t) {material &= ~0xff; material |= t;}
2015-09-12 07:13:40 +00:00
};
using Edge = DNAMP1::DeafBabe::Edge;
using Triangle = DNAMP1::DeafBabe::Triangle;
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;
2015-09-23 01:15:11 +00:00
Value<atUint32> noClimbEdgeCount;
Vector<atInt16, DNA_COUNT(noClimbEdgeCount)> noClimbEdges;
2015-09-12 07:13:40 +00:00
Value<atUint32> vertCount;
Vector<atVec3f, DNA_COUNT(vertCount)> verts;
static void BlenderInit(HECL::BlenderConnection::PyOutStream& os)
{
DNAMP1::DeafBabe::BlenderInit(os);
}
2015-09-23 01:15:11 +00:00
void insertNoClimb(HECL::BlenderConnection::PyOutStream& os) const
{
for (atInt16 edgeIdx : noClimbEdges)
{
if (edgeIdx == -1)
continue;
const Edge& edge = edgeVertConnections[edgeIdx];
os.format("edge = col_bm.edges.get((col_bm.verts[%u], col_bm.verts[%u]))\n"
"if edge:\n"
" edge.seam = True\n",
edge.verts[0], edge.verts[1]);
}
}
2015-09-12 07:13:40 +00:00
void sendToBlender(HECL::BlenderConnection::PyOutStream& os) const
{
DeafBabeSendToBlender(os, *this);
2015-09-12 07:13:40 +00:00
}
};
}
}
#endif // _DNAMP2_DEAFBABE_HPP_