metaforce/DataSpec/DNAMP3/ANIM.hpp

124 lines
3.0 KiB
C++
Raw Normal View History

2015-09-24 00:59:36 +00:00
#ifndef _DNAMP3_ANIM_HPP_
#define _DNAMP3_ANIM_HPP_
#include "BlenderConnection.hpp"
#include "DNAMP3.hpp"
#include "../DNACommon/ANIM.hpp"
#include "CINF.hpp"
2016-02-13 09:02:47 +00:00
namespace DataSpec
2015-09-24 00:59:36 +00:00
{
namespace DNAMP3
{
struct ANIM : BigDNA
{
Delete expl;
struct IANIM : BigDNA
{
Delete expl;
atUint32 m_version;
IANIM(atUint32 version) : m_version(version) {}
std::vector<std::pair<atUint32, std::tuple<bool,bool,bool>>> bones;
std::vector<atUint32> frames;
std::vector<DNAANIM::Channel> channels;
std::vector<std::vector<DNAANIM::Value>> chanKeys;
float mainInterval = 0.0;
2016-03-04 23:04:53 +00:00
void sendANIMToBlender(hecl::BlenderConnection::PyOutStream&, const CINF&, bool additive) const;
2015-09-24 00:59:36 +00:00
};
struct ANIM0 : IANIM
{
DECL_EXPLICIT_DNA
ANIM0() : IANIM(0) {}
struct Header : BigDNA
{
DECL_DNA
2015-09-27 03:05:43 +00:00
Value<atUint16> unkS;
2015-09-24 00:59:36 +00:00
Value<float> duration;
Value<atUint32> unk0;
Value<float> interval;
Value<atUint32> unk1;
Value<atUint32> keyCount;
Value<atUint32> unk2;
Value<atUint32> boneSlotCount;
};
};
2015-09-26 03:12:08 +00:00
struct ANIM1 : IANIM
2015-09-24 00:59:36 +00:00
{
DECL_EXPLICIT_DNA
2015-09-26 03:12:08 +00:00
ANIM1() : IANIM(1) {}
2015-09-24 00:59:36 +00:00
struct Header : BigDNA
{
DECL_DNA
2015-09-26 03:12:08 +00:00
Value<atUint16> unk1;
2015-09-24 00:59:36 +00:00
Value<atUint8> unk2;
Value<atUint32> unk3;
2015-09-26 03:12:08 +00:00
Value<atUint8> unk4[3];
2015-09-24 00:59:36 +00:00
Value<float> translationMult;
Value<atUint32> unk6;
2015-09-26 03:12:08 +00:00
Value<atUint32> unk7;
Value<float> unk8;
Value<float> unk9;
Value<float> duration;
Value<atUint16> keyCount;
Value<atUint32> blobSize;
Value<atUint8> unk10;
Value<atUint32> floatsSize;
Value<atUint32> flagsSize;
Value<atUint32> initBlockSize;
Value<atUint32> streamSize;
Value<atUint32> unk11;
Value<atUint32> boneCount;
2015-09-24 00:59:36 +00:00
};
};
std::unique_ptr<IANIM> m_anim;
2016-03-04 23:04:53 +00:00
void read(athena::io::IStreamReader& reader)
2015-09-24 00:59:36 +00:00
{
atUint32 version = reader.readUint32Big();
switch (version)
{
case 0:
m_anim.reset(new struct ANIM0);
m_anim->read(reader);
break;
2015-09-26 03:12:08 +00:00
case 1:
m_anim.reset(new struct ANIM1);
2015-09-24 00:59:36 +00:00
m_anim->read(reader);
break;
default:
2016-03-04 23:04:53 +00:00
Log.report(logvisor::Fatal, "unrecognized ANIM version");
2015-09-24 00:59:36 +00:00
break;
}
}
2016-03-04 23:04:53 +00:00
void write(athena::io::IStreamWriter& writer) const
2015-09-24 00:59:36 +00:00
{
writer.writeUint32Big(m_anim->m_version);
m_anim->write(writer);
}
size_t binarySize(size_t __isz) const
{
return m_anim->binarySize(__isz + 4);
}
2016-03-04 23:04:53 +00:00
void sendANIMToBlender(hecl::BlenderConnection::PyOutStream& os, const CINF& cinf, bool additive) const
2015-09-24 00:59:36 +00:00
{
m_anim->sendANIMToBlender(os, cinf, additive);
2015-09-24 00:59:36 +00:00
}
};
}
}
#endif // _DNAMP3_ANIM_HPP_