From 72f9e77f561f9bc0a0d00f82d3c553216370b854 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Mon, 26 Feb 2018 00:39:12 -1000 Subject: [PATCH] Cooking bug fixes --- DataSpec/DNACommon/AROTBuilder.cpp | 3 ++- DataSpec/DNAMP1/DCLN.cpp | 4 +--- DataSpec/DNAMP1/DCLN.hpp | 4 +--- DataSpec/DNAMP1/EVNT.cpp | 2 +- DataSpec/DNAMP1/PATH.cpp | 22 +++++++++++++++++----- DataSpec/DNAMP1/PATH.hpp | 4 +--- DataSpec/SpecMP1.cpp | 4 ++-- hecl | 2 +- 8 files changed, 26 insertions(+), 19 deletions(-) diff --git a/DataSpec/DNACommon/AROTBuilder.cpp b/DataSpec/DNACommon/AROTBuilder.cpp index bc2b32c1f..b44d147f6 100644 --- a/DataSpec/DNACommon/AROTBuilder.cpp +++ b/DataSpec/DNACommon/AROTBuilder.cpp @@ -8,6 +8,7 @@ logvisor::Module Log("AROTBuilder"); #define AROT_MAX_LEVEL 6 #define COLLISION_MIN_NODE_TRIANGLES 16 +#define PATH_MIN_NODE_REGIONS 16 static zeus::CAABox SplitAABB(const zeus::CAABox& aabb, int i) { @@ -460,7 +461,7 @@ void AROTBuilder::buildPath(DNAMP1::PATH& path) /* Recursively split */ BspNodeType dontCare; - rootNode.addChild(0, 4, regionBoxes, fullAABB, dontCare); + rootNode.addChild(0, PATH_MIN_NODE_REGIONS, regionBoxes, fullAABB, dontCare); /* Write out */ size_t nodeCount = 0; diff --git a/DataSpec/DNAMP1/DCLN.cpp b/DataSpec/DNAMP1/DCLN.cpp index 016b61098..c14bec368 100644 --- a/DataSpec/DNAMP1/DCLN.cpp +++ b/DataSpec/DNAMP1/DCLN.cpp @@ -106,9 +106,7 @@ bool DCLN::Extract(const SpecBase& dataSpec, } bool DCLN::Cook(const hecl::ProjectPath& outPath, - const hecl::ProjectPath& inPath, - const std::vector& meshes, - hecl::blender::Connection* conn) + const std::vector& meshes) { DCLN dcln; dcln.colCount = atUint32(meshes.size()); diff --git a/DataSpec/DNAMP1/DCLN.hpp b/DataSpec/DNAMP1/DCLN.hpp index df7b91091..5915bba5b 100644 --- a/DataSpec/DNAMP1/DCLN.hpp +++ b/DataSpec/DNAMP1/DCLN.hpp @@ -106,9 +106,7 @@ struct DCLN : BigDNA std::function fileChanged); static bool Cook(const hecl::ProjectPath& outPath, - const hecl::ProjectPath& inPath, - const std::vector& meshes, - hecl::blender::Connection* conn = nullptr); + const std::vector& meshes); }; } diff --git a/DataSpec/DNAMP1/EVNT.cpp b/DataSpec/DNAMP1/EVNT.cpp index a8794a207..89bf366ae 100644 --- a/DataSpec/DNAMP1/EVNT.cpp +++ b/DataSpec/DNAMP1/EVNT.cpp @@ -20,7 +20,7 @@ void EVNT::Enumerate(typename Op::StreamT& s) if (version == 2) { DoSize({"soundPOICount"}, soundPOICount, s); - Do({"particlePOINodes"}, soundPOINodes, soundPOICount, s); + Do({"soundPOINodes"}, soundPOINodes, soundPOICount, s); } } diff --git a/DataSpec/DNAMP1/PATH.cpp b/DataSpec/DNAMP1/PATH.cpp index 59ad93938..3a95c0228 100644 --- a/DataSpec/DNAMP1/PATH.cpp +++ b/DataSpec/DNAMP1/PATH.cpp @@ -165,15 +165,27 @@ bool PATH::Extract(const SpecBase& dataSpec, } bool PATH::Cook(const hecl::ProjectPath& outPath, - const hecl::ProjectPath& inPath, - const PathMesh& mesh, - hecl::blender::Connection* conn) + const PathMesh& mesh) { athena::io::MemoryReader r(mesh.data.data(), mesh.data.size()); PATH path; path.read(r); - AROTBuilder octreeBuilder; - octreeBuilder.buildPath(path); + if (!path.regions.empty()) + { + AROTBuilder octreeBuilder; + octreeBuilder.buildPath(path); + } + else + { + path.octreeNodeCount = 1; + path.octree.emplace_back(); + OctreeNode& n = path.octree.back(); + n.isLeaf = 1; + n.aabb[0] = zeus::CVector3f{FLT_MAX, FLT_MAX, FLT_MAX}; + n.aabb[1] = zeus::CVector3f{-FLT_MAX, -FLT_MAX, -FLT_MAX}; + for (int i=0 ; i<8 ; ++i) + n.children[i] = 0xffffffff; + } athena::io::FileWriter w(outPath.getAbsolutePath()); path.write(w); diff --git a/DataSpec/DNAMP1/PATH.hpp b/DataSpec/DNAMP1/PATH.hpp index 4102bff4e..c79bfe45a 100644 --- a/DataSpec/DNAMP1/PATH.hpp +++ b/DataSpec/DNAMP1/PATH.hpp @@ -86,9 +86,7 @@ struct PATH : BigDNA std::function fileChanged); static bool Cook(const hecl::ProjectPath& outPath, - const hecl::ProjectPath& inPath, - const PathMesh& mesh, - hecl::blender::Connection* conn = nullptr); + const PathMesh& mesh); }; } diff --git a/DataSpec/SpecMP1.cpp b/DataSpec/SpecMP1.cpp index a7e157b64..dde4bf8b0 100644 --- a/DataSpec/SpecMP1.cpp +++ b/DataSpec/SpecMP1.cpp @@ -760,7 +760,7 @@ struct SpecMP1 : SpecBase { std::vector mesh = ds.compileColMeshes(); ds.close(); - DNAMP1::DCLN::Cook(out, in, mesh); + DNAMP1::DCLN::Cook(out, mesh); } void cookPathMesh(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast, @@ -768,7 +768,7 @@ struct SpecMP1 : SpecBase { PathMesh mesh = ds.compilePathMesh(); ds.close(); - DNAMP1::PATH::Cook(out, in, mesh); + DNAMP1::PATH::Cook(out, mesh); } void cookActor(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast, diff --git a/hecl b/hecl index b014d6114..24522449f 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit b014d6114bcd34d473bcf2573654c43fee6347c0 +Subproject commit 24522449fa4232dd88781542052b6033d6dc9bef