This commit is contained in:
Jack Andersen 2016-01-14 17:38:18 -10:00
commit 1f86c82165
9 changed files with 63 additions and 15 deletions

View File

@ -38,7 +38,7 @@ struct Header : BigDNA
Align<32> align;
};
struct SurfaceHeader_1_2 : BigDNA
struct SurfaceHeader_1 : BigDNA
{
DECL_DNA
Value<atVec3f> centroid;
@ -56,6 +56,26 @@ struct SurfaceHeader_1_2 : BigDNA
static constexpr atInt16 skinMatrixBankIdx() {return -1;}
};
struct SurfaceHeader_2 : BigDNA
{
DECL_DNA
Value<atVec3f> centroid;
Value<atUint32> matIdx = 0;
Value<atUint16> qDiv = 0x8000;
Value<atUint16> dlSize = 0;
Value<atUint32> unk1 = 0;
Value<atUint32> unk2 = 0;
Value<atUint32> aabbSz = 0;
Value<atVec3f> reflectionNormal;
Value<atInt16> skinMtxBankIdx;
Value<atUint16> surfaceGroup;
Seek<DNA_COUNT(aabbSz), Athena::Current> 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<atUint32> aabbSz = 0;
Value<atVec3f> reflectionNormal;
Value<atInt16> skinMtxBankIdx;
Value<atUint16> unk3;
Value<atUint16> surfaceGroup;
Seek<DNA_COUNT(aabbSz), Athena::Current> seek2;
Value<atUint8> unk3;
Align<32> align;
static constexpr bool UseMatrixSkinning() {return true;}

View File

@ -1,6 +1,7 @@
make_dnalist(liblist
CMDL
MAPA)
MAPA
EGMC)
add_library(DNACommon
DNACommon.hpp DNACommon.cpp

View File

@ -0,0 +1,26 @@
#ifndef _DNACOMMON_EGMC_HPP_
#define _DNACOMMON_EGMC_HPP_
#include "DNACommon.hpp"
namespace Retro
{
namespace DNACommon
{
struct EGMC : public BigDNA
{
DECL_DNA
Value<atUint32> count;
struct Object : BigDNA
{
DECL_DNA
Value<atUint32> mesh;
Value<atUint32> instanceId;
};
Vector<Object, DNA_COUNT(count)> objects;
};
}
}
#endif // _DNACOMMON_EGMC_HPP_

View File

@ -418,7 +418,7 @@ struct ANCS : BigYAML
if (force || blendType == HECL::ProjectPath::Type::None)
{
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
DNAANCS::ReadANCSToBlender<PAKRouter<PAKBridge>, ANCS, MaterialSet, DNACMDL::SurfaceHeader_1_2, 2>
DNAANCS::ReadANCSToBlender<PAKRouter<PAKBridge>, ANCS, MaterialSet, DNACMDL::SurfaceHeader_1, 2>
(conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
}
}

View File

@ -42,7 +42,7 @@ struct CMDL
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
if (!conn.createBlend(outPath, HECL::BlenderConnection::BlendType::Mesh))
return false;
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_1_2, 2>
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_1, 2>
(conn, rs, pakRouter, entry, dataSpec, loadRp);
conn.saveBlend();
@ -61,13 +61,13 @@ struct CMDL
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, 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<HMDLMaterialSet, DNACMDL::SurfaceHeader_1_2, 2>(tempOut, outPath, mesh);
DNACMDL::WriteHMDLCMDL<HMDLMaterialSet, DNACMDL::SurfaceHeader_1, 2>(tempOut, outPath, mesh);
#endif
return true;
@ -89,7 +89,7 @@ struct CMDL
if (mesh.skins.size())
{
DNACMDL::Mesh skinMesh = mesh.getContiguousSkinningVersion();
if (!DNACMDL::WriteCMDL<MaterialSet, DNACMDL::SurfaceHeader_1_2, 2>(tempOut, inPath, skinMesh))
if (!DNACMDL::WriteCMDL<MaterialSet, DNACMDL::SurfaceHeader_1, 2>(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<MaterialSet, DNACMDL::SurfaceHeader_1_2, 2>(tempOut, inPath, mesh))
else if (!DNACMDL::WriteCMDL<MaterialSet, DNACMDL::SurfaceHeader_1, 2>(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<HMDLMaterialSet, DNACMDL::SurfaceHeader_1_2, 2>(tempOut, inPath, mesh))
if (!DNACMDL::WriteHMDLCMDL<HMDLMaterialSet, DNACMDL::SurfaceHeader_1, 2>(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<HMDLMaterialSet, DNACMDL::SurfaceHeader_1_2, 2>(tempOut, inPath, mesh))
else if (!DNACMDL::WriteHMDLCMDL<HMDLMaterialSet, DNACMDL::SurfaceHeader_1, 2>(tempOut, inPath, mesh))
return false;
return true;
}

View File

@ -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<PAKRouter<PAKBridge>, MaterialSet, RigPair, DNACMDL::SurfaceHeader_1_2>
curSec += DNACMDL::ReadGeomSectionsToBlender<PAKRouter<PAKBridge>, 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"

View File

@ -241,7 +241,7 @@ struct ANCS : BigYAML
if (force || blendType == HECL::ProjectPath::Type::None)
{
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
DNAANCS::ReadANCSToBlender<PAKRouter<PAKBridge>, ANCS, MaterialSet, DNACMDL::SurfaceHeader_1_2, 4>
DNAANCS::ReadANCSToBlender<PAKRouter<PAKBridge>, ANCS, MaterialSet, DNACMDL::SurfaceHeader_2, 4>
(conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
}
}

View File

@ -40,7 +40,7 @@ struct CMDL
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
if (!conn.createBlend(outPath, HECL::BlenderConnection::BlendType::Mesh))
return false;
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_1_2, 4>
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_2, 4>
(conn, rs, pakRouter, entry, dataSpec, loadRp);
return conn.saveBlend();
}

View File

@ -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<PAKRouter<PAKBridge>, MaterialSet, RigPair, DNACMDL::SurfaceHeader_1_2>
curSec += DNACMDL::ReadGeomSectionsToBlender<PAKRouter<PAKBridge>, 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"