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