metaforce/DataSpec/DNAMP1/PATH.hpp

92 lines
2.7 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2016-08-10 16:05:14 +00:00
2018-06-29 20:21:36 +00:00
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/PAK.hpp"
2018-02-24 06:17:17 +00:00
#include "DNAMP1.hpp"
2016-08-10 16:05:14 +00:00
2018-02-24 06:17:17 +00:00
namespace DataSpec::DNAMP1
2016-08-10 16:05:14 +00:00
{
struct PATH : BigDNA
{
2018-02-24 06:17:17 +00:00
using PathMesh = hecl::blender::PathMesh;
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
2016-08-10 16:05:14 +00:00
Value<atUint32> version;
2018-02-14 07:51:18 +00:00
struct Node : BigDNA
2016-08-10 16:05:14 +00:00
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
2016-08-10 16:05:14 +00:00
Value<atVec3f> position;
Value<atVec3f> normal;
};
2018-02-14 07:51:18 +00:00
Value<atUint32> nodeCount;
2018-02-25 08:23:27 +00:00
Vector<Node, AT_DNA_COUNT(nodeCount)> nodes;
2018-02-14 07:51:18 +00:00
struct Link : BigDNA
2016-08-10 16:05:14 +00:00
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
2018-02-14 07:51:18 +00:00
Value<atUint32> nodeIdx;
Value<atUint32> regionIdx;
2018-02-14 07:51:18 +00:00
Value<float> width2d;
Value<float> oneOverWidth2d;
2016-08-10 16:05:14 +00:00
};
2018-02-14 07:51:18 +00:00
Value<atUint32> linkCount;
2018-02-25 08:23:27 +00:00
Vector<Link, AT_DNA_COUNT(linkCount)> links;
2016-08-10 16:05:14 +00:00
2018-02-14 07:51:18 +00:00
struct Region : BigDNA
2016-08-10 16:05:14 +00:00
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
2018-02-14 07:51:18 +00:00
Value<atUint32> nodeCount;
Value<atUint32> nodeStart;
Value<atUint32> linkCount;
Value<atUint32> linkStart;
2018-02-25 08:23:27 +00:00
Value<atUint16> meshIndexMask;
Value<atUint16> meshTypeMask;
2018-02-14 07:51:18 +00:00
Value<float> height;
2016-08-10 16:05:14 +00:00
Value<atVec3f> normal;
2018-02-14 07:51:18 +00:00
Value<atUint32> regionIdx;
Value<atVec3f> centroid;
2016-08-10 16:05:14 +00:00
Value<atVec3f> aabb[2];
2018-02-14 07:51:18 +00:00
Value<atUint32> regionIdxPtr;
2016-08-10 16:05:14 +00:00
};
2018-02-14 07:51:18 +00:00
Value<atUint32> regionCount;
2018-02-25 08:23:27 +00:00
Vector<Region, AT_DNA_COUNT(regionCount)> regions;
2016-08-10 16:05:14 +00:00
2018-02-25 08:23:27 +00:00
Vector<atUint32, AT_DNA_COUNT((((regionCount * (regionCount - 1)) / 2) + 31) / 32)> bitmap1;
Vector<atUint32, AT_DNA_COUNT(bitmap1.size())> bitmap2;
Vector<atUint32, AT_DNA_COUNT(((((regionCount * regionCount) + 31) / 32) - bitmap1.size()) * 2)> bitmap3;
2016-08-10 16:05:14 +00:00
2018-02-14 07:51:18 +00:00
Value<atUint32> octreeRegionLookupCount;
2018-02-25 08:23:27 +00:00
Vector<atUint32, AT_DNA_COUNT(octreeRegionLookupCount)> octreeRegionLookup;
2016-08-10 16:05:14 +00:00
2018-02-14 07:51:18 +00:00
struct OctreeNode : BigDNA
2016-08-10 16:05:14 +00:00
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
2018-02-14 07:51:18 +00:00
Value<atUint32> isLeaf;
2018-02-25 08:23:27 +00:00
Value<atVec3f> aabb[2];
Value<atVec3f> centroid;
2018-02-14 07:51:18 +00:00
Value<atUint32> children[8];
Value<atUint32> regionCount;
Value<atUint32> regionStart;
2016-08-10 16:05:14 +00:00
};
2018-02-14 07:51:18 +00:00
Value<atUint32> octreeNodeCount;
2018-02-25 08:23:27 +00:00
Vector<OctreeNode, AT_DNA_COUNT(octreeNodeCount)> octree;
2018-02-24 06:17:17 +00:00
void sendToBlender(hecl::blender::Connection& conn, std::string_view entryName,
const zeus::CMatrix4f* xf);
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged);
static bool Cook(const hecl::ProjectPath& outPath,
2018-02-26 10:39:12 +00:00
const PathMesh& mesh);
2016-08-10 16:05:14 +00:00
};
}