#pragma once #include "athena/Types.hpp" #include "DataSpec/DNACommon/DeafBabe.hpp" #include "DataSpec/DNACommon/PAK.hpp" #include "DataSpec/DNACommon/OBBTreeBuilder.hpp" #include "DNAMP1.hpp" #include "DeafBabe.hpp" #define DCLN_DUMP_OBB 0 namespace DataSpec::DNAMP1 { struct DCLN : BigDNA { using Mesh = hecl::blender::ColMesh; AT_DECL_DNA Value colCount; struct Collision : BigDNA { using Material = DeafBabe::Material; using Edge = DeafBabe::Edge; using Triangle = DeafBabe::Triangle; AT_DECL_DNA Value magic; Value version; Value memSize; Value materialCount; Vector materials; Value vertMatsCount; Vector vertMats; Value edgeMatsCount; Vector edgeMats; Value triMatsCount; Vector triMats; Value edgeVertsCount; Vector edgeVertConnections; Value triangleEdgesCount; Vector triangleEdgeConnections; Value vertCount; Vector verts; struct Node : BigDNA { AT_DECL_EXPLICIT_DNA struct LeafData : BigDNA { AT_DECL_DNA Value triangleIndexCount; Vector triangleIndices; size_t getMemoryUsage() const { return (((triangleIndices.size() * 2) + 16) + 3) & ~3; } }; Value xf[3]; Value halfExtent; Value isLeaf; std::unique_ptr leafData; std::unique_ptr left; std::unique_ptr right; size_t getMemoryUsage() const { size_t ret = 80; if (isLeaf) ret += leafData->getMemoryUsage(); else { ret += left->getMemoryUsage(); ret += right->getMemoryUsage(); } return (ret + 3) & ~3; } #if DCLN_DUMP_OBB void sendToBlender(hecl::blender::PyOutStream& os) const; #endif }; Node root; size_t getMemoryUsage() { return root.getMemoryUsage(); } /* Dummy MP2 member */ void insertNoClimb(hecl::blender::PyOutStream&) const {} }; Vector collision; void sendToBlender(hecl::blender::Connection& conn, std::string_view entryName); static bool Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl::ProjectPath& outPath, PAKRouter& pakRouter, const PAK::Entry& entry, bool force, hecl::blender::Token& btok, std::function fileChanged); static bool Cook(const hecl::ProjectPath& outPath, const std::vector& meshes); }; template void DCLN::Collision::Node::Enumerate(typename Op::StreamT& s) { Do({"xf[0]"}, xf[0], s); Do({"xf[1]"}, xf[1], s); Do({"xf[2]"}, xf[2], s); Do({"halfExtent"}, halfExtent, s); Do({"isLeaf"}, isLeaf, s); if (isLeaf) { if (!leafData) leafData.reset(new LeafData); Do({"leafData"}, *leafData, s); } else { if (!left) left.reset(new Node); Do({"left"}, *left, s); if (!right) right.reset(new Node); Do({"right"}, *right, s); } } AT_SPECIALIZE_DNA(DCLN::Collision::Node) } // namespace DataSpec::DNAMP1