metaforce/DataSpec/DNAMP2/CMDL.hpp

54 lines
1.6 KiB
C++
Raw Normal View History

#ifndef _DNAMP2_CMDL_HPP_
#define _DNAMP2_CMDL_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/CMDL.hpp"
#include "CMDLMaterials.hpp"
#include "DNAMP2.hpp"
2015-08-13 07:29:00 +00:00
#include "CINF.hpp"
#include "CSKR.hpp"
2016-02-13 09:02:47 +00:00
namespace DataSpec
{
namespace DNAMP2
{
struct CMDL
{
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
2016-03-04 23:04:53 +00:00
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
2015-08-11 23:32:02 +00:00
const DNAMP1::PAK::Entry& entry,
bool,
2016-04-01 04:25:00 +00:00
hecl::BlenderToken& btok,
2016-03-04 23:04:53 +00:00
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 */
2016-04-01 04:25:00 +00:00
hecl::BlenderConnection& conn = btok.getBlenderConnection();
2016-03-04 23:04:53 +00:00
if (!conn.createBlend(outPath, hecl::BlenderConnection::BlendType::Mesh))
return false;
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_2, 4>
(conn, rs, pakRouter, entry, dataSpec, loadRp);
return conn.saveBlend();
}
};
}
}
#endif // _DNAMP2_CMDL_HPP_