From 619a784434fcc58c6cbf694762c8291f09ff61a6 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sat, 24 Feb 2018 22:23:27 -1000 Subject: [PATCH] Initial PATH cooking support --- DataSpec/DNACommon/AROTBuilder.cpp | 82 ++++++++++++++++++ DataSpec/DNACommon/AROTBuilder.hpp | 8 ++ DataSpec/DNACommon/CMDL.hpp | 2 +- DataSpec/DNACommon/DGRP.hpp | 2 +- DataSpec/DNACommon/EGMC.hpp | 2 +- DataSpec/DNACommon/FONT.hpp | 2 +- DataSpec/DNACommon/FSM2.hpp | 32 +++---- DataSpec/DNACommon/MAPA.hpp | 18 ++-- DataSpec/DNACommon/MAPU.hpp | 4 +- DataSpec/DNACommon/ParticleCommon.hpp | 8 +- DataSpec/DNAMP1/AFSM.hpp | 8 +- DataSpec/DNAMP1/ANCS.hpp | 10 +-- DataSpec/DNAMP1/CINF.hpp | 8 +- DataSpec/DNAMP1/CMDLMaterials.hpp | 32 +++---- DataSpec/DNAMP1/CSKR.hpp | 4 +- DataSpec/DNAMP1/DCLN.hpp | 18 ++-- DataSpec/DNAMP1/DeafBabe.hpp | 16 ++-- DataSpec/DNAMP1/EVNT.hpp | 8 +- DataSpec/DNAMP1/FRME.hpp | 6 +- DataSpec/DNAMP1/HINT.hpp | 4 +- DataSpec/DNAMP1/MLVL.cpp | 3 +- DataSpec/DNAMP1/MLVL.hpp | 24 +++--- DataSpec/DNAMP1/MREA.cpp | 30 +------ DataSpec/DNAMP1/MREA.hpp | 5 +- DataSpec/DNAMP1/PAK.hpp | 2 +- DataSpec/DNAMP1/PATH.cpp | 84 ++++++++++++++----- DataSpec/DNAMP1/PATH.hpp | 22 ++--- DataSpec/DNAMP1/SAVW.hpp | 10 +-- DataSpec/DNAMP1/SCLY.hpp | 6 +- .../DNAMP1/ScriptObjects/IScriptObject.hpp | 2 +- DataSpec/DNAMP1/ScriptObjects/Parameters.hpp | 2 +- DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp | 2 +- DataSpec/DNAMP1/Tweaks/CTweakGui.hpp | 2 +- DataSpec/DNAMP1/Tweaks/CTweakGuiColors.hpp | 2 +- .../DNAMP1/Tweaks/CTweakPlayerControl.hpp | 2 +- DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp | 6 +- DataSpec/DNAMP2/ANCS.hpp | 12 +-- DataSpec/DNAMP2/CINF.hpp | 8 +- DataSpec/DNAMP2/CMDLMaterials.hpp | 20 ++--- DataSpec/DNAMP2/DeafBabe.hpp | 18 ++-- DataSpec/DNAMP2/MLVL.hpp | 24 +++--- DataSpec/DNAMP2/MREA.hpp | 2 +- DataSpec/DNAMP2/PTLA.hpp | 14 ++-- DataSpec/DNAMP2/SAVW.hpp | 6 +- DataSpec/DNAMP3/CAUD.hpp | 14 ++-- DataSpec/DNAMP3/CHAR.hpp | 34 ++++---- DataSpec/DNAMP3/CMDLMaterials.hpp | 4 +- DataSpec/DNAMP3/CSKR.hpp | 12 +-- DataSpec/DNAMP3/HINT.hpp | 4 +- DataSpec/DNAMP3/MLVL.hpp | 18 ++-- DataSpec/DNAMP3/MREA.hpp | 6 +- DataSpec/DNAMP3/SAVW.hpp | 14 ++-- DataSpec/SpecBase.cpp | 17 ++-- DataSpec/SpecBase.hpp | 4 + DataSpec/SpecMP1.cpp | 76 ++++++++--------- DataSpec/SpecMP2.cpp | 6 ++ DataSpec/SpecMP3.cpp | 6 ++ hecl | 2 +- 58 files changed, 459 insertions(+), 340 deletions(-) diff --git a/DataSpec/DNACommon/AROTBuilder.cpp b/DataSpec/DNACommon/AROTBuilder.cpp index 3412c9c39..bc2b32c1f 100644 --- a/DataSpec/DNACommon/AROTBuilder.cpp +++ b/DataSpec/DNACommon/AROTBuilder.cpp @@ -1,5 +1,6 @@ #include "AROTBuilder.hpp" #include "hecl/Blender/Connection.hpp" +#include "../DNAMP1/PATH.hpp" namespace DataSpec { @@ -287,6 +288,60 @@ void AROTBuilder::Node::writeColNodes(uint8_t*& ptr, const zeus::CAABox& curAABB } } +void AROTBuilder::Node::pathCountNodesAndLookups(size_t& nodeCount, size_t& lookupCount) +{ + ++nodeCount; + if (childNodes.empty()) + { + lookupCount += childIndices.size(); + } + else + { + for (int i=0 ; i<8 ; ++i) + childNodes[i].pathCountNodesAndLookups(nodeCount, lookupCount); + } +} + +void AROTBuilder::Node::pathWrite(DNAMP1::PATH& path, const zeus::CAABox& curAABB) +{ + if (childNodes.empty()) + { + path.octree.emplace_back(); + DNAMP1::PATH::OctreeNode& n = path.octree.back(); + n.isLeaf = 1; + n.aabb[0] = curAABB.min; + n.aabb[1] = curAABB.max; + n.centroid = curAABB.center(); + for (int i=0 ; i<8 ; ++i) + n.children[i] = 0xffffffff; + n.regionCount = childIndices.size(); + n.regionStart = path.octreeRegionLookup.size(); + for (int r : childIndices) + path.octreeRegionLookup.push_back(r); + } + else + { + atUint32 children[8]; + for (int i=0 ; i<8 ; ++i) + { + /* Head recursion (first node will be a leaf) */ + children[i] = path.octree.size(); + childNodes[i].pathWrite(path, SplitAABB(curAABB, i)); + } + + path.octree.emplace_back(); + DNAMP1::PATH::OctreeNode& n = path.octree.back(); + n.isLeaf = 0; + n.aabb[0] = curAABB.min; + n.aabb[1] = curAABB.max; + n.centroid = curAABB.center(); + for (int i=0 ; i<8 ; ++i) + n.children[i] = children[i]; + n.regionCount = 0; + n.regionStart = 0; + } +} + void AROTBuilder::build(std::vector>& secs, const zeus::CAABox& fullAabb, const std::vector& meshAabbs, const std::vector& meshes) { @@ -391,4 +446,31 @@ std::pair, uint32_t> AROTBuilder::buildCol(const ColM return {std::move(ret), totalSize}; } +void AROTBuilder::buildPath(DNAMP1::PATH& path) +{ + /* Accumulate total AABB and gather region boxes */ + std::vector regionBoxes; + regionBoxes.reserve(path.regions.size()); + zeus::CAABox fullAABB; + for (const DNAMP1::PATH::Region& r : path.regions) + { + regionBoxes.emplace_back(r.aabb[0], r.aabb[1]); + fullAABB.accumulateBounds(regionBoxes.back()); + } + + /* Recursively split */ + BspNodeType dontCare; + rootNode.addChild(0, 4, regionBoxes, fullAABB, dontCare); + + /* Write out */ + size_t nodeCount = 0; + size_t lookupCount = 0; + rootNode.pathCountNodesAndLookups(nodeCount, lookupCount); + path.octreeNodeCount = nodeCount; + path.octree.reserve(nodeCount); + path.octreeRegionLookupCount = lookupCount; + path.octreeRegionLookup.reserve(lookupCount); + rootNode.pathWrite(path, fullAABB); +} + } diff --git a/DataSpec/DNACommon/AROTBuilder.hpp b/DataSpec/DNACommon/AROTBuilder.hpp index 1abb65c50..570fa556f 100644 --- a/DataSpec/DNACommon/AROTBuilder.hpp +++ b/DataSpec/DNACommon/AROTBuilder.hpp @@ -9,6 +9,10 @@ namespace DataSpec { +namespace DNAMP1 +{ +struct PATH; +} struct AROTBuilder { @@ -40,11 +44,15 @@ struct AROTBuilder void colSize(size_t& totalSz); void writeColNodes(uint8_t*& ptr, const zeus::CAABox& curAABB); + + void pathCountNodesAndLookups(size_t& nodeCount, size_t& lookupCount); + void pathWrite(DNAMP1::PATH& path, const zeus::CAABox& curAABB); } rootNode; void build(std::vector>& secs, const zeus::CAABox& fullAabb, const std::vector& meshAabbs, const std::vector& meshes); std::pair, uint32_t> buildCol(const ColMesh& mesh, BspNodeType& rootOut); + void buildPath(DNAMP1::PATH& path); }; } diff --git a/DataSpec/DNACommon/CMDL.hpp b/DataSpec/DNACommon/CMDL.hpp index bbc76c19c..bef206599 100644 --- a/DataSpec/DNACommon/CMDL.hpp +++ b/DataSpec/DNACommon/CMDL.hpp @@ -33,7 +33,7 @@ struct Header : BigDNA Value aabbMax; Value secCount; Value matSetCount; - Vector secSizes; + Vector secSizes; Align<32> align; }; diff --git a/DataSpec/DNACommon/DGRP.hpp b/DataSpec/DNACommon/DGRP.hpp index 9fab08c6a..7bf739882 100644 --- a/DataSpec/DNACommon/DGRP.hpp +++ b/DataSpec/DNACommon/DGRP.hpp @@ -19,7 +19,7 @@ struct AT_SPECIALIZE_PARMS(DataSpec::UniqueID32, DataSpec::UniqueID64) DGRP : Bi Value id; }; - Vector depends; + Vector depends; }; template diff --git a/DataSpec/DNACommon/EGMC.hpp b/DataSpec/DNACommon/EGMC.hpp index 4d96d1d91..0a02ebb88 100644 --- a/DataSpec/DNACommon/EGMC.hpp +++ b/DataSpec/DNACommon/EGMC.hpp @@ -17,7 +17,7 @@ struct EGMC : public BigDNA Value instanceId; }; - Vector objects; + Vector objects; }; } #endif // _DNACOMMON_EGMC_HPP_ diff --git a/DataSpec/DNACommon/FONT.hpp b/DataSpec/DNACommon/FONT.hpp index 97156bb28..ffa64e98c 100644 --- a/DataSpec/DNACommon/FONT.hpp +++ b/DataSpec/DNACommon/FONT.hpp @@ -109,7 +109,7 @@ struct AT_SPECIALIZE_PARMS(DataSpec::UniqueID32, DataSpec::UniqueID64) FONT : Bi Value glyphCount; std::vector> glyphs; Value kerningInfoCount; - Vector kerningInfo; + Vector kerningInfo; void gatherDependencies(std::vector& pathsOut) const { diff --git a/DataSpec/DNACommon/FSM2.hpp b/DataSpec/DNACommon/FSM2.hpp index ddbd11aa6..50e772158 100644 --- a/DataSpec/DNACommon/FSM2.hpp +++ b/DataSpec/DNACommon/FSM2.hpp @@ -42,7 +42,7 @@ struct AT_SPECIALIZE_PARMS(DataSpec::UniqueID32, DataSpec::UniqueID64) FSM2 : Bi AT_DECL_DNA_YAML String<-1> name; Value unknownCount; - Vector unknown; + Vector unknown; }; struct Unknown1 : BigDNA @@ -51,7 +51,7 @@ struct AT_SPECIALIZE_PARMS(DataSpec::UniqueID32, DataSpec::UniqueID64) FSM2 : Bi String<-1> name; Value unknown1; Value unknown2Count; - Vector unknown2; + Vector unknown2; Value unknown3; }; @@ -60,7 +60,7 @@ struct AT_SPECIALIZE_PARMS(DataSpec::UniqueID32, DataSpec::UniqueID64) FSM2 : Bi AT_DECL_DNA_YAML String<-1> name; Value unknownCount; - Vector unknown; + Vector unknown; }; struct Unknown3 : BigDNA @@ -68,14 +68,14 @@ struct AT_SPECIALIZE_PARMS(DataSpec::UniqueID32, DataSpec::UniqueID64) FSM2 : Bi AT_DECL_DNA_YAML String<-1> name; Value unknownCount; - Vector unknown; + Vector unknown; Value fsmId; }; - Vector states; - Vector unknown1; - Vector unknown2; - Vector unknown3; + Vector states; + Vector unknown1; + Vector unknown2; + Vector unknown3; }; struct FSMV2 : IFSM @@ -95,7 +95,7 @@ struct AT_SPECIALIZE_PARMS(DataSpec::UniqueID32, DataSpec::UniqueID64) FSM2 : Bi Value unknown3; Value unknown4; Value unknown5Count; - Vector unknown5; + Vector unknown5; }; struct Unknown1 : BigDNA @@ -108,7 +108,7 @@ struct AT_SPECIALIZE_PARMS(DataSpec::UniqueID32, DataSpec::UniqueID64) FSM2 : Bi Value unknown4; Value unknown5; Value unknown6Count; - Vector unknown6; + Vector unknown6; Value unknown7; }; @@ -121,7 +121,7 @@ struct AT_SPECIALIZE_PARMS(DataSpec::UniqueID32, DataSpec::UniqueID64) FSM2 : Bi Value unknown3; Value unknown4; Value unknown5Count; - Vector unknown5; + Vector unknown5; }; struct Unknown3 : BigDNA @@ -133,14 +133,14 @@ struct AT_SPECIALIZE_PARMS(DataSpec::UniqueID32, DataSpec::UniqueID64) FSM2 : Bi Value unknown3; Value unknown4; Value unknown5Count; - Vector unknown5; + Vector unknown5; Value fsmId; }; - Vector states; - Vector unknown1; - Vector unknown2; - Vector unknown3; + Vector states; + Vector unknown1; + Vector unknown2; + Vector unknown3; }; std::unique_ptr detail; diff --git a/DataSpec/DNACommon/MAPA.hpp b/DataSpec/DNACommon/MAPA.hpp index 47755ce09..1ce1fb039 100644 --- a/DataSpec/DNACommon/MAPA.hpp +++ b/DataSpec/DNACommon/MAPA.hpp @@ -72,7 +72,7 @@ struct MAPA : BigDNA Value surfCount = 0; Value internalNameLength = 0; Value unknown7 = 0; - String internalName; + String internalName; atUint32 visMode() const { return mapVisMode; } atUint32 mappableObjectCount() const { return moCount;} atUint32 vertexCount() const { return vtxCount; } @@ -131,14 +131,14 @@ struct MAPA : BigDNA Value type; Value visMode; Value sclyId; - Buffer unknownHash; + Buffer unknownHash; Value seek1 = -1; Value transformMtx[3]; Value seek2[4] = {-1, -1, -1, -1}; }; std::vector> mappableObjects; - VectorvertexCount())> vertices; + VectorvertexCount())> vertices; struct SurfaceHeader : BigDNA { @@ -149,7 +149,7 @@ struct MAPA : BigDNA Value edgeOff; }; - VectorsurfaceCount())> surfaceHeaders; + VectorsurfaceCount())> surfaceHeaders; struct Surface : BigDNA { @@ -160,22 +160,22 @@ struct MAPA : BigDNA AT_DECL_DNA Value type; Value indexCount; - Vector indices; + Vector indices; Align<4> align; }; - Vector primitives; + Vector primitives; Value borderCount; struct Border : BigDNA { AT_DECL_DNA Value indexCount; - Vector indices; + Vector indices; Align<4> align; }; - Vector borders; + Vector borders; }; - VectorsurfaceCount())> surfaces; + VectorsurfaceCount())> surfaces; }; template diff --git a/DataSpec/DNACommon/MAPU.hpp b/DataSpec/DNACommon/MAPU.hpp index c9f9d4f59..a9b4442b1 100644 --- a/DataSpec/DNACommon/MAPU.hpp +++ b/DataSpec/DNACommon/MAPU.hpp @@ -24,10 +24,10 @@ struct MAPU : BigDNA UniqueID32 mlvl; Transform transform; Value hexCount; - Vector hexTransforms; + Vector hexTransforms; DNAColor hexColor; }; - Vector worlds; + Vector worlds; static bool Cook(const hecl::blender::MapUniverse& mapu, const hecl::ProjectPath& out); }; diff --git a/DataSpec/DNACommon/ParticleCommon.hpp b/DataSpec/DNACommon/ParticleCommon.hpp index a1a93a803..4ddd19f9a 100644 --- a/DataSpec/DNACommon/ParticleCommon.hpp +++ b/DataSpec/DNACommon/ParticleCommon.hpp @@ -129,7 +129,7 @@ struct REKeyframeEmitter : IRealElement Value loopEnd; Value loopStart; Value count; - Vector keys; + Vector keys; const char* ClassID() const {return percentageTween ? "KEYP" : "KEYE";} }; @@ -339,7 +339,7 @@ struct IEKeyframeEmitter : IIntElement Value loopEnd; Value loopStart; Value count; - Vector keys; + Vector keys; const char* ClassID() const {return percentageTween ? "KEYP" : "KEYE";} }; @@ -544,7 +544,7 @@ struct VEKeyframeEmitter : IVectorElement Value loopEnd; Value loopStart; Value count; - Vector keys; + Vector keys; const char* ClassID() const {return percentageTween ? "KEYP" : "KEYE";} }; @@ -620,7 +620,7 @@ struct CEKeyframeEmitter : IColorElement Value loopEnd; Value loopStart; Value count; - Vector keys; + Vector keys; const char* ClassID() const {return percentageTween ? "KEYP" : "KEYE";} }; diff --git a/DataSpec/DNAMP1/AFSM.hpp b/DataSpec/DNAMP1/AFSM.hpp index 1fb1ad7eb..8421ddd3a 100644 --- a/DataSpec/DNAMP1/AFSM.hpp +++ b/DataSpec/DNAMP1/AFSM.hpp @@ -11,7 +11,7 @@ struct AFSM : public BigDNA { AT_DECL_DNA_YAML Value stateCount; - Vector, DNA_COUNT(stateCount)> stateNames; + Vector, AT_DNA_COUNT(stateCount)> stateNames; Value triggerCount; struct State : public BigDNA @@ -31,11 +31,11 @@ struct AFSM : public BigDNA Value parameter; Value targetState; }; - Vector triggers; + Vector triggers; }; - Vector transitions; + Vector transitions; }; - Vector states; + Vector states; static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) { diff --git a/DataSpec/DNAMP1/ANCS.hpp b/DataSpec/DNAMP1/ANCS.hpp index f2fbed262..300a0fcf9 100644 --- a/DataSpec/DNAMP1/ANCS.hpp +++ b/DataSpec/DNAMP1/ANCS.hpp @@ -99,7 +99,7 @@ struct ANCS : BigDNA }; std::vector animInfos; }; - Vector animStates; + Vector animStates; } pasDatabase; struct ParticleResData @@ -136,7 +136,7 @@ struct ANCS : BigDNA Value parentMode; Value flags; }; - Vector comps; + Vector comps; }; std::vector effects; @@ -145,7 +145,7 @@ struct ANCS : BigDNA std::vector animIdxs; }; - Vector characters; + Vector characters; } characterSet; struct AnimationSet : BigDNA @@ -262,7 +262,7 @@ struct ANCS : BigDNA MetaAnimFactory anim; Value probability; }; - Vector children; + Vector children; void gatherPrimitives(std::map>& out) { @@ -284,7 +284,7 @@ struct ANCS : BigDNA AT_DECL_DNA_YAML AT_DECL_DNAV Value animCount; - Vector children; + Vector children; void gatherPrimitives(std::map>& out) { diff --git a/DataSpec/DNAMP1/CINF.hpp b/DataSpec/DNAMP1/CINF.hpp index 184e905f2..56b6a92bf 100644 --- a/DataSpec/DNAMP1/CINF.hpp +++ b/DataSpec/DNAMP1/CINF.hpp @@ -18,12 +18,12 @@ struct CINF : BigDNA Value parentId; Value origin; Value linkedCount; - Vector linked; + Vector linked; }; - Vector bones; + Vector bones; Value boneIdCount; - Vector boneIds; + Vector boneIds; Value nameCount; struct Name : BigDNA @@ -32,7 +32,7 @@ struct CINF : BigDNA String<-1> name; Value boneId; }; - Vector names; + Vector names; atUint32 getInternalBoneIdxFromId(atUint32 id) const; atUint32 getBoneIdxFromId(atUint32 id) const; diff --git a/DataSpec/DNAMP1/CMDLMaterials.hpp b/DataSpec/DNAMP1/CMDLMaterials.hpp index bc39f8a69..87200292a 100644 --- a/DataSpec/DNAMP1/CMDLMaterials.hpp +++ b/DataSpec/DNAMP1/CMDLMaterials.hpp @@ -18,9 +18,9 @@ struct MaterialSet : BigDNA { AT_DECL_DNA Value textureCount = 0; - Vector textureIDs; + Vector textureIDs; Value materialCount = 0; - Vector materialEndOffs; + Vector materialEndOffs; void addTexture(const UniqueID32& id) {textureIDs.push_back(id); ++textureCount;} void addMaterialEndOff(atUint32 off) {materialEndOffs.push_back(off); ++materialCount;} @@ -59,7 +59,7 @@ struct MaterialSet : BigDNA const Flags& getFlags() const {return flags;} Value textureCount = 0; - Vector textureIdxs; + Vector textureIdxs; struct VAFlags : BigDNA { AT_DECL_DNA @@ -132,13 +132,13 @@ struct MaterialSet : BigDNA const VAFlags& getVAFlags() const {return vaFlags;} Value groupIdx; - Vector konstCount; - Vector konstColors; + Vector konstCount; + Vector konstColors; using BlendFactor = GX::BlendFactor; Value blendDstFac; Value blendSrcFac; - Vector indTexSlot; + Vector indTexSlot; Value colorChannelCount = 0; struct ColorChannel : BigDNA @@ -158,7 +158,7 @@ struct MaterialSet : BigDNA GX::AttnFn attenuationFn() const {return GX::AttnFn(flags >> 13 & 0x3);} void setAttenuationFn(GX::AttnFn fn) {flags &= ~0x6000; flags |= atUint32(fn) << 13;} }; - Vector colorChannels; + Vector colorChannels; Value tevStageCount = 0; struct TEVStage : BigDNA @@ -218,7 +218,7 @@ struct MaterialSet : BigDNA GX::TevKAlphaSel kAlphaIn() const {return GX::TevKAlphaSel(kaInput);} void setKAlphaIn(GX::TevKAlphaSel val) {kaInput = val;} }; - Vector tevStages; + Vector tevStages; struct TEVStageTexInfo : BigDNA { AT_DECL_DNA @@ -226,7 +226,7 @@ struct MaterialSet : BigDNA Value texSlot = 0xff; Value tcgSlot = 0xff; }; - Vector tevStageTexInfo; + Vector tevStageTexInfo; Value tcgCount = 0; struct TexCoordGen : BigDNA @@ -245,7 +245,7 @@ struct MaterialSet : BigDNA GX::PTTexMtx postMtx() const {return GX::PTTexMtx((flags >> 15 & 0x3f) + 64);} void setPostMtx(GX::PTTexMtx val) {flags &= ~0x1f8000; flags |= (atUint32(val)-64) << 15;} }; - Vector tcgs; + Vector tcgs; Value uvAnimsSize = 4; Value uvAnimsCount = 0; @@ -270,7 +270,7 @@ struct MaterialSet : BigDNA UVAnimation(const std::string& gameFunction, const std::vector& gameArgs); }; - Vector uvAnims; + Vector uvAnims; static void AddTexture(hecl::blender::PyOutStream& out, GX::TexGenSrc type, int mtxIdx, uint32_t texIdx); @@ -293,7 +293,7 @@ struct MaterialSet : BigDNA bool matrixSkinning, atUint32 grpIdx); }; - Vector materials; + Vector materials; static void RegisterMaterialProps(hecl::blender::PyOutStream& out); static void ConstructMaterial(hecl::blender::PyOutStream& out, @@ -366,13 +366,13 @@ struct HMDLMaterialSet : BigDNA MaterialSet::Material::Flags flags; Value textureCount = 0; - Vector textureIdxs; + Vector textureIdxs; - Vector indTexSlot; + Vector indTexSlot; Value uvAnimsSize = 4; Value uvAnimsCount = 0; - Vector uvAnims; + Vector uvAnims; String<-1> heclSource; hecl::Frontend::IR heclIr; @@ -384,7 +384,7 @@ struct HMDLMaterialSet : BigDNA const std::unordered_map& iprops, const std::vector& texPaths); }; - Vector materials; + Vector materials; }; } diff --git a/DataSpec/DNAMP1/CSKR.hpp b/DataSpec/DNAMP1/CSKR.hpp index 460499754..4f0e67650 100644 --- a/DataSpec/DNAMP1/CSKR.hpp +++ b/DataSpec/DNAMP1/CSKR.hpp @@ -21,10 +21,10 @@ struct CSKR : BigDNA Value boneId; Value weight; }; - Vector weights; + Vector weights; Value vertCount; }; - Vector skinningRules; + Vector skinningRules; const atInt16* getMatrixBank(size_t) const { diff --git a/DataSpec/DNAMP1/DCLN.hpp b/DataSpec/DNAMP1/DCLN.hpp index 8b2187e5f..df7b91091 100644 --- a/DataSpec/DNAMP1/DCLN.hpp +++ b/DataSpec/DNAMP1/DCLN.hpp @@ -30,19 +30,19 @@ struct DCLN : BigDNA Value version; Value memSize; Value materialCount; - Vector materials; + Vector materials; Value vertMatsCount; - Vector vertMats; + Vector vertMats; Value edgeMatsCount; - Vector edgeMats; + Vector edgeMats; Value triMatsCount; - Vector triMats; + Vector triMats; Value edgeVertsCount; - Vector edgeVertConnections; + Vector edgeVertConnections; Value triangleEdgesCount; - Vector triangleEdgeConnections; + Vector triangleEdgeConnections; Value vertCount; - Vector verts; + Vector verts; struct Node : BigDNA { @@ -52,7 +52,7 @@ struct DCLN : BigDNA { AT_DECL_DNA Value triangleIndexCount; - Vector triangleIndices; + Vector triangleIndices; size_t getMemoryUsage() const { return (((triangleIndices.size() * 2) + 16) + 3) & ~3; } }; @@ -92,7 +92,7 @@ struct DCLN : BigDNA }; - Vector collision; + Vector collision; void sendToBlender(hecl::blender::Connection& conn, std::string_view entryName); diff --git a/DataSpec/DNAMP1/DeafBabe.hpp b/DataSpec/DNAMP1/DeafBabe.hpp index 12751c5d6..302eb0161 100644 --- a/DataSpec/DNAMP1/DeafBabe.hpp +++ b/DataSpec/DNAMP1/DeafBabe.hpp @@ -124,21 +124,21 @@ struct DeafBabe : BigDNA Value aabb[2]; Value rootNodeType; Value bspSize; - Buffer bspTree; + Buffer bspTree; Value materialCount; - Vector materials; + Vector materials; Value vertMatsCount; - Vector vertMats; + Vector vertMats; Value edgeMatsCount; - Vector edgeMats; + Vector edgeMats; Value triMatsCount; - Vector triMats; + Vector triMats; Value edgeVertsCount; - Vector edgeVertConnections; + Vector edgeVertConnections; Value triangleEdgesCount; - Vector triangleEdgeConnections; + Vector triangleEdgeConnections; Value vertCount; - Vector verts; + Vector verts; /* Dummy MP2 member */ void insertNoClimb(hecl::blender::PyOutStream&) const {} diff --git a/DataSpec/DNAMP1/EVNT.hpp b/DataSpec/DNAMP1/EVNT.hpp index c66ad0bb5..762d79006 100644 --- a/DataSpec/DNAMP1/EVNT.hpp +++ b/DataSpec/DNAMP1/EVNT.hpp @@ -48,7 +48,7 @@ struct EVNT : BigDNA Value value; }; Value boolPOICount; - Vector boolPOINodes; + Vector boolPOINodes; struct Int32POINode : POINode { @@ -57,7 +57,7 @@ struct EVNT : BigDNA String<-1> locator; }; Value int32POICount; - Vector int32POINodes; + Vector int32POINodes; struct ParticlePOINode : POINode { @@ -70,7 +70,7 @@ struct EVNT : BigDNA Value parentMode; }; Value particlePOICount; - Vector particlePOINodes; + Vector particlePOINodes; struct SoundPOINode : POINode { @@ -80,7 +80,7 @@ struct EVNT : BigDNA Value maxDist; }; Value soundPOICount; - Vector soundPOINodes; + Vector soundPOINodes; static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) { diff --git a/DataSpec/DNAMP1/FRME.hpp b/DataSpec/DNAMP1/FRME.hpp index c39620823..bd40da49b 100644 --- a/DataSpec/DNAMP1/FRME.hpp +++ b/DataSpec/DNAMP1/FRME.hpp @@ -296,15 +296,15 @@ struct FRME : BigDNA Value unk1; Value unk2; Value quadCoordCount; - Vector quadCoords; + Vector quadCoords; Value uvCoordCount; - Vector uvCoords; + Vector uvCoords; FourCC fourcc() const { return FOURCC('IMGP'); } }; }; - Vector widgets; + Vector widgets; static bool Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl::ProjectPath& outPath, diff --git a/DataSpec/DNAMP1/HINT.hpp b/DataSpec/DNAMP1/HINT.hpp index 8a0db73f3..728c441ff 100644 --- a/DataSpec/DNAMP1/HINT.hpp +++ b/DataSpec/DNAMP1/HINT.hpp @@ -30,10 +30,10 @@ struct HINT : BigDNA }; Value locationCount; - Vector locations; + Vector locations; }; Value hintCount; - Vector hints; + Vector hints; static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) diff --git a/DataSpec/DNAMP1/MLVL.cpp b/DataSpec/DNAMP1/MLVL.cpp index 7fb884d12..ba8d24b38 100644 --- a/DataSpec/DNAMP1/MLVL.cpp +++ b/DataSpec/DNAMP1/MLVL.cpp @@ -314,7 +314,8 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat } } - urde::SObjectTag pathTag = g_curSpec->buildTagFromPath(areaPath.ensureAuxInfo(_S("PATH")), btok); + hecl::ProjectPath pathPath(areaPath.getParentPath(), _S("!path.blend")); + urde::SObjectTag pathTag = g_curSpec->buildTagFromPath(pathPath, btok); if (pathTag.id.IsValid()) areaOut.deps.emplace_back(pathTag.id.Value(), pathTag.type); diff --git a/DataSpec/DNAMP1/MLVL.hpp b/DataSpec/DNAMP1/MLVL.hpp index 3aa0bf32c..34384ce96 100644 --- a/DataSpec/DNAMP1/MLVL.hpp +++ b/DataSpec/DNAMP1/MLVL.hpp @@ -26,7 +26,7 @@ struct MLVL : BigDNA Value msg; Value active; }; - Vector memRelayLinks; + Vector memRelayLinks; Value areaCount; Value unknown1; @@ -40,7 +40,7 @@ struct MLVL : BigDNA Value areaId; Value attachedAreaCount; - Vector attachedAreas; + Vector attachedAreas; Value padding; Value depCount; @@ -54,10 +54,10 @@ struct MLVL : BigDNA Dependency(const UniqueID32& idin, const hecl::FourCC& fcc) : id(idin), type(fcc) {} }; - Vector deps; + Vector deps; Value depLayerCount; - Vector depLayers; + Vector depLayers; Value dockCount; struct Dock : BigDNA @@ -70,14 +70,14 @@ struct MLVL : BigDNA Value areaIdx; Value dockIdx; }; - Vector endpoints; + Vector endpoints; Value planeVertCount; - Vector planeVerts; + Vector planeVerts; }; - Vector docks; + Vector docks; }; - Vector areas; + Vector areas; void finishLastArea() { @@ -102,7 +102,7 @@ struct MLVL : BigDNA Value groupId; UniqueID32 agscId; }; - Vector audioGroups; + Vector audioGroups; String<-1> unkString; Value layerFlagCount; @@ -112,13 +112,13 @@ struct MLVL : BigDNA Value layerCount; Value flags; }; - Vector layerFlags; + Vector layerFlags; Value layerNameCount; - Vector, DNA_COUNT(layerNameCount)> layerNames; + Vector, AT_DNA_COUNT(layerNameCount)> layerNames; Value layerNameOffsetCount; - Vector layerNameOffsets; + Vector layerNameOffsets; void readMeta(athena::io::YAMLDocReader& __dna_docin) { diff --git a/DataSpec/DNAMP1/MREA.cpp b/DataSpec/DNAMP1/MREA.cpp index 4eabfbb60..43f6fd6a4 100644 --- a/DataSpec/DNAMP1/MREA.cpp +++ b/DataSpec/DNAMP1/MREA.cpp @@ -798,7 +798,8 @@ bool MREA::PCCook(const hecl::ProjectPath& outPath, /* PATH */ { - UniqueID32 pathId = inPath.ensureAuxInfo(_S("PATH")); + hecl::ProjectPath pathPath(inPath.getParentPath(), _S("!path.blend")); + UniqueID32 pathId = pathPath; secs.emplace_back(4, 0); athena::io::MemoryWriter w(secs.back().data(), secs.back().size()); pathId.write(w); @@ -826,31 +827,4 @@ bool MREA::PCCook(const hecl::ProjectPath& outPath, return true; } -bool MREA::CookPath(const hecl::ProjectPath& outPath, - const hecl::ProjectPath& inPath) -{ - PATH path = {}; - path.version = 4; - 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.children[i] = 0xffffffff; - s.regionCount = 0; - s.regionStart = 0; - - athena::io::FileWriter w(outPath.getAbsolutePath()); - path.write(w); - int64_t rem = w.position() % 32; - if (rem) - for (int64_t i=0 ; i<32-rem ; ++i) - w.writeUByte(0xff); - - return true; -} - } diff --git a/DataSpec/DNAMP1/MREA.hpp b/DataSpec/DNAMP1/MREA.hpp index c6196ae33..4c7c027d0 100644 --- a/DataSpec/DNAMP1/MREA.hpp +++ b/DataSpec/DNAMP1/MREA.hpp @@ -26,7 +26,7 @@ struct MREA Value visiSecIdx; Value pathSecIdx; Value arotSecIdx; - Vector secSizes; + Vector secSizes; }; struct MeshHeader : BigDNA @@ -137,9 +137,6 @@ struct MREA const ColMesh& cMesh, const std::vector& lights, hecl::blender::Token& btok); - - static bool CookPath(const hecl::ProjectPath& outPath, - const hecl::ProjectPath& inPath); }; } diff --git a/DataSpec/DNAMP1/PAK.hpp b/DataSpec/DNAMP1/PAK.hpp index d12b0767b..0c6db453a 100644 --- a/DataSpec/DNAMP1/PAK.hpp +++ b/DataSpec/DNAMP1/PAK.hpp @@ -22,7 +22,7 @@ struct PAK : BigDNA DNAFourCC type; UniqueID32 id; Value nameLen; - String name; + String name; }; struct Entry : BigDNA diff --git a/DataSpec/DNAMP1/PATH.cpp b/DataSpec/DNAMP1/PATH.cpp index f520a81d4..59ad93938 100644 --- a/DataSpec/DNAMP1/PATH.cpp +++ b/DataSpec/DNAMP1/PATH.cpp @@ -1,6 +1,7 @@ #include "PATH.hpp" #include "hecl/Blender/Connection.hpp" -#include +#include "zeus/CAABox.hpp" +#include "../DNACommon/AROTBuilder.hpp" namespace DataSpec::DNAMP1 { @@ -14,18 +15,41 @@ void PATH::sendToBlender(hecl::blender::Connection& conn, std::string_view entry "import bmesh\n" "from mathutils import Vector, Matrix\n" "\n" + "bpy.types.Material.retro_path_idx_mask = bpy.props.IntProperty(name='Retro: Path Index Mask')\n" + "bpy.types.Material.retro_path_type_mask = bpy.props.IntProperty(name='Retro: Path Type Mask')\n" + "\n" "material_dict = {}\n" "material_index = []\n" - "def select_material(data):\n" - " if data in material_index:\n" - " return material_index.index(data)\n" - " elif data in material_dict:\n" - " material_index.append(data)\n" + "def make_ground_material(idxMask):\n" + " mat = bpy.data.materials.new('Ground %%X' %% idxMask)\n" + " mat.diffuse_color = (0.8, 0.460, 0.194)\n" + " return mat\n" + "def make_flyer_material(idxMask):\n" + " mat = bpy.data.materials.new('Flyer %%X' %% idxMask)\n" + " mat.diffuse_color = (0.016, 0.8, 0.8)\n" + " return mat\n" + "def make_swimmer_material(idxMask):\n" + " mat = bpy.data.materials.new('Swimmer %%X' %% idxMask)\n" + " mat.diffuse_color = (0.074, 0.293, 0.8)\n" + " return mat\n" + "def select_material(meshIdxMask, meshTypeMask):\n" + " key = (meshIdxMask, meshTypeMask)\n" + " if key in material_index:\n" + " return material_index.index(key)\n" + " elif key in material_dict:\n" + " material_index.append(key)\n" " return len(material_index)-1\n" " else:\n" - " mat = bpy.data.materials.new(data)\n" - " material_dict[data] = mat\n" - " material_index.append(data)\n" + " if meshTypeMask == 0x2:\n" + " mat = make_flyer_material(meshIdxMask)\n" + " elif meshTypeMask == 0x4:\n" + " mat = make_swimmer_material(meshIdxMask)\n" + " else:\n" + " mat = make_ground_material(meshIdxMask)\n" + " mat.retro_path_idx_mask = meshIdxMask\n" + " mat.retro_path_type_mask = meshTypeMask\n" + " material_dict[key] = mat\n" + " material_index.append(key)\n" " return len(material_index)-1\n" "\n" "bpy.context.scene.name = '%s'\n" @@ -35,7 +59,8 @@ void PATH::sendToBlender(hecl::blender::Connection& conn, std::string_view entry " bpy.context.scene.objects.unlink(ob)\n" " bpy.data.objects.remove(ob)\n" "\n" - "bm = bmesh.new()\n", + "bm = bmesh.new()\n" + "height_lay = bm.faces.layers.float.new('Height')\n", entryName.data()); for (const Node& n : nodes) @@ -50,23 +75,38 @@ void PATH::sendToBlender(hecl::blender::Connection& conn, std::string_view entry for (int i=0 ; imultiplyOneOverW(centroid); os.format("face = bm.faces.get(tri_verts)\n" "if face is None:\n" " face = bm.faces.new(tri_verts)\n" " face.normal_flip()\n" - "face.material_index = select_material('0x%08X')\n" + "face.material_index = select_material(0x%04X, 0x%04X)\n" "face.smooth = False\n" - "hobj = bpy.data.objects.new('Height', None)\n" - "hobj.location = (%f,%f,%f)\n" - "hobj.layers[1] = True\n" - "bpy.context.scene.objects.link(hobj)\n" - "\n", r.flags, centroid.v[0], centroid.v[1], centroid.v[2] + r.height); + "face[height_lay] = %f\n" + "\n", r.meshIndexMask, r.meshTypeMask, r.height); + +#if 0 + zeus::CVector3f center = xf->multiplyOneOverW(r.centroid); + zeus::CAABox aabb(xf->multiplyOneOverW(r.aabb[0]), xf->multiplyOneOverW(r.aabb[1])); + os.format("aabb = bpy.data.objects.new('AABB', None)\n" + "aabb.location = (%f,%f,%f)\n" + "aabb.scale = (%f,%f,%f)\n" + "aabb.empty_draw_type = 'CUBE'\n" + "bpy.context.scene.objects.link(aabb)\n" + "centr = bpy.data.objects.new('Center', None)\n" + "centr.location = (%f,%f,%f)\n" + "bpy.context.scene.objects.link(centr)\n", + aabb.min.v[0] + (aabb.max.v[0] - aabb.min.v[0]) / 2.f, + aabb.min.v[1] + (aabb.max.v[1] - aabb.min.v[1]) / 2.f, + aabb.min.v[2] + (aabb.max.v[2] - aabb.min.v[2]) / 2.f, + (aabb.max.v[0] - aabb.min.v[0]) / 2.f, + (aabb.max.v[1] - aabb.min.v[1]) / 2.f, + (aabb.max.v[2] - aabb.min.v[2]) / 2.f, + center.x, center.y, center.z); +#endif } - os << "path_mesh = bpy.data.meshes.new('PATH')\n" + os << "bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=0.001)\n" + "path_mesh = bpy.data.meshes.new('PATH')\n" "bm.to_mesh(path_mesh)\n" "path_mesh_obj = bpy.data.objects.new(path_mesh.name, path_mesh)\n" "\n" @@ -129,7 +169,11 @@ bool PATH::Cook(const hecl::ProjectPath& outPath, const PathMesh& mesh, hecl::blender::Connection* conn) { + athena::io::MemoryReader r(mesh.data.data(), mesh.data.size()); PATH path; + path.read(r); + AROTBuilder octreeBuilder; + octreeBuilder.buildPath(path); athena::io::FileWriter w(outPath.getAbsolutePath()); path.write(w); diff --git a/DataSpec/DNAMP1/PATH.hpp b/DataSpec/DNAMP1/PATH.hpp index 2ed7c1767..4102bff4e 100644 --- a/DataSpec/DNAMP1/PATH.hpp +++ b/DataSpec/DNAMP1/PATH.hpp @@ -21,7 +21,7 @@ struct PATH : BigDNA Value normal; }; Value nodeCount; - Vector nodes; + Vector nodes; struct Link : BigDNA { @@ -32,7 +32,7 @@ struct PATH : BigDNA Value oneOverWidth2d; }; Value linkCount; - Vector links; + Vector links; struct Region : BigDNA { @@ -41,7 +41,8 @@ struct PATH : BigDNA Value nodeStart; Value linkCount; Value linkStart; - Value flags; + Value meshIndexMask; + Value meshTypeMask; Value height; Value normal; Value regionIdx; @@ -50,26 +51,27 @@ struct PATH : BigDNA Value regionIdxPtr; }; Value regionCount; - Vector regions; + Vector regions; - Vector bitmap1; - Vector bitmap2; - Vector bitmap3; + Vector bitmap1; + Vector bitmap2; + Vector bitmap3; Value octreeRegionLookupCount; - Vector octreeRegionLookup; + Vector octreeRegionLookup; struct OctreeNode : BigDNA { AT_DECL_DNA Value isLeaf; - Value points[3]; + Value aabb[2]; + Value centroid; Value children[8]; Value regionCount; Value regionStart; }; Value octreeNodeCount; - Vector octree; + Vector octree; void sendToBlender(hecl::blender::Connection& conn, std::string_view entryName, const zeus::CMatrix4f* xf); diff --git a/DataSpec/DNAMP1/SAVW.hpp b/DataSpec/DNAMP1/SAVW.hpp index 3a075bd04..6100214b5 100644 --- a/DataSpec/DNAMP1/SAVW.hpp +++ b/DataSpec/DNAMP1/SAVW.hpp @@ -21,15 +21,15 @@ struct SAVW : BigDNA AT_DECL_DNA_YAML SAVWCommon::Header header; Value skippableCutsceneCount; - Vector skippableCutscenes; + Vector skippableCutscenes; Value relayCount; - Vector relays; + Vector relays; Value layerCount; - Vector layers; + Vector layers; Value doorCount; - Vector doors; + Vector doors; Value scanCount; - Vector scans; + Vector scans; }; } diff --git a/DataSpec/DNAMP1/SCLY.hpp b/DataSpec/DNAMP1/SCLY.hpp index f8d4a220b..41f3827d8 100644 --- a/DataSpec/DNAMP1/SCLY.hpp +++ b/DataSpec/DNAMP1/SCLY.hpp @@ -14,19 +14,19 @@ struct SCLY : BigDNA Value version; Value layerCount; - Vector layerSizes; + Vector layerSizes; struct ScriptLayer : BigDNA { AT_DECL_EXPLICIT_DNA_YAML Value unknown; Value objectCount; - Vector, DNA_COUNT(objectCount)> objects; + Vector, AT_DNA_COUNT(objectCount)> objects; void addCMDLRigPairs(PAKRouter& pakRouter, std::unordered_map>& addTo) const; void nameIDs(PAKRouter& pakRouter) const; }; - Vector layers; + Vector layers; void exportToLayerDirectories(const PAK::Entry &, PAKRouter&, bool) const; void addCMDLRigPairs(PAKRouter& pakRouter, diff --git a/DataSpec/DNAMP1/ScriptObjects/IScriptObject.hpp b/DataSpec/DNAMP1/ScriptObjects/IScriptObject.hpp index 83d9dc395..56200d41b 100644 --- a/DataSpec/DNAMP1/ScriptObjects/IScriptObject.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/IScriptObject.hpp @@ -37,7 +37,7 @@ struct IScriptObject : BigDNAVYaml }; Value connectionCount; - Vector connections; + Vector connections; Value propertyCount; virtual ~IScriptObject() = default; diff --git a/DataSpec/DNAMP1/ScriptObjects/Parameters.hpp b/DataSpec/DNAMP1/ScriptObjects/Parameters.hpp index 116a9fe4e..7ff9886ce 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Parameters.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Parameters.hpp @@ -383,7 +383,7 @@ struct PlayerParameters : BigDNA { AT_DECL_DNA_YAML Value propertyCount; - Vector bools; + Vector bools; }; struct ActorParameters : BigDNA diff --git a/DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp b/DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp index 6b306e566..45aabd7a3 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakAutoMapper.hpp @@ -74,7 +74,7 @@ struct CTweakAutoMapper final : public ITweakAutoMapper DNAColor xf8_; DNAColor xfc_; Value x100_doorColorCount; - Vector x104_doorColors; + Vector x104_doorColors; DNAColor x118_doorBorderColor; DNAColor x11c_openDoorColor; diff --git a/DataSpec/DNAMP1/Tweaks/CTweakGui.hpp b/DataSpec/DNAMP1/Tweaks/CTweakGui.hpp index ad3e3a804..a9e862b13 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakGui.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakGui.hpp @@ -162,7 +162,7 @@ struct CTweakGui final : ITweakGui Value x2bc_hudLightAttMulLinear; Value x2c0_hudLightAttMulQuadratic; Value m_scanSpeedsCount; - Vector x2c4_scanSpeeds; + Vector x2c4_scanSpeeds; String<-1> x2d0_; String<-1> x2e0_; String<-1> x2f0_; diff --git a/DataSpec/DNAMP1/Tweaks/CTweakGuiColors.hpp b/DataSpec/DNAMP1/Tweaks/CTweakGuiColors.hpp index 01e1df2dc..4fdebe037 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakGuiColors.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakGuiColors.hpp @@ -133,7 +133,7 @@ struct CTweakGuiColors final : public ITweakGuiColors }; Value x1c4_perVisorCount; /* Combat, Scan, XRay, Thermal, Ball */ - Vector x1c4_perVisorColors; + Vector x1c4_perVisorColors; CTweakGuiColors() = default; CTweakGuiColors(athena::io::IStreamReader& r) { this->read(r); } diff --git a/DataSpec/DNAMP1/Tweaks/CTweakPlayerControl.hpp b/DataSpec/DNAMP1/Tweaks/CTweakPlayerControl.hpp index 50ac18df9..81fb1cfcc 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakPlayerControl.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakPlayerControl.hpp @@ -9,7 +9,7 @@ namespace DataSpec::DNAMP1 struct CTweakPlayerControl final : ITweakPlayerControl { AT_DECL_DNA_YAML - Vector m_mappings; + Vector m_mappings; atUint32 GetMapping(atUint32 command) const {return m_mappings[command];} CTweakPlayerControl() = default; CTweakPlayerControl(athena::io::IStreamReader& reader) {this->read(reader);} diff --git a/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp b/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp index 3e15d79df..430c0072b 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakTargeting.hpp @@ -62,11 +62,11 @@ struct CTweakTargeting final : public ITweakTargeting { AT_DECL_DNA Value count; - Vector floats; + Vector floats; }; - Vector xf8_outerBeamSquareAngles; + Vector xf8_outerBeamSquareAngles; Value x108_chargeGaugeAngleCount; - Vector x108_chargeGaugeAngles; + Vector x108_chargeGaugeAngles; Value x118_chargeGaugeScale; DNAColor x11c_chargeGaugeNonFullColor; Value x120_chargeTickCount; diff --git a/DataSpec/DNAMP2/ANCS.hpp b/DataSpec/DNAMP2/ANCS.hpp index e1139fdfa..6103562e6 100644 --- a/DataSpec/DNAMP2/ANCS.hpp +++ b/DataSpec/DNAMP2/ANCS.hpp @@ -77,7 +77,7 @@ struct ANCS : BigDNA Value unk2; Value unk3; }; - Vector comps; + Vector comps; }; std::vector effects; @@ -97,7 +97,7 @@ struct ANCS : BigDNA }; std::vector extents; }; - Vector characters; + Vector characters; } characterSet; struct AnimationSet : BigDNA @@ -145,7 +145,7 @@ struct ANCS : BigDNA Value flag; }; Value loopEventCount; - Vector loopEvents; + Vector loopEvents; struct UEVTEvent : EventBase { @@ -154,7 +154,7 @@ struct ANCS : BigDNA String<-1> boneName; }; Value uevtEventCount; - Vector uevtEvents; + Vector uevtEvents; struct EffectEvent : EventBase { @@ -167,7 +167,7 @@ struct ANCS : BigDNA Value parentMode; }; Value effectEventCount; - Vector effectEvents; + Vector effectEvents; struct SFXEvent : EventBase { @@ -181,7 +181,7 @@ struct ANCS : BigDNA Value sfxUnk4; }; Value sfxEventCount; - Vector sfxEvents; + Vector sfxEvents; }; std::vector evnts; } animationSet; diff --git a/DataSpec/DNAMP2/CINF.hpp b/DataSpec/DNAMP2/CINF.hpp index 38bdd8063..081618bf2 100644 --- a/DataSpec/DNAMP2/CINF.hpp +++ b/DataSpec/DNAMP2/CINF.hpp @@ -20,12 +20,12 @@ struct CINF : BigDNA Value q1; Value q2; Value linkedCount; - Vector linked; + Vector linked; }; - Vector bones; + Vector bones; Value boneIdCount; - Vector boneIds; + Vector boneIds; Value nameCount; struct Name : BigDNA @@ -34,7 +34,7 @@ struct CINF : BigDNA String<-1> name; Value boneId; }; - Vector names; + Vector names; atUint32 getInternalBoneIdxFromId(atUint32 id) const; atUint32 getBoneIdxFromId(atUint32 id) const; diff --git a/DataSpec/DNAMP2/CMDLMaterials.hpp b/DataSpec/DNAMP2/CMDLMaterials.hpp index eeb070417..2d0d0e017 100644 --- a/DataSpec/DNAMP2/CMDLMaterials.hpp +++ b/DataSpec/DNAMP2/CMDLMaterials.hpp @@ -25,7 +25,7 @@ struct MaterialSet : BigDNA const Flags& getFlags() const {return flags;} Value textureCount; - Vector textureIdxs; + Vector textureIdxs; using VAFlags = DNAMP1::MaterialSet::Material::VAFlags; DNAMP1::MaterialSet::Material::VAFlags vaFlags; const VAFlags& getVAFlags() const {return vaFlags;} @@ -33,29 +33,29 @@ struct MaterialSet : BigDNA Value unk1; /* MP2 only */ Value groupIdx; - Vector konstCount; - Vector konstColors; + Vector konstCount; + Vector konstColors; using BlendFactor = GX::BlendFactor; Value blendDstFac; Value blendSrcFac; - Vector indTexSlot; + Vector indTexSlot; Value colorChannelCount; - Vector colorChannels; + Vector colorChannels; Value tevStageCount; - Vector tevStages; - Vector tevStageTexInfo; + Vector tevStages; + Vector tevStageTexInfo; Value tcgCount; - Vector tcgs; + Vector tcgs; Value uvAnimsSize; Value uvAnimsCount; - Vector uvAnims; + Vector uvAnims; }; - Vector materials; + Vector materials; static void RegisterMaterialProps(hecl::blender::PyOutStream& out) { diff --git a/DataSpec/DNAMP2/DeafBabe.hpp b/DataSpec/DNAMP2/DeafBabe.hpp index 483aa9c40..4979e23f3 100644 --- a/DataSpec/DNAMP2/DeafBabe.hpp +++ b/DataSpec/DNAMP2/DeafBabe.hpp @@ -115,23 +115,23 @@ struct DeafBabe : BigDNA Value aabb[2]; Value rootNodeType; Value bspSize; - Buffer bspTree; + Buffer bspTree; Value materialCount; - Vector materials; + Vector materials; Value vertMatsCount; - Vector vertMats; + Vector vertMats; Value edgeMatsCount; - Vector edgeMats; + Vector edgeMats; Value triMatsCount; - Vector triMats; + Vector triMats; Value edgeVertsCount; - Vector edgeVertConnections; + Vector edgeVertConnections; Value triangleEdgesCount; - Vector triangleEdgeConnections; + Vector triangleEdgeConnections; Value noClimbEdgeCount; - Vector noClimbEdges; + Vector noClimbEdges; Value vertCount; - Vector verts; + Vector verts; static void BlenderInit(hecl::blender::PyOutStream& os); void insertNoClimb(hecl::blender::PyOutStream& os) const; diff --git a/DataSpec/DNAMP2/MLVL.hpp b/DataSpec/DNAMP2/MLVL.hpp index 4c964fad4..349cb462f 100644 --- a/DataSpec/DNAMP2/MLVL.hpp +++ b/DataSpec/DNAMP2/MLVL.hpp @@ -30,7 +30,7 @@ struct MLVL : BigDNA Value areaId; Value attachedAreaCount; - Vector attachedAreas; + Vector attachedAreas; Value padding; Value depCount; @@ -40,10 +40,10 @@ struct MLVL : BigDNA UniqueID32 id; DNAFourCC type; }; - Vector deps; + Vector deps; Value depLayerCount; - Vector depLayers; + Vector depLayers; Value dockCount; struct Dock : BigDNA @@ -56,21 +56,21 @@ struct MLVL : BigDNA Value areaIdx; Value dockIdx; }; - Vector endpoints; + Vector endpoints; Value planeVertCount; - Vector planeVerts; + Vector planeVerts; }; - Vector docks; + Vector docks; Value relCount; - Vector, DNA_COUNT(relCount)> relFilenames; + Vector, AT_DNA_COUNT(relCount)> relFilenames; Value relOffsetCount; - Vector relOffsets; + Vector relOffsets; String<-1> internalAreaName; }; - Vector areas; + Vector areas; UniqueID32 worldMap; Value unknown2; @@ -83,13 +83,13 @@ struct MLVL : BigDNA Value layerCount; Value flags; }; - Vector layerFlags; + Vector layerFlags; Value layerNameCount; - Vector, DNA_COUNT(layerNameCount)> layerNames; + Vector, AT_DNA_COUNT(layerNameCount)> layerNames; Value layerNameOffsetCount; - Vector layerNameOffsets; + Vector layerNameOffsets; static bool Extract(const SpecBase& dataSpec, diff --git a/DataSpec/DNAMP2/MREA.hpp b/DataSpec/DNAMP2/MREA.hpp index a5ee30e0d..40f9ebe32 100644 --- a/DataSpec/DNAMP2/MREA.hpp +++ b/DataSpec/DNAMP2/MREA.hpp @@ -74,7 +74,7 @@ struct MREA Value egmcSecIdx; Value compressedBlockCount; Seek<12, athena::Current> align1; - Vector secSizes; + Vector secSizes; }; struct MeshHeader : BigDNA diff --git a/DataSpec/DNAMP2/PTLA.hpp b/DataSpec/DNAMP2/PTLA.hpp index d16cb1d06..f8f33d22b 100644 --- a/DataSpec/DNAMP2/PTLA.hpp +++ b/DataSpec/DNAMP2/PTLA.hpp @@ -23,12 +23,12 @@ struct PTLA : BigDNA Value unknown5; Value unknown6; }; - Vector entries; + Vector entries; Value unknown1; Value unknown2[2]; }; Value count1; - Vector entries1; + Vector entries1; struct UnknownStruct2 : BigDNA { @@ -42,17 +42,17 @@ struct PTLA : BigDNA Value unknown3; Value unknown4; }; - Vector entries; + Vector entries; Value unknown; }; Value count2; - Vector entries2; + Vector entries2; Value shortCount1; - Vector shorts1; + Vector shorts1; Value shortCount2; - Vector shorts2; + Vector shorts2; struct UnknownStruct3 : BigDNA { @@ -63,7 +63,7 @@ struct PTLA : BigDNA Value unknown4; }; Value count3; - Vector entries3; + Vector entries3; }; } #endif // __DNAMP2_PTLA_HPP__ diff --git a/DataSpec/DNAMP2/SAVW.hpp b/DataSpec/DNAMP2/SAVW.hpp index a6e1d35ab..c0fad1933 100644 --- a/DataSpec/DNAMP2/SAVW.hpp +++ b/DataSpec/DNAMP2/SAVW.hpp @@ -10,11 +10,11 @@ struct SAVW : DNAMP1::SAVW { AT_DECL_DNA_YAML Value systemVarCount; - Vector systemVars; + Vector systemVars; Value gameVarCount; - Vector gameVars; + Vector gameVars; Value gameObjectCount; - Vector gameObjects; + Vector gameObjects; }; } diff --git a/DataSpec/DNAMP3/CAUD.hpp b/DataSpec/DNAMP3/CAUD.hpp index 3f83e6401..71f96a81e 100644 --- a/DataSpec/DNAMP3/CAUD.hpp +++ b/DataSpec/DNAMP3/CAUD.hpp @@ -14,7 +14,7 @@ struct CAUD : BigDNA Value version; String<-1> name; Value nameCount; - Vector, DNA_COUNT(nameCount)> names; + Vector, AT_DNA_COUNT(nameCount)> names; Value unknown1; Value unknown2; Value unknown3; @@ -49,12 +49,12 @@ struct CAUD : BigDNA Value unknown4; }; Value unknown15; - Vector unknown16; + Vector unknown16; struct UnknownStruct2 : BigDNA { AT_DECL_DNA_YAML Value unknown1; - Vector unknown2; + Vector unknown2; Value unknown3; Value unknown4; Value unknown5; @@ -65,7 +65,7 @@ struct CAUD : BigDNA Value unknown2; }; Value unknown6; - Vector unknown7; + Vector unknown7; struct UnknownQuad: BigDNA { AT_DECL_EXPLICIT_DNA_YAML @@ -77,7 +77,7 @@ struct CAUD : BigDNA }; Value unknown8; - Vector unknown9; + Vector unknown9; }; UnknownStruct2 unknown17[4]; Value unknown18; @@ -99,13 +99,13 @@ struct CAUD : BigDNA Value unknown3; Value unknown4; }; - Vector unknown29; + Vector unknown29; Value unknown30; Value unknown31; }; Value infoCount; - Vector info; + Vector info; static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) { diff --git a/DataSpec/DNAMP3/CHAR.hpp b/DataSpec/DNAMP3/CHAR.hpp index 9fd14de51..8a01f8fa8 100644 --- a/DataSpec/DNAMP3/CHAR.hpp +++ b/DataSpec/DNAMP3/CHAR.hpp @@ -36,7 +36,7 @@ struct CHAR : BigDNA UniqueID64 cmdl; UniqueID64 cskr; }; - Vector overlays; + Vector overlays; UniqueID64 cinf; UniqueID64 sand; @@ -47,17 +47,17 @@ struct CHAR : BigDNA { AT_DECL_DNA_YAML Value partCount; - Vector part; + Vector part; Value swhcCount; - Vector swhc; + Vector swhc; Value unkCount; - Vector unk; + Vector unk; Value elscCount; - Vector elsc; + Vector elsc; Value spscCount; - Vector spsc; + Vector spsc; Value unk2Count; - Vector unk2; + Vector unk2; } partResData; } characterInfo; @@ -103,7 +103,7 @@ struct CHAR : BigDNA Value parentMode; }; Value effectCount; - Vector effectEvents; + Vector effectEvents; struct SFXEvent : EventBase { @@ -119,10 +119,10 @@ struct CHAR : BigDNA Value extraFloat; }; Value sfxCount; - Vector sfxEvents; + Vector sfxEvents; }; Value evntCount; - Vector evnts; + Vector evnts; struct IMetaAnim : BigDNAVYaml { @@ -206,7 +206,7 @@ struct CHAR : BigDNA MetaAnimFactory anim; Value probability; }; - Vector children; + Vector children; void gatherPrimitives(std::map>& out) { @@ -220,7 +220,7 @@ struct CHAR : BigDNA AT_DECL_DNA_YAML AT_DECL_DNAV Value animCount; - Vector children; + Vector children; void gatherPrimitives(std::map>& out) { @@ -236,7 +236,7 @@ struct CHAR : BigDNA MetaAnimFactory metaAnim; }; Value animationCount; - Vector animations; + Vector animations; struct ActionAABB : BigDNA { @@ -245,12 +245,12 @@ struct CHAR : BigDNA Value aabb[2]; }; Value animAABBCount; - Vector animAABBs; + Vector animAABBs; Value unkByte; Value additiveMapCount; - Vector additiveMap; + Vector additiveMap; } animationInfo; @@ -278,10 +278,10 @@ struct CHAR : BigDNA String<-1> boneName; Value unk14; }; - Vector hitboxes; + Vector hitboxes; }; Value hitboxSetCount; - Vector hitboxSets; + Vector hitboxSets; void getCharacterResInfo(std::vector>& out) const { diff --git a/DataSpec/DNAMP3/CMDLMaterials.hpp b/DataSpec/DNAMP3/CMDLMaterials.hpp index 8423b6581..99867755d 100644 --- a/DataSpec/DNAMP3/CMDLMaterials.hpp +++ b/DataSpec/DNAMP3/CMDLMaterials.hpp @@ -112,7 +112,7 @@ struct MaterialSet : BigDNA Value unk2; DNAMP1::MaterialSet::Material::UVAnimation anim; }; - Vector uvAnim; + Vector uvAnim; void constructNode(hecl::blender::PyOutStream& out, const PAKRouter& pakRouter, @@ -177,7 +177,7 @@ struct MaterialSet : BigDNA }; std::vector sections; }; - Vector materials; + Vector materials; static void RegisterMaterialProps(hecl::blender::PyOutStream& out); static void ConstructMaterial(hecl::blender::PyOutStream& out, diff --git a/DataSpec/DNAMP3/CSKR.hpp b/DataSpec/DNAMP3/CSKR.hpp index 4d0fdfac9..9a10aa67f 100644 --- a/DataSpec/DNAMP3/CSKR.hpp +++ b/DataSpec/DNAMP3/CSKR.hpp @@ -20,18 +20,18 @@ struct CSKR : BigDNA AT_DECL_DNA Value mtxs[10]; }; - Vector mtxBindings; + Vector mtxBindings; Value unkCount1; - Vector unk1; + Vector unk1; Value unkCount2; - Vector unk2; + Vector unk2; Value unkCount3; - Vector unk3; + Vector unk3; Value unkCount4; - Vector unk4; + Vector unk4; Value unkCount5; - Vector unk5; + Vector unk5; const atInt16* getMatrixBank(size_t idx) const { diff --git a/DataSpec/DNAMP3/HINT.hpp b/DataSpec/DNAMP3/HINT.hpp index 79d16c3f3..3597696a7 100644 --- a/DataSpec/DNAMP3/HINT.hpp +++ b/DataSpec/DNAMP3/HINT.hpp @@ -31,10 +31,10 @@ struct HINT : BigDNA }; Value locationCount; - Vector locations; + Vector locations; }; Value hintCount; - Vector hints; + Vector hints; static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) { diff --git a/DataSpec/DNAMP3/MLVL.hpp b/DataSpec/DNAMP3/MLVL.hpp index 453803c87..b25ff7792 100644 --- a/DataSpec/DNAMP3/MLVL.hpp +++ b/DataSpec/DNAMP3/MLVL.hpp @@ -29,7 +29,7 @@ struct MLVL : BigDNA Value areaId; Value attachedAreaCount; - Vector attachedAreas; + Vector attachedAreas; Value dockCount; struct Dock : BigDNA @@ -42,16 +42,16 @@ struct MLVL : BigDNA Value areaIdx; Value dockIdx; }; - Vector endpoints; + Vector endpoints; Value planeVertCount; - Vector planeVerts; + Vector planeVerts; }; - Vector docks; + Vector docks; String<-1> internalAreaName; }; - Vector areas; + Vector areas; UniqueID64 worldMap; Value unknown2; @@ -64,10 +64,10 @@ struct MLVL : BigDNA Value layerCount; Value flags; }; - Vector layerFlags; + Vector layerFlags; Value layerNameCount; - Vector, DNA_COUNT(layerNameCount)> layerNames; + Vector, AT_DNA_COUNT(layerNameCount)> layerNames; Value layerIDCount; struct LayerID : BigDNA @@ -75,10 +75,10 @@ struct MLVL : BigDNA AT_DECL_DNA_YAML Value id[2]; }; - Vector layerIDs; + Vector layerIDs; Value layerNameOffsetCount; - Vector layerNameOffsets; + Vector layerNameOffsets; static bool Extract(const SpecBase& dataSpec, diff --git a/DataSpec/DNAMP3/MREA.hpp b/DataSpec/DNAMP3/MREA.hpp index cdcc644d8..b379fc92e 100644 --- a/DataSpec/DNAMP3/MREA.hpp +++ b/DataSpec/DNAMP3/MREA.hpp @@ -35,7 +35,7 @@ struct MREA Value compressedBlockCount; Value secIndexCount; Seek<20, athena::Current> align1; - Vector secSizes; + Vector secSizes; atUint32 getSecOffset(atUint32 idx) const { @@ -70,9 +70,9 @@ struct MREA UniqueID64 id; DNAFourCC type; }; - Vector deps; + Vector deps; Value depLayerCount; - Vector depLayers; + Vector depLayers; }; struct BabeDeadLight : BigDNA diff --git a/DataSpec/DNAMP3/SAVW.hpp b/DataSpec/DNAMP3/SAVW.hpp index 6c58dff46..a2c3fae84 100644 --- a/DataSpec/DNAMP3/SAVW.hpp +++ b/DataSpec/DNAMP3/SAVW.hpp @@ -30,19 +30,19 @@ struct SAVW : BigDNA AT_DECL_DNA_YAML SAVWCommon::Header header; Value skippableCutsceneCount; - Vector skippableCutscenes; + Vector skippableCutscenes; Value relayCount; - Vector relays; + Vector relays; Value doorCount; - Vector doors; + Vector doors; Value scanCount; - Vector scans; + Vector scans; Value systemVarCount; - Vector systemVars; + Vector systemVars; Value gameVarCount; - Vector gameVars; + Vector gameVars; Value gameObjectCount; - Vector gameObjects; + Vector gameObjects; }; } diff --git a/DataSpec/SpecBase.cpp b/DataSpec/SpecBase.cpp index 592255418..8c6b60591 100644 --- a/DataSpec/SpecBase.cpp +++ b/DataSpec/SpecBase.cpp @@ -272,6 +272,12 @@ void SpecBase::doCook(const hecl::ProjectPath& path, const hecl::ProjectPath& co cookColMesh(cookedPath, path, ds, fast, btok, progress); break; } + case hecl::blender::BlendType::PathMesh: + { + hecl::blender::DataStream ds = conn.beginData(); + cookPathMesh(cookedPath, path, ds, fast, btok, progress); + break; + } case hecl::blender::BlendType::Actor: { hecl::blender::DataStream ds = conn.beginData(); @@ -1106,17 +1112,6 @@ bool SpecBase::addFileToIndex(const hecl::ProjectPath& path, pathTag = {SBIG('AGSC'), asGlob.hash().val32()}; useGlob = true; } - else if (pathTag.type == SBIG('MREA')) - { - hecl::ProjectPath subPath = path.ensureAuxInfo(_S("PATH")); - urde::SObjectTag pathTag = buildTagFromPath(subPath, m_backgroundBlender); - m_tagToPath[pathTag] = subPath; - m_pathToTag[subPath.hash()] = pathTag; - WriteTag(cacheWriter, pathTag, subPath); -#if DUMP_CACHE_FILL - DumpCacheAdd(pathTag, subPath); -#endif - } /* Cache in-memory */ const hecl::ProjectPath& usePath = useGlob ? asGlob : path; diff --git a/DataSpec/SpecBase.hpp b/DataSpec/SpecBase.hpp index 87eafc059..fcd11f3de 100644 --- a/DataSpec/SpecBase.hpp +++ b/DataSpec/SpecBase.hpp @@ -74,6 +74,7 @@ struct SpecBase : hecl::Database::IDataSpec using BlendStream = hecl::blender::DataStream; using Mesh = hecl::blender::Mesh; using ColMesh = hecl::blender::ColMesh; + using PathMesh = hecl::blender::PathMesh; using Light = hecl::blender::Light; using Actor = hecl::blender::Actor; @@ -83,6 +84,9 @@ struct SpecBase : hecl::Database::IDataSpec virtual void cookColMesh(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast, hecl::blender::Token& btok, FCookProgress progress)=0; + virtual void cookPathMesh(const hecl::ProjectPath& out, const hecl::ProjectPath& in, + BlendStream& ds, bool fast, hecl::blender::Token& btok, + FCookProgress progress)=0; virtual void cookActor(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast, hecl::blender::Token& btok, FCookProgress progress)=0; diff --git a/DataSpec/SpecMP1.cpp b/DataSpec/SpecMP1.cpp index 4d6661a6f..a7e157b64 100644 --- a/DataSpec/SpecMP1.cpp +++ b/DataSpec/SpecMP1.cpp @@ -16,6 +16,7 @@ #include "DNAMP1/AGSC.hpp" #include "DNAMP1/CSNG.hpp" #include "DNAMP1/MAPA.hpp" +#include "DNAMP1/PATH.hpp" #include "DNACommon/ATBL.hpp" #include "DNACommon/FONT.hpp" #include "DNACommon/PART.hpp" @@ -571,6 +572,8 @@ struct SpecMP1 : SpecBase return {SBIG('CMDL'), path.hash().val32()}; case hecl::blender::BlendType::ColMesh: return {SBIG('DCLN'), path.hash().val32()}; + case hecl::blender::BlendType::PathMesh: + return {SBIG('PATH'), path.hash().val32()}; case hecl::blender::BlendType::Actor: if (path.getAuxInfo().size()) { @@ -583,11 +586,7 @@ struct SpecMP1 : SpecBase } return {SBIG('ANCS'), path.getWithExtension(_S(".*"), true).hash().val32()}; case hecl::blender::BlendType::Area: - { - if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S("PATH"))) - return {SBIG('PATH'), path.hash().val32()}; return {SBIG('MREA'), path.hash().val32()}; - } case hecl::blender::BlendType::World: { if (path.getAuxInfo().size()) @@ -757,13 +756,21 @@ struct SpecMP1 : SpecBase } void cookColMesh(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast, - hecl::blender::Token& btok, FCookProgress progress) + hecl::blender::Token& btok, FCookProgress progress) { std::vector mesh = ds.compileColMeshes(); ds.close(); DNAMP1::DCLN::Cook(out, in, mesh); } + void cookPathMesh(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast, + hecl::blender::Token& btok, FCookProgress progress) + { + PathMesh mesh = ds.compilePathMesh(); + ds.close(); + DNAMP1::PATH::Cook(out, in, mesh); + } + void cookActor(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast, hecl::blender::Token& btok, FCookProgress progress) { @@ -801,44 +808,37 @@ struct SpecMP1 : SpecBase void cookArea(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast, hecl::blender::Token& btok, FCookProgress progress) { - if (hecl::StringUtils::EndsWith(in.getAuxInfo(), _S("PATH"))) - { - DNAMP1::MREA::CookPath(out, in); - } - else - { - std::vector meshes = ds.getMeshList(); - std::vector meshCompiles; - meshCompiles.reserve(meshes.size()); + std::vector meshes = ds.getMeshList(); + std::vector meshCompiles; + meshCompiles.reserve(meshes.size()); - std::experimental::optional colMesh; + std::experimental::optional colMesh; - for (const std::string& mesh : meshes) + for (const std::string& mesh : meshes) + { + hecl::SystemStringConv meshSys(mesh); + if (!mesh.compare("CMESH")) { - hecl::SystemStringConv meshSys(mesh); - if (!mesh.compare("CMESH")) - { - colMesh = ds.compileColMesh(mesh); - progress(_S("Collision Mesh")); - continue; - } - meshCompiles.push_back(ds.compileMesh( - mesh, fast ? hecl::HMDLTopology::Triangles : hecl::HMDLTopology::TriStrips, -1, - [&](int surfCount) { progress(hecl::SysFormat(_S("%s %d"), meshSys.c_str(), surfCount).c_str()); })); + colMesh = ds.compileColMesh(mesh); + progress(_S("Collision Mesh")); + continue; } - - if (!colMesh) - Log.report(logvisor::Fatal, _S("unable to find mesh named 'CMESH' in %s"), in.getAbsolutePath().data()); - - std::vector lights = ds.compileLights(); - - ds.close(); - - if (m_pc) - DNAMP1::MREA::PCCook(out, in, meshCompiles, *colMesh, lights, btok); - else - DNAMP1::MREA::Cook(out, in, meshCompiles, *colMesh, lights); + meshCompiles.push_back(ds.compileMesh( + mesh, fast ? hecl::HMDLTopology::Triangles : hecl::HMDLTopology::TriStrips, -1, + [&](int surfCount) { progress(hecl::SysFormat(_S("%s %d"), meshSys.c_str(), surfCount).c_str()); })); } + + if (!colMesh) + Log.report(logvisor::Fatal, _S("unable to find mesh named 'CMESH' in %s"), in.getAbsolutePath().data()); + + std::vector lights = ds.compileLights(); + + ds.close(); + + if (m_pc) + DNAMP1::MREA::PCCook(out, in, meshCompiles, *colMesh, lights, btok); + else + DNAMP1::MREA::Cook(out, in, meshCompiles, *colMesh, lights); } void cookWorld(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast, diff --git a/DataSpec/SpecMP2.cpp b/DataSpec/SpecMP2.cpp index 93ab40553..456c3afab 100644 --- a/DataSpec/SpecMP2.cpp +++ b/DataSpec/SpecMP2.cpp @@ -339,6 +339,12 @@ struct SpecMP2 : SpecBase { } + void cookPathMesh(const hecl::ProjectPath& out, const hecl::ProjectPath& in, + BlendStream& ds, bool fast, hecl::blender::Token& btok, + FCookProgress progress) + { + } + void cookActor(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast, hecl::blender::Token& btok, FCookProgress progress) diff --git a/DataSpec/SpecMP3.cpp b/DataSpec/SpecMP3.cpp index 3367587b0..20d892753 100644 --- a/DataSpec/SpecMP3.cpp +++ b/DataSpec/SpecMP3.cpp @@ -533,6 +533,12 @@ struct SpecMP3 : SpecBase { } + void cookPathMesh(const hecl::ProjectPath& out, const hecl::ProjectPath& in, + BlendStream& ds, bool fast, hecl::blender::Token& btok, + FCookProgress progress) + { + } + void cookActor(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast, hecl::blender::Token& btok, FCookProgress progress) diff --git a/hecl b/hecl index 8e2c8ed29..b014d6114 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 8e2c8ed29174aa184d23edd24925062920b25e2b +Subproject commit b014d6114bcd34d473bcf2573654c43fee6347c0