2015-07-25 03:43:49 +00:00
|
|
|
#ifndef _DNAMP1_CMDL_HPP_
|
|
|
|
#define _DNAMP1_CMDL_HPP_
|
|
|
|
|
|
|
|
#include "../DNACommon/DNACommon.hpp"
|
|
|
|
#include "CMDLMaterials.hpp"
|
2015-07-28 02:24:36 +00:00
|
|
|
#include "BlenderConnection.hpp"
|
2015-08-04 02:14:47 +00:00
|
|
|
#include "DNAMP1.hpp"
|
2015-07-25 03:43:49 +00:00
|
|
|
|
|
|
|
namespace Retro
|
|
|
|
{
|
|
|
|
namespace DNAMP1
|
|
|
|
{
|
|
|
|
|
2015-07-28 02:24:36 +00:00
|
|
|
struct CMDL
|
2015-07-25 03:43:49 +00:00
|
|
|
{
|
2015-07-28 02:24:36 +00:00
|
|
|
struct Header : BigDNA
|
|
|
|
{
|
|
|
|
DECL_DNA
|
|
|
|
Value<atUint32> magic;
|
|
|
|
Value<atUint32> version;
|
2015-07-28 23:53:57 +00:00
|
|
|
struct Flags : BigDNA
|
2015-07-28 02:24:36 +00:00
|
|
|
{
|
|
|
|
DECL_DNA
|
|
|
|
Value<atUint32> flags;
|
|
|
|
inline bool shortNormals() const {return (flags & 0x2) != 0;}
|
|
|
|
inline void setShortNormals(bool val) {flags &= ~0x2; flags |= val << 1;}
|
|
|
|
inline bool shortUVs() const {return (flags & 0x4) != 0;}
|
|
|
|
inline void setShortUVs(bool val) {flags &= ~0x4; flags |= val << 2;}
|
|
|
|
} flags;
|
|
|
|
Value<atVec3f> aabbMin;
|
|
|
|
Value<atVec3f> aabbMax;
|
|
|
|
Value<atUint32> secCount;
|
|
|
|
Value<atUint32> matSetCount;
|
|
|
|
Vector<atUint32, DNA_COUNT(secCount)> secSizes;
|
2015-07-28 23:53:57 +00:00
|
|
|
Align<32> align;
|
2015-07-28 02:24:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SurfaceHeader : BigDNA
|
|
|
|
{
|
|
|
|
DECL_DNA
|
|
|
|
Value<atVec3f> centroid;
|
|
|
|
Value<atUint32> matIdx;
|
|
|
|
Value<atInt16> qDiv;
|
|
|
|
Value<atUint16> dlSize;
|
|
|
|
Seek<8, Athena::Current> seek;
|
|
|
|
Value<atUint32> aabbSz;
|
|
|
|
Value<atVec3f> reflectionNormal;
|
|
|
|
Seek<DNA_COUNT(aabbSz), Athena::Current> seek2;
|
|
|
|
Align<32> align;
|
|
|
|
};
|
|
|
|
|
2015-08-04 02:14:47 +00:00
|
|
|
static bool ReadToBlender(HECL::BlenderConnection& conn,
|
|
|
|
Athena::io::IStreamReader& reader,
|
|
|
|
PAKRouter<PAKBridge>& pakRouter);
|
2015-07-28 02:24:36 +00:00
|
|
|
|
2015-08-04 02:14:47 +00:00
|
|
|
static bool Extract(PAKEntryReadStream& rs,
|
|
|
|
const HECL::ProjectPath& outPath,
|
|
|
|
PAKRouter<PAKBridge>& pakRouter)
|
2015-07-28 02:24:36 +00:00
|
|
|
{
|
|
|
|
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
|
|
|
|
if (!conn.createBlend(outPath.getAbsolutePath()))
|
|
|
|
return false;
|
2015-08-04 02:14:47 +00:00
|
|
|
return ReadToBlender(conn, rs, pakRouter);
|
2015-07-28 02:24:36 +00:00
|
|
|
}
|
2015-07-25 03:43:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // _DNAMP1_CMDL_HPP_
|