mirror of https://github.com/AxioDL/metaforce.git
53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
#ifndef _DNAMP2_CMDL_HPP_
|
|
#define _DNAMP2_CMDL_HPP_
|
|
|
|
#include "../DNACommon/DNACommon.hpp"
|
|
#include "../DNACommon/CMDL.hpp"
|
|
#include "CMDLMaterials.hpp"
|
|
#include "DNAMP2.hpp"
|
|
#include "CINF.hpp"
|
|
#include "CSKR.hpp"
|
|
|
|
namespace Retro
|
|
{
|
|
namespace DNAMP2
|
|
{
|
|
|
|
struct CMDL
|
|
{
|
|
static bool Extract(const SpecBase& dataSpec,
|
|
PAKEntryReadStream& rs,
|
|
const HECL::ProjectPath& outPath,
|
|
PAKRouter<PAKBridge>& pakRouter,
|
|
const DNAMP1::PAK::Entry& entry,
|
|
bool,
|
|
std::function<void(const HECL::SystemChar*)>)
|
|
{
|
|
/* Check for RigPair */
|
|
const PAKRouter<PAKBridge>::RigPair* rp = pakRouter.lookupCMDLRigPair(entry.id);
|
|
CINF cinf;
|
|
CSKR cskr;
|
|
std::pair<CSKR*,CINF*> loadRp(nullptr, nullptr);
|
|
if (rp)
|
|
{
|
|
pakRouter.lookupAndReadDNA(rp->first, cskr);
|
|
pakRouter.lookupAndReadDNA(rp->second, cinf);
|
|
loadRp.first = &cskr;
|
|
loadRp.second = &cinf;
|
|
}
|
|
|
|
/* Do extract */
|
|
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
|
|
if (!conn.createBlend(outPath.getAbsolutePath(), HECL::BlenderConnection::TypeMesh))
|
|
return false;
|
|
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_1_2, 4>
|
|
(conn, rs, pakRouter, entry, dataSpec, loadRp);
|
|
return conn.saveBlend();
|
|
}
|
|
};
|
|
|
|
}
|
|
}
|
|
|
|
#endif // _DNAMP2_CMDL_HPP_
|