Cooking bug fixes

This commit is contained in:
Jack Andersen 2018-02-26 00:39:12 -10:00
parent 8bae2325d6
commit 72f9e77f56
8 changed files with 26 additions and 19 deletions

View File

@ -8,6 +8,7 @@ logvisor::Module Log("AROTBuilder");
#define AROT_MAX_LEVEL 6 #define AROT_MAX_LEVEL 6
#define COLLISION_MIN_NODE_TRIANGLES 16 #define COLLISION_MIN_NODE_TRIANGLES 16
#define PATH_MIN_NODE_REGIONS 16
static zeus::CAABox SplitAABB(const zeus::CAABox& aabb, int i) static zeus::CAABox SplitAABB(const zeus::CAABox& aabb, int i)
{ {
@ -460,7 +461,7 @@ void AROTBuilder::buildPath(DNAMP1::PATH& path)
/* Recursively split */ /* Recursively split */
BspNodeType dontCare; BspNodeType dontCare;
rootNode.addChild(0, 4, regionBoxes, fullAABB, dontCare); rootNode.addChild(0, PATH_MIN_NODE_REGIONS, regionBoxes, fullAABB, dontCare);
/* Write out */ /* Write out */
size_t nodeCount = 0; size_t nodeCount = 0;

View File

@ -106,9 +106,7 @@ bool DCLN::Extract(const SpecBase& dataSpec,
} }
bool DCLN::Cook(const hecl::ProjectPath& outPath, bool DCLN::Cook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath, const std::vector<Mesh>& meshes)
const std::vector<Mesh>& meshes,
hecl::blender::Connection* conn)
{ {
DCLN dcln; DCLN dcln;
dcln.colCount = atUint32(meshes.size()); dcln.colCount = atUint32(meshes.size());

View File

@ -106,9 +106,7 @@ struct DCLN : BigDNA
std::function<void(const hecl::SystemChar*)> fileChanged); std::function<void(const hecl::SystemChar*)> fileChanged);
static bool Cook(const hecl::ProjectPath& outPath, static bool Cook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath, const std::vector<Mesh>& meshes);
const std::vector<Mesh>& meshes,
hecl::blender::Connection* conn = nullptr);
}; };
} }

View File

@ -20,7 +20,7 @@ void EVNT::Enumerate(typename Op::StreamT& s)
if (version == 2) if (version == 2)
{ {
DoSize<Op>({"soundPOICount"}, soundPOICount, s); DoSize<Op>({"soundPOICount"}, soundPOICount, s);
Do<Op>({"particlePOINodes"}, soundPOINodes, soundPOICount, s); Do<Op>({"soundPOINodes"}, soundPOINodes, soundPOICount, s);
} }
} }

View File

@ -165,15 +165,27 @@ bool PATH::Extract(const SpecBase& dataSpec,
} }
bool PATH::Cook(const hecl::ProjectPath& outPath, bool PATH::Cook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath, const PathMesh& mesh)
const PathMesh& mesh,
hecl::blender::Connection* conn)
{ {
athena::io::MemoryReader r(mesh.data.data(), mesh.data.size()); athena::io::MemoryReader r(mesh.data.data(), mesh.data.size());
PATH path; PATH path;
path.read(r); path.read(r);
if (!path.regions.empty())
{
AROTBuilder octreeBuilder; AROTBuilder octreeBuilder;
octreeBuilder.buildPath(path); 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()); athena::io::FileWriter w(outPath.getAbsolutePath());
path.write(w); path.write(w);

View File

@ -86,9 +86,7 @@ struct PATH : BigDNA
std::function<void(const hecl::SystemChar*)> fileChanged); std::function<void(const hecl::SystemChar*)> fileChanged);
static bool Cook(const hecl::ProjectPath& outPath, static bool Cook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath, const PathMesh& mesh);
const PathMesh& mesh,
hecl::blender::Connection* conn = nullptr);
}; };
} }

View File

@ -760,7 +760,7 @@ struct SpecMP1 : SpecBase
{ {
std::vector<ColMesh> mesh = ds.compileColMeshes(); std::vector<ColMesh> mesh = ds.compileColMeshes();
ds.close(); 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, 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(); PathMesh mesh = ds.compilePathMesh();
ds.close(); 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, void cookActor(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast,

2
hecl

@ -1 +1 @@
Subproject commit b014d6114bcd34d473bcf2573654c43fee6347c0 Subproject commit 24522449fa4232dd88781542052b6033d6dc9bef