metaforce/DataSpec/DNAMP3/MREA.hpp

133 lines
3.5 KiB
C++
Raw Normal View History

2015-09-20 06:09:27 +00:00
#ifndef __DNAMP3_MREA_HPP__
#define __DNAMP3_MREA_HPP__
#include "../DNACommon/DNACommon.hpp"
#include "CMDLMaterials.hpp"
#include "CSKR.hpp"
#include "../DNAMP2/MREA.hpp"
2016-02-13 09:02:47 +00:00
namespace DataSpec
2015-09-20 06:09:27 +00:00
{
namespace DNAMP3
{
struct MREA
{
2015-09-23 06:35:07 +00:00
struct StreamReader : DNAMP2::MREA::StreamReader
2015-09-20 06:09:27 +00:00
{
std::vector<std::pair<DNAFourCC, atUint32>> m_secIdxs;
2016-03-04 23:04:53 +00:00
StreamReader(athena::io::IStreamReader& source,
2015-09-20 06:09:27 +00:00
atUint32 blkCount, atUint32 secIdxCount);
std::vector<std::pair<DNAFourCC, atUint32>>::const_iterator beginSecIdxs()
{
return m_secIdxs.begin();
}
2016-03-04 23:04:53 +00:00
void writeSecIdxs(athena::io::IStreamWriter& writer) const;
2015-09-20 06:09:27 +00:00
};
struct Header : BigDNA
{
DECL_DNA
Value<atUint32> magic;
Value<atUint32> version;
Value<atVec4f> localToWorldMtx[3];
Value<atUint32> meshCount;
Value<atUint32> sclyLayerCount;
Value<atUint32> secCount;
Value<atUint32> compressedBlockCount;
Value<atUint32> secIndexCount;
2016-03-04 23:04:53 +00:00
Seek<20, athena::Current> align1;
2015-09-20 06:09:27 +00:00
Vector<atUint32, DNA_COUNT(secCount)> secSizes;
2015-09-23 06:35:07 +00:00
atUint32 getSecOffset(atUint32 idx) const
{
if (idx >= secSizes.size())
return -1;
atUint32 retval = 0;
for (atUint32 i=0 ; i<idx ; ++i)
retval += secSizes[i];
return retval;
}
2015-09-20 06:09:27 +00:00
};
struct MeshHeader : BigDNA
{
DECL_DNA
struct VisorFlags : BigDNA
{
DECL_DNA
Value<atUint32> flags;
} visorFlags;
Value<atVec4f> xfMtx[3];
Value<atVec3f> aabb[2];
};
2015-09-23 06:35:07 +00:00
struct DEPS : BigDNA
{
DECL_DNA
Value<atUint32> depCount;
struct Dependency : BigDNA
{
DECL_DNA
UniqueID64 id;
DNAFourCC type;
};
Vector<Dependency, DNA_COUNT(depCount)> deps;
Value<atUint32> depLayerCount;
Vector<atUint32, DNA_COUNT(depLayerCount)> depLayers;
};
2015-09-20 06:09:27 +00:00
struct BabeDeadLight : BigDNA
{
DECL_DNA
2015-11-21 01:16:07 +00:00
enum class LightType : atUint32
2015-09-20 06:09:27 +00:00
{
2015-11-21 01:16:07 +00:00
LocalAmbient,
Directional,
Custom,
Spot,
Spot2,
LocalAmbient2
2015-09-20 06:09:27 +00:00
};
2015-11-21 01:16:07 +00:00
enum class Falloff : atUint32
2015-09-28 05:19:31 +00:00
{
2015-11-21 01:16:07 +00:00
Constant,
Linear,
Quadratic
2015-09-28 05:19:31 +00:00
};
2015-09-20 06:09:27 +00:00
Value<LightType> lightType;
Value<atVec4f> color;
Value<atVec3f> position;
2015-09-23 01:15:11 +00:00
Value<atVec3f> direction;
Value<atVec3f> codirection;
2015-09-28 05:19:31 +00:00
Value<float> q;
Value<float> spotCutoff;
2015-09-23 01:15:11 +00:00
Value<float> unk7;
Value<atUint8> unk8;
2015-09-28 05:19:31 +00:00
Value<float> unk9;
Value<Falloff> falloff;
2015-09-26 03:12:08 +00:00
Value<float> unk11;
2015-09-20 06:09:27 +00:00
Value<atVec4f> unk12;
Value<atUint32> unk13;
};
2016-03-04 23:04:53 +00:00
static void ReadBabeDeadToBlender_3(hecl::BlenderConnection::PyOutStream& os,
athena::io::IStreamReader& rs);
2015-09-20 06:09:27 +00:00
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
2016-03-04 23:04:53 +00:00
const hecl::ProjectPath& outPath,
2015-09-20 06:09:27 +00:00
PAKRouter<PAKBridge>& pakRouter,
const 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*)>);
2015-09-23 06:35:07 +00:00
static bool ExtractLayerDeps(PAKEntryReadStream& rs, PAKBridge::Level::Area& areaOut);
2015-09-20 06:09:27 +00:00
};
}
}
#endif // __DNAMP3_MREA_HPP__