2015-08-10 01:53:24 +00:00
|
|
|
#ifndef _DNAMP3_CMDL_HPP_
|
|
|
|
#define _DNAMP3_CMDL_HPP_
|
|
|
|
|
|
|
|
#include "../DNACommon/DNACommon.hpp"
|
|
|
|
#include "../DNACommon/CMDL.hpp"
|
|
|
|
#include "CMDLMaterials.hpp"
|
|
|
|
#include "DNAMP3.hpp"
|
2015-08-13 07:29:00 +00:00
|
|
|
#include "CINF.hpp"
|
|
|
|
#include "CSKR.hpp"
|
2015-08-10 01:53:24 +00:00
|
|
|
|
|
|
|
namespace Retro
|
|
|
|
{
|
|
|
|
namespace DNAMP3
|
|
|
|
{
|
|
|
|
|
|
|
|
struct CMDL
|
|
|
|
{
|
|
|
|
static bool Extract(const SpecBase& dataSpec,
|
|
|
|
PAKEntryReadStream& rs,
|
|
|
|
const HECL::ProjectPath& outPath,
|
|
|
|
PAKRouter<PAKBridge>& pakRouter,
|
2015-08-11 23:32:02 +00:00
|
|
|
const PAK::Entry& entry,
|
2015-10-01 00:40:21 +00:00
|
|
|
bool,
|
|
|
|
std::function<void(const HECL::SystemChar*)>)
|
2015-08-10 01:53:24 +00:00
|
|
|
{
|
2015-09-06 05:34:30 +00:00
|
|
|
/* 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 */
|
2015-08-10 01:53:24 +00:00
|
|
|
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
|
2015-11-21 01:16:07 +00:00
|
|
|
if (!conn.createBlend(outPath, HECL::BlenderConnection::BlendType::Mesh))
|
2015-08-10 01:53:24 +00:00
|
|
|
return false;
|
2015-09-26 03:12:08 +00:00
|
|
|
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_3, 5>
|
2015-09-06 05:34:30 +00:00
|
|
|
(conn, rs, pakRouter, entry, dataSpec, loadRp);
|
2015-08-10 01:53:24 +00:00
|
|
|
return conn.saveBlend();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // _DNAMP3_CMDL_HPP_
|