2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-08-26 22:23:59 +00:00
|
|
|
|
2019-09-28 02:53:03 +00:00
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "Runtime/CToken.hpp"
|
|
|
|
#include "Runtime/RetroTypes.hpp"
|
|
|
|
#include "Runtime/Character/CAnimPOIData.hpp"
|
|
|
|
|
|
|
|
#include <zeus/CVector3f.hpp>
|
2016-08-26 22:23:59 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2016-08-26 22:23:59 +00:00
|
|
|
class IObjectStore;
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CFBStreamedCompression {
|
|
|
|
friend class CFBStreamedAnimReader;
|
|
|
|
friend class CFBStreamedAnimReaderTotals;
|
|
|
|
friend class CFBStreamedPairOfTotals;
|
2016-08-26 22:23:59 +00:00
|
|
|
|
2016-08-27 21:16:44 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
struct Header {
|
|
|
|
u32 unk0;
|
|
|
|
float duration;
|
|
|
|
float interval;
|
|
|
|
u32 rootBoneId;
|
|
|
|
u32 looping;
|
|
|
|
u32 rotDiv;
|
|
|
|
float translationMult;
|
|
|
|
u32 boneChannelCount;
|
|
|
|
u32 unk3;
|
2016-08-26 22:23:59 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void read(CInputStream& in) {
|
|
|
|
/* unk0 */
|
2022-02-18 07:37:54 +00:00
|
|
|
unk0 = in.ReadLong();
|
2018-12-08 05:30:43 +00:00
|
|
|
/* duration */
|
2022-02-18 07:37:54 +00:00
|
|
|
duration = in.ReadFloat();
|
2018-12-08 05:30:43 +00:00
|
|
|
/* interval */
|
2022-02-18 07:37:54 +00:00
|
|
|
interval = in.ReadFloat();
|
2018-12-08 05:30:43 +00:00
|
|
|
/* rootBoneId */
|
2022-02-18 07:37:54 +00:00
|
|
|
rootBoneId = in.ReadLong();
|
2018-12-08 05:30:43 +00:00
|
|
|
/* looping */
|
2022-02-18 07:37:54 +00:00
|
|
|
looping = in.ReadLong();
|
2018-12-08 05:30:43 +00:00
|
|
|
/* rotDiv */
|
2022-02-18 07:37:54 +00:00
|
|
|
rotDiv = in.ReadLong();
|
2018-12-08 05:30:43 +00:00
|
|
|
/* translationMult */
|
2022-02-18 07:37:54 +00:00
|
|
|
translationMult = in.ReadFloat();
|
2018-12-08 05:30:43 +00:00
|
|
|
/* boneChannelCount */
|
2022-02-18 07:37:54 +00:00
|
|
|
boneChannelCount = in.ReadLong();
|
2018-12-08 05:30:43 +00:00
|
|
|
/* unk3 */
|
2022-02-18 07:37:54 +00:00
|
|
|
unk3 = in.ReadLong();
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
};
|
2016-08-26 22:23:59 +00:00
|
|
|
|
2016-08-27 21:16:44 +00:00
|
|
|
private:
|
2018-12-08 05:30:43 +00:00
|
|
|
bool m_pc;
|
|
|
|
u32 x0_scratchSize;
|
|
|
|
CAssetId x4_evnt;
|
|
|
|
TLockedToken<CAnimPOIData> x8_evntToken;
|
|
|
|
std::unique_ptr<u32[]> xc_rotsAndOffs;
|
|
|
|
float x10_averageVelocity;
|
|
|
|
zeus::CVector3f x14_rootOffset;
|
2016-08-26 22:23:59 +00:00
|
|
|
|
2019-08-14 10:04:11 +00:00
|
|
|
u8* ReadBoneChannelDescriptors(u8* out, CInputStream& in) const;
|
|
|
|
u32 ComputeBitstreamWords(const u8* chans) const;
|
|
|
|
std::unique_ptr<u32[]> GetRotationsAndOffsets(u32 words, CInputStream& in) const;
|
|
|
|
float CalculateAverageVelocity(const u8* chans) const;
|
2016-08-27 21:16:44 +00:00
|
|
|
|
2016-08-26 22:23:59 +00:00
|
|
|
public:
|
2020-03-31 03:52:22 +00:00
|
|
|
explicit CFBStreamedCompression(CInputStream& in, IObjectStore& objStore, bool pc);
|
2018-12-08 05:30:43 +00:00
|
|
|
const Header& MainHeader() const { return *reinterpret_cast<const Header*>(xc_rotsAndOffs.get()); }
|
|
|
|
const u32* GetTimes() const;
|
|
|
|
const u8* GetPerChannelHeaders() const;
|
|
|
|
const u8* GetBitstreamPointer() const;
|
|
|
|
bool IsLooping() const { return MainHeader().looping; }
|
|
|
|
CCharAnimTime GetAnimationDuration() const { return MainHeader().duration; }
|
|
|
|
float GetAverageVelocity() const { return x10_averageVelocity; }
|
|
|
|
const zeus::CVector3f& GetRootOffset() const { return x14_rootOffset; }
|
2020-03-09 01:10:15 +00:00
|
|
|
bool HasPOIData() const { return x8_evntToken.HasReference(); }
|
2018-12-08 05:30:43 +00:00
|
|
|
const std::vector<CBoolPOINode>& GetBoolPOIStream() const { return x8_evntToken->GetBoolPOIStream(); }
|
|
|
|
const std::vector<CInt32POINode>& GetInt32POIStream() const { return x8_evntToken->GetInt32POIStream(); }
|
|
|
|
const std::vector<CParticlePOINode>& GetParticlePOIStream() const { return x8_evntToken->GetParticlePOIStream(); }
|
|
|
|
const std::vector<CSoundPOINode>& GetSoundPOIStream() const { return x8_evntToken->GetSoundPOIStream(); }
|
2016-08-26 22:23:59 +00:00
|
|
|
};
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|