metaforce/DataSpec/DNAMP1/MREA.hpp

141 lines
4.5 KiB
C++
Raw Normal View History

2015-08-17 05:26:58 +00:00
#ifndef __DNAMP1_MREA_HPP__
#define __DNAMP1_MREA_HPP__
2018-06-29 20:21:36 +00:00
#include "DataSpec/DNACommon/DNACommon.hpp"
2015-09-07 04:05:44 +00:00
#include "CMDLMaterials.hpp"
#include "CSKR.hpp"
2015-08-17 05:26:58 +00:00
2017-12-29 08:08:12 +00:00
namespace DataSpec::DNAMP1
2015-08-17 05:26:58 +00:00
{
2015-09-07 04:05:44 +00:00
struct MREA
2015-08-17 05:26:58 +00:00
{
2015-09-07 04:05:44 +00:00
struct Header : BigDNA
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
2015-09-07 04:05:44 +00:00
Value<atUint32> magic;
Value<atUint32> version;
Value<atVec4f> localToWorldMtx[3];
Value<atUint32> meshCount;
Value<atUint32> secCount;
Value<atUint32> geomSecIdx;
Value<atUint32> sclySecIdx;
Value<atUint32> collisionSecIdx;
Value<atUint32> unkSecIdx;
Value<atUint32> lightSecIdx;
Value<atUint32> visiSecIdx;
Value<atUint32> pathSecIdx;
Value<atUint32> arotSecIdx;
2018-02-25 08:23:27 +00:00
Vector<atUint32, AT_DNA_COUNT(secCount)> secSizes;
2015-09-07 04:05:44 +00:00
};
2015-08-17 05:26:58 +00:00
2015-09-07 04:05:44 +00:00
struct MeshHeader : BigDNA
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
2015-09-07 04:05:44 +00:00
struct VisorFlags : BigDNA
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
2015-09-07 04:05:44 +00:00
Value<atUint32> flags;
2015-11-21 01:16:07 +00:00
enum class ThermalLevel
2015-09-07 04:05:44 +00:00
{
2015-11-21 01:16:07 +00:00
Cool,
Hot,
Warm
2015-09-07 04:05:44 +00:00
};
static const char* GetThermalLevelStr(ThermalLevel t)
{
switch (t)
{
2015-11-21 01:16:07 +00:00
case ThermalLevel::Cool: return "COOL";
case ThermalLevel::Hot: return "HOT";
case ThermalLevel::Warm: return "WARM";
2015-09-07 04:05:44 +00:00
default: break;
}
return nullptr;
}
bool disableEnviro() const {return flags >> 1 & 0x1;}
void setDisableEnviro(bool v) {flags &= ~0x2; flags |= v << 1;}
bool disableThermal() const {return flags >> 2 & 0x1;}
void setDisableThermal(bool v) {flags &= ~0x4; flags |= v << 2;}
bool disableXray() const {return flags >> 3 & 0x1;}
void setDisableXray(bool v) {flags &= ~0x8; flags |= v << 3;}
ThermalLevel thermalLevel() const {return ThermalLevel(flags >> 4 & 0x3);}
2015-11-21 01:16:07 +00:00
void setThermalLevel(ThermalLevel v) {flags &= ~0x30; flags |= atUint32(v) << 4;}
2015-09-07 04:05:44 +00:00
const char* thermalLevelStr() const {return GetThermalLevelStr(thermalLevel());}
2016-08-10 02:52:00 +00:00
void setFromBlenderProps(const std::unordered_map<std::string, std::string>& props);
2015-09-07 04:05:44 +00:00
} visorFlags;
Value<atVec4f> xfMtx[3];
Value<atVec3f> aabb[2];
};
2015-09-12 07:13:40 +00:00
struct BabeDeadLight : BigDNA
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA
2015-11-21 01:16:07 +00:00
enum class LightType : atUint32
2015-09-12 07:13:40 +00:00
{
2015-11-21 01:16:07 +00:00
LocalAmbient,
Directional,
Custom,
Spot,
Spot2,
LocalAmbient2
2015-09-12 07:13:40 +00:00
};
2015-11-21 01:16:07 +00:00
enum class Falloff : atUint32
2015-09-12 07:13:40 +00:00
{
2015-11-21 01:16:07 +00:00
Constant,
Linear,
Quadratic
2015-09-12 07:13:40 +00:00
};
Value<LightType> lightType;
Value<atVec3f> color;
Value<atVec3f> position;
Value<atVec3f> direction;
Value<float> q;
Value<float> spotCutoff;
Value<float> unk5;
2016-04-26 10:40:56 +00:00
Value<bool> castShadows;
2015-09-12 07:13:40 +00:00
Value<float> unk7;
Value<Falloff> falloff;
Value<float> unk9;
};
2017-12-29 08:08:12 +00:00
static void ReadBabeDeadToBlender_1_2(hecl::blender::PyOutStream& os,
2016-03-04 23:04:53 +00:00
athena::io::IStreamReader& rs);
2015-09-12 07:13:40 +00:00
static void AddCMDLRigPairs(PAKEntryReadStream& rs,
PAKRouter<PAKBridge>& pakRouter,
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo);
2018-02-24 06:17:17 +00:00
static UniqueID32 GetPATHId(PAKEntryReadStream& rs);
2015-09-07 04:05:44 +00:00
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
2016-03-04 23:04:53 +00:00
const hecl::ProjectPath& outPath,
2015-09-07 04:05:44 +00:00
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool,
2017-12-29 08:08:12 +00:00
hecl::blender::Token& btok,
2016-03-04 23:04:53 +00:00
std::function<void(const hecl::SystemChar*)>);
static void Name(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
PAKRouter<PAKBridge>& pakRouter,
PAK::Entry& entry);
2016-08-10 02:52:00 +00:00
2017-12-29 08:08:12 +00:00
using ColMesh = hecl::blender::ColMesh;
using Light = hecl::blender::Light;
2016-08-10 02:52:00 +00:00
static bool Cook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const std::vector<DNACMDL::Mesh>& meshes,
const ColMesh& cMesh,
const std::vector<Light>& lights,
hecl::blender::Token& btok,
2018-04-07 20:55:57 +00:00
const hecl::blender::Matrix4f* xf,
bool pc);
2015-08-17 05:26:58 +00:00
};
}
#endif