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:
|
2020-03-31 03:52:22 +00:00
|
|
|
explicit CAnimFormatUnion(CInputStream& in, IObjectStore& store);
|
2018-12-08 05:30:43 +00:00
|
|
|
~CAnimFormatUnion();
|
|
|
|
EAnimFormat GetFormat() const { return x0_format; }
|
2020-03-13 08:11:17 +00:00
|
|
|
CAnimSource& GetAsCAnimSource() { return *reinterpret_cast<CAnimSource*>(x4_storage); }
|
|
|
|
CFBStreamedCompression& GetAsCFBStreamedCompression() {
|
|
|
|
return *reinterpret_cast<CFBStreamedCompression*>(x4_storage);
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
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:
|
2020-03-31 03:52:22 +00:00
|
|
|
explicit CAllFormatsAnimSource(CInputStream& in, IObjectStore& store, const SObjectTag& tag);
|
2018-12-08 05:30:43 +00:00
|
|
|
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
|