metaforce/Runtime/Character/CAllFormatsAnimSource.hpp

56 lines
1.6 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2016-04-11 23:35:37 +00:00
#include "RetroTypes.hpp"
#include "zeus/CVector3f.hpp"
#include "CAnimSource.hpp"
2016-08-27 04:54:53 +00:00
#include "CFBStreamedCompression.hpp"
2016-04-12 06:15:32 +00:00
#include "CFactoryMgr.hpp"
2016-04-11 23:35:37 +00:00
namespace urde
{
class IObjectStore;
2016-08-27 04:54:53 +00:00
class IAnimReader;
2016-04-11 23:35:37 +00:00
enum class EAnimFormat
{
Uncompressed,
Unknown,
BitstreamCompressed,
BitstreamCompressed24
2016-04-11 23:35:37 +00:00
};
class CAnimFormatUnion
{
2016-08-28 19:57:55 +00:00
friend class CAllFormatsAnimSource;
2016-04-12 08:17:14 +00:00
union
{
EAnimFormat x0_format;
u8 _align[16];
2016-04-12 08:17:14 +00:00
};
2016-08-27 04:54:53 +00:00
u8 x4_storage[std::max(sizeof(CAnimSource), sizeof(CFBStreamedCompression))];
2016-04-11 23:35:37 +00:00
static void SubConstruct(u8* storage, EAnimFormat fmt,
CInputStream& in, IObjectStore& store);
public:
CAnimFormatUnion(CInputStream& in, IObjectStore& store);
2016-04-12 06:15:32 +00:00
~CAnimFormatUnion();
2016-09-04 02:27:35 +00:00
EAnimFormat GetFormat() const { return x0_format; }
const CAnimSource& GetAsCAnimSource() const { return *reinterpret_cast<const CAnimSource*>(x4_storage); }
const CFBStreamedCompression& GetAsCFBStreamedCompression() const { return *reinterpret_cast<const CFBStreamedCompression*>(x4_storage); }
2016-04-11 23:35:37 +00:00
};
class CAllFormatsAnimSource : public CAnimFormatUnion
{
zeus::CVector3f x68_;
SObjectTag x74_tag;
public:
CAllFormatsAnimSource(CInputStream& in, IObjectStore& store, const SObjectTag& tag);
2016-08-27 04:54:53 +00:00
static std::shared_ptr<IAnimReader> GetNewReader(const TLockedToken<CAllFormatsAnimSource>& tok,
const CCharAnimTime& startTime);
2016-04-11 23:35:37 +00:00
};
CFactoryFnReturn AnimSourceFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& params,
CObjectReference* selfRef);
2016-04-12 06:15:32 +00:00
2016-04-11 23:35:37 +00:00
}