2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 21:07:42 +00:00

initial HMDL/CMDL implementation

This commit is contained in:
Jack Andersen
2015-11-13 16:28:45 -10:00
parent 9bbe5da6da
commit 79cf5f12ca
6 changed files with 370 additions and 42 deletions

View File

@@ -53,7 +53,7 @@ struct CMDL
/* Cook and re-extract test */
HECL::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"), true);
HECL::BlenderConnection::DataStream ds = conn.beginData();
DNACMDL::Mesh mesh = ds.compileMesh(DNACMDL::Mesh::OutputTriStrips, -1);
DNACMDL::Mesh mesh = ds.compileMesh(HECL::TopologyTriStrips, -1);
ds.close();
DNACMDL::WriteCMDL<MaterialSet, DNACMDL::SurfaceHeader_1_2, 2>(tempOut, outPath, mesh);
@@ -108,6 +108,34 @@ struct CMDL
return false;
return true;
}
static bool HMDLCook(const HECL::ProjectPath& outPath,
const HECL::ProjectPath& inPath,
const DNACMDL::Mesh& mesh)
{
HECL::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"));
if (mesh.skins.size())
{
if (!DNACMDL::WriteHMDLCMDL<HMDLMaterialSet, DNACMDL::SurfaceHeader_1_2, 2>(tempOut, inPath, mesh))
return false;
/* Output skinning intermediate */
Athena::io::FileWriter writer(outPath.getWithExtension(_S(".skin")).getAbsolutePath());
writer.writeUint32Big(mesh.skinBanks.banks.size());
for (const DNACMDL::Mesh::SkinBanks::Bank& sb : mesh.skinBanks.banks)
{
writer.writeUint32Big(sb.m_boneIdxs.size());
for (uint32_t bind : sb.m_boneIdxs)
writer.writeUint32Big(bind);
}
writer.writeUint32Big(mesh.boneNames.size());
for (const std::string& boneName : mesh.boneNames)
writer.writeString(boneName);
}
else if (!DNACMDL::WriteHMDLCMDL<HMDLMaterialSet, DNACMDL::SurfaceHeader_1_2, 2>(tempOut, inPath, mesh))
return false;
return true;
}
};
}