2016-04-13 06:07:23 +00:00
|
|
|
#ifndef __URDE_CANIMSOURCE_HPP__
|
|
|
|
#define __URDE_CANIMSOURCE_HPP__
|
2016-04-11 23:35:37 +00:00
|
|
|
|
|
|
|
#include "RetroTypes.hpp"
|
|
|
|
#include "CCharAnimTime.hpp"
|
|
|
|
#include "zeus/CQuaternion.hpp"
|
|
|
|
#include "zeus/CVector3f.hpp"
|
2016-04-12 06:15:32 +00:00
|
|
|
#include "CSegId.hpp"
|
2016-04-11 23:35:37 +00:00
|
|
|
#include "CToken.hpp"
|
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
class IObjectStore;
|
|
|
|
class CSegIdList;
|
|
|
|
class CSegStatementSet;
|
|
|
|
class CSegId;
|
|
|
|
class CAnimPOIData;
|
|
|
|
class CBoolPOINode;
|
|
|
|
class CInt32POINode;
|
|
|
|
class CParticlePOINode;
|
|
|
|
class CSoundPOINode;
|
|
|
|
|
|
|
|
class RotationAndOffsetStorage
|
|
|
|
{
|
|
|
|
friend class CAnimSource;
|
|
|
|
std::unique_ptr<float[]> x0_storage;
|
|
|
|
u32 x8_frameCount;
|
|
|
|
u32 xc_rotPerFrame;
|
|
|
|
u32 x10_transPerFrame;
|
|
|
|
|
|
|
|
std::unique_ptr<float[]> GetRotationsAndOffsets(const std::vector<zeus::CQuaternion>& rots,
|
|
|
|
const std::vector<zeus::CVector3f>& offs,
|
|
|
|
u32 frameCount);
|
|
|
|
static void CopyRotationsAndOffsets(const std::vector<zeus::CQuaternion>& rots,
|
|
|
|
const std::vector<zeus::CVector3f>& offs,
|
|
|
|
u32 frameCount, float*);
|
|
|
|
static u32 DataSizeInBytes(u32 rotPerFrame, u32 transPerFrame, u32 frameCount);
|
|
|
|
|
|
|
|
public:
|
|
|
|
struct CRotationAndOffsetVectors
|
|
|
|
{
|
|
|
|
std::vector<zeus::CQuaternion> x0_rotations;
|
|
|
|
std::vector<zeus::CVector3f> x10_offsets;
|
|
|
|
CRotationAndOffsetVectors(CInputStream& in);
|
|
|
|
};
|
|
|
|
u32 GetFrameSizeInBytes() const;
|
|
|
|
RotationAndOffsetStorage(const CRotationAndOffsetVectors& vectors, u32 frameCount);
|
|
|
|
};
|
|
|
|
|
|
|
|
class CAnimSource
|
|
|
|
{
|
2016-04-12 06:15:32 +00:00
|
|
|
friend class CAnimSourceInfo;
|
|
|
|
CCharAnimTime x0_duration;
|
2016-04-12 22:28:08 +00:00
|
|
|
CCharAnimTime x8_interval;
|
2016-04-11 23:35:37 +00:00
|
|
|
u32 x10_frameCount;
|
2016-04-12 06:15:32 +00:00
|
|
|
CSegId x1c_rootBone;
|
2016-04-11 23:35:37 +00:00
|
|
|
std::vector<u8> x20_rotationChannels;
|
|
|
|
std::vector<u8> x30_translationChannels;
|
|
|
|
RotationAndOffsetStorage x40_data;
|
2016-04-14 21:42:47 +00:00
|
|
|
ResId x54_evntId;
|
2016-04-11 23:35:37 +00:00
|
|
|
TCachedToken<CAnimPOIData> x58_evntData;
|
|
|
|
float x60_averageVelocity;
|
|
|
|
|
|
|
|
void CalcAverageVelocity();
|
|
|
|
|
|
|
|
public:
|
|
|
|
CAnimSource(CInputStream& in, IObjectStore& store);
|
|
|
|
|
|
|
|
void GetSegStatementSet(const CSegIdList& list,
|
|
|
|
CSegStatementSet& set,
|
|
|
|
const CCharAnimTime& time) const;
|
|
|
|
|
|
|
|
const std::vector<CSoundPOINode>& GetSoundPOIStream() const;
|
|
|
|
const std::vector<CParticlePOINode>& GetParticlePOIStream() const;
|
|
|
|
const std::vector<CInt32POINode>& GetInt32POIStream() const;
|
|
|
|
const std::vector<CBoolPOINode>& GetBoolPOIStream() const;
|
2016-04-16 03:24:25 +00:00
|
|
|
const TCachedToken<CAnimPOIData>& GetPOIData() const {return x58_evntData;}
|
2016-04-11 23:35:37 +00:00
|
|
|
zeus::CQuaternion GetRotation(const CSegId& seg, const CCharAnimTime& time) const;
|
|
|
|
zeus::CVector3f GetOffset(const CSegId& seg, const CCharAnimTime& time) const;
|
|
|
|
bool HasOffset(const CSegId& seg) const;
|
2016-04-12 06:15:32 +00:00
|
|
|
const CCharAnimTime& GetDuration() const {return x0_duration;}
|
|
|
|
const CSegId& GetRootBoneId() const {return x1c_rootBone;}
|
2016-04-11 23:35:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-04-13 06:07:23 +00:00
|
|
|
#endif // __URDE_CANIMSOURCE_HPP__
|