2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 17:44:56 +00:00

Implement CPFArea constructor

This commit is contained in:
Jack Andersen
2018-02-13 21:51:18 -10:00
parent 74ce62726d
commit 98518e7d44
20 changed files with 375 additions and 216 deletions

View File

@@ -805,17 +805,17 @@ bool MREA::CookPath(const hecl::ProjectPath& outPath,
{
PATH path = {};
path.version = 4;
path.unkStructCount = 1;
path.unkStructs.emplace_back();
PATH::UnknownStruct& s = path.unkStructs.back();
s.unk1 = 1;
s.unk2[0] = atVec3f{FLT_MAX, FLT_MAX, FLT_MAX};
s.unk2[1] = atVec3f{-FLT_MAX, -FLT_MAX, -FLT_MAX};
s.unk2[2] = atVec3f{0.f, 0.f, 0.f};
path.octreeNodeCount = 1;
path.octree.emplace_back();
PATH::OctreeNode& s = path.octree.back();
s.isLeaf = 1;
s.points[0] = atVec3f{FLT_MAX, FLT_MAX, FLT_MAX};
s.points[1] = atVec3f{-FLT_MAX, -FLT_MAX, -FLT_MAX};
s.points[2] = atVec3f{0.f, 0.f, 0.f};
for (int i=0 ; i<8 ; ++i)
s.unk3[i] = ~0;
s.unk4 = 0;
s.unk5 = 0;
s.children[i] = 0xffffffff;
s.regionCount = 0;
s.regionStart = 0;
athena::io::FileWriter w(outPath.getAbsolutePath());
path.write(w);

View File

@@ -9,64 +9,63 @@ struct PATH : BigDNA
{
DECL_DNA
Value<atUint32> version;
struct Vertex : BigDNA
struct Node : BigDNA
{
DECL_DNA
Value<atVec3f> position;
Value<atVec3f> normal;
};
Value<atUint32> vertexCount;
Vector<Vertex, DNA_COUNT(vertexCount)> nodes;
struct Edge : BigDNA
Value<atUint32> nodeCount;
Vector<Node, DNA_COUNT(nodeCount)> nodes;
struct Link : BigDNA
{
DECL_DNA
Value<atUint32> polyA;
Value<atUint32> polyB;
Value<float> width1;
Value<float> width2;
Value<atUint32> regionIdx;
Value<atUint32> nodeIdx;
Value<float> width2d;
Value<float> oneOverWidth2d;
};
Value<atUint32> linkCount;
Vector<Link, DNA_COUNT(linkCount)> links;
Value<atUint32> edgeCount;
Vector<Edge, DNA_COUNT(edgeCount)> edges;
struct Polygon : BigDNA
struct Region : BigDNA
{
DECL_DNA
Value<atUint32> vertCount;
Value<atUint32> vertStart;
Value<atUint32> edgeCount;
Value<atUint32> edgeStart;
Value<atUint32> nodeCount;
Value<atUint32> nodeStart;
Value<atUint32> linkCount;
Value<atUint32> linkStart;
Value<atUint32> flags;
Value<float> area;
Value<float> height;
Value<atVec3f> normal;
Value<atUint32> selfIdx1;
Value<atVec3f> center;
Value<atUint32> regionIdx;
Value<atVec3f> centroid;
Value<atVec3f> aabb[2];
Value<atUint32> selfIdx2;
Value<atUint32> regionIdxPtr;
};
Value<atUint32> regionCount;
Vector<Region, DNA_COUNT(regionCount)> regions;
Value<atUint32> polyCount;
Vector<Polygon, DNA_COUNT(polyCount)> polygons;
Vector<atUint32, DNA_COUNT((((polyCount * (polyCount - 1)) / 2) + 31) / 32)> bitmap1;
Vector<atUint32, DNA_COUNT((((regionCount * (regionCount - 1)) / 2) + 31) / 32)> bitmap1;
Vector<atUint32, DNA_COUNT(bitmap1.size())> bitmap2;
Vector<atUint32, DNA_COUNT(((((polyCount * polyCount) + 31) / 32) - bitmap1.size()) * 2)> bitmap3;
Vector<atUint32, DNA_COUNT(((((regionCount * regionCount) + 31) / 32) - bitmap1.size()) * 2)> bitmap3;
Value<atUint32> unkIntCount;
Vector<atUint32, DNA_COUNT(unkIntCount)> unkInts;
Value<atUint32> octreeRegionLookupCount;
Vector<atUint32, DNA_COUNT(octreeRegionLookupCount)> octreeRegionLookup;
struct UnknownStruct : BigDNA
struct OctreeNode : BigDNA
{
DECL_DNA
Value<atUint32> unk1;
Value<atVec3f> unk2[3];
Value<atUint32> unk3[8]; // Usually 0xFF
Value<atUint32> unk4;
Value<atUint32> unk5;
Value<atUint32> isLeaf;
Value<atVec3f> points[3];
Value<atUint32> children[8];
Value<atUint32> regionCount;
Value<atUint32> regionStart;
};
Value<atUint32> unkStructCount;
Vector<UnknownStruct, DNA_COUNT(unkStructCount)> unkStructs;
Value<atUint32> octreeNodeCount;
Vector<OctreeNode, DNA_COUNT(octreeNodeCount)> octree;
};
}