diff --git a/DataSpec/DNACommon/CMDL.hpp b/DataSpec/DNACommon/CMDL.hpp index 872e74722..c8ead30e1 100644 --- a/DataSpec/DNACommon/CMDL.hpp +++ b/DataSpec/DNACommon/CMDL.hpp @@ -38,7 +38,7 @@ struct Header : BigDNA Align<32> align; }; -struct SurfaceHeader_1_2 : BigDNA +struct SurfaceHeader_1 : BigDNA { DECL_DNA Value centroid; @@ -56,6 +56,26 @@ struct SurfaceHeader_1_2 : BigDNA static constexpr atInt16 skinMatrixBankIdx() {return -1;} }; +struct SurfaceHeader_2 : BigDNA +{ + DECL_DNA + Value centroid; + Value matIdx = 0; + Value qDiv = 0x8000; + Value dlSize = 0; + Value unk1 = 0; + Value unk2 = 0; + Value aabbSz = 0; + Value reflectionNormal; + Value skinMtxBankIdx; + Value surfaceGroup; + Seek seek2; + Align<32> align; + + static constexpr bool UseMatrixSkinning() {return false;} + atInt16 skinMatrixBankIdx() const {return skinMtxBankIdx;} +}; + struct SurfaceHeader_3 : BigDNA { DECL_DNA @@ -68,8 +88,9 @@ struct SurfaceHeader_3 : BigDNA Value aabbSz = 0; Value reflectionNormal; Value skinMtxBankIdx; - Value unk3; + Value surfaceGroup; Seek seek2; + Value unk3; Align<32> align; static constexpr bool UseMatrixSkinning() {return true;} diff --git a/DataSpec/DNAMP1/ANCS.hpp b/DataSpec/DNAMP1/ANCS.hpp index d4bfc0ce9..0f95b9e00 100644 --- a/DataSpec/DNAMP1/ANCS.hpp +++ b/DataSpec/DNAMP1/ANCS.hpp @@ -418,7 +418,7 @@ struct ANCS : BigYAML if (force || blendType == HECL::ProjectPath::Type::None) { HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection(); - DNAANCS::ReadANCSToBlender, ANCS, MaterialSet, DNACMDL::SurfaceHeader_1_2, 2> + DNAANCS::ReadANCSToBlender, ANCS, MaterialSet, DNACMDL::SurfaceHeader_1, 2> (conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force); } } diff --git a/DataSpec/DNAMP1/CMDL.hpp b/DataSpec/DNAMP1/CMDL.hpp index dd32422d8..9aa4af57f 100644 --- a/DataSpec/DNAMP1/CMDL.hpp +++ b/DataSpec/DNAMP1/CMDL.hpp @@ -42,7 +42,7 @@ struct CMDL HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection(); if (!conn.createBlend(outPath, HECL::BlenderConnection::BlendType::Mesh)) return false; - DNACMDL::ReadCMDLToBlender, MaterialSet, std::pair, DNACMDL::SurfaceHeader_1_2, 2> + DNACMDL::ReadCMDLToBlender, MaterialSet, std::pair, DNACMDL::SurfaceHeader_1, 2> (conn, rs, pakRouter, entry, dataSpec, loadRp); conn.saveBlend(); @@ -61,13 +61,13 @@ struct CMDL DNACMDL::ReadCMDLToBlender, MaterialSet, std::pair, DNACMDL::SurfaceHeader_1_2, 2> (conn, reader, pakRouter, entry, dataSpec, loadRp); return conn.saveBlend(); -#elif 1 +#elif 0 /* HMDL cook test */ HECL::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"), true); HECL::BlenderConnection::DataStream ds = conn.beginData(); DNACMDL::Mesh mesh = ds.compileMesh(HECL::HMDLTopology::TriStrips, 16); ds.close(); - DNACMDL::WriteHMDLCMDL(tempOut, outPath, mesh); + DNACMDL::WriteHMDLCMDL(tempOut, outPath, mesh); #endif return true; @@ -89,7 +89,7 @@ struct CMDL if (mesh.skins.size()) { DNACMDL::Mesh skinMesh = mesh.getContiguousSkinningVersion(); - if (!DNACMDL::WriteCMDL(tempOut, inPath, skinMesh)) + if (!DNACMDL::WriteCMDL(tempOut, inPath, skinMesh)) return false; /* Output skinning intermediate */ @@ -111,7 +111,7 @@ struct CMDL for (const std::string& boneName : skinMesh.boneNames) writer.writeString(boneName); } - else if (!DNACMDL::WriteCMDL(tempOut, inPath, mesh)) + else if (!DNACMDL::WriteCMDL(tempOut, inPath, mesh)) return false; return true; } @@ -123,7 +123,7 @@ struct CMDL HECL::ProjectPath tempOut = outPath.getWithExtension(_S(".recook")); if (mesh.skins.size()) { - if (!DNACMDL::WriteHMDLCMDL(tempOut, inPath, mesh)) + if (!DNACMDL::WriteHMDLCMDL(tempOut, inPath, mesh)) return false; /* Output skinning intermediate */ @@ -139,7 +139,7 @@ struct CMDL for (const std::string& boneName : mesh.boneNames) writer.writeString(boneName); } - else if (!DNACMDL::WriteHMDLCMDL(tempOut, inPath, mesh)) + else if (!DNACMDL::WriteHMDLCMDL(tempOut, inPath, mesh)) return false; return true; } diff --git a/DataSpec/DNAMP1/MREA.cpp b/DataSpec/DNAMP1/MREA.cpp index e83187d9d..526840d33 100644 --- a/DataSpec/DNAMP1/MREA.cpp +++ b/DataSpec/DNAMP1/MREA.cpp @@ -125,7 +125,7 @@ bool MREA::Extract(const SpecBase& dataSpec, secStart = rs.position(); mHeader.read(rs); rs.seek(secStart + head.secSizes[curSec++], Athena::Begin); - curSec += DNACMDL::ReadGeomSectionsToBlender, MaterialSet, RigPair, DNACMDL::SurfaceHeader_1_2> + curSec += DNACMDL::ReadGeomSectionsToBlender, MaterialSet, RigPair, DNACMDL::SurfaceHeader_1> (os, rs, pakRouter, entry, dummy, true, true, vertAttribs, m, head.secCount, 0, &head.secSizes[curSec]); os.format("obj.retro_disable_enviro_visor = %s\n" diff --git a/DataSpec/DNAMP2/ANCS.hpp b/DataSpec/DNAMP2/ANCS.hpp index 2bbf2287d..83dd86a7d 100644 --- a/DataSpec/DNAMP2/ANCS.hpp +++ b/DataSpec/DNAMP2/ANCS.hpp @@ -241,7 +241,7 @@ struct ANCS : BigYAML if (force || blendType == HECL::ProjectPath::Type::None) { HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection(); - DNAANCS::ReadANCSToBlender, ANCS, MaterialSet, DNACMDL::SurfaceHeader_1_2, 4> + DNAANCS::ReadANCSToBlender, ANCS, MaterialSet, DNACMDL::SurfaceHeader_2, 4> (conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force); } } diff --git a/DataSpec/DNAMP2/CMDL.hpp b/DataSpec/DNAMP2/CMDL.hpp index f42a13a69..841e536da 100644 --- a/DataSpec/DNAMP2/CMDL.hpp +++ b/DataSpec/DNAMP2/CMDL.hpp @@ -40,7 +40,7 @@ struct CMDL HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection(); if (!conn.createBlend(outPath, HECL::BlenderConnection::BlendType::Mesh)) return false; - DNACMDL::ReadCMDLToBlender, MaterialSet, std::pair, DNACMDL::SurfaceHeader_1_2, 4> + DNACMDL::ReadCMDLToBlender, MaterialSet, std::pair, DNACMDL::SurfaceHeader_2, 4> (conn, rs, pakRouter, entry, dataSpec, loadRp); return conn.saveBlend(); } diff --git a/DataSpec/DNAMP2/MREA.cpp b/DataSpec/DNAMP2/MREA.cpp index 89051fce0..c3b08f4e5 100644 --- a/DataSpec/DNAMP2/MREA.cpp +++ b/DataSpec/DNAMP2/MREA.cpp @@ -239,7 +239,7 @@ bool MREA::Extract(const SpecBase& dataSpec, secStart = drs.position(); mHeader.read(drs); drs.seek(secStart + head.secSizes[curSec++], Athena::Begin); - curSec += DNACMDL::ReadGeomSectionsToBlender, MaterialSet, RigPair, DNACMDL::SurfaceHeader_1_2> + curSec += DNACMDL::ReadGeomSectionsToBlender, MaterialSet, RigPair, DNACMDL::SurfaceHeader_2> (os, drs, pakRouter, entry, dummy, true, true, vertAttribs, m, head.secCount, 0, &head.secSizes[curSec]); os.format("obj.retro_disable_enviro_visor = %s\n"