mirror of https://github.com/AxioDL/metaforce.git
More AnimSourceReader imps
This commit is contained in:
parent
faacffba77
commit
41f482daeb
|
@ -11,6 +11,8 @@
|
||||||
#include "Runtime/Graphics/CTexture.hpp"
|
#include "Runtime/Graphics/CTexture.hpp"
|
||||||
#include "Runtime/Character/CCharLayoutInfo.hpp"
|
#include "Runtime/Character/CCharLayoutInfo.hpp"
|
||||||
#include "Runtime/Character/CAnimCharacterSet.hpp"
|
#include "Runtime/Character/CAnimCharacterSet.hpp"
|
||||||
|
#include "Runtime/Character/CAllFormatsAnimSource.hpp"
|
||||||
|
#include "Runtime/Character/CAnimPOIData.hpp"
|
||||||
|
|
||||||
#include "DataSpec/DNACommon/TXTR.hpp"
|
#include "DataSpec/DNACommon/TXTR.hpp"
|
||||||
|
|
||||||
|
@ -33,6 +35,8 @@ ProjectResourceFactoryMP1::ProjectResourceFactoryMP1(hecl::ClientProcess& client
|
||||||
m_factoryMgr.AddFactory(FOURCC('CMDL'), FMemFactoryFunc(FModelFactory));
|
m_factoryMgr.AddFactory(FOURCC('CMDL'), FMemFactoryFunc(FModelFactory));
|
||||||
m_factoryMgr.AddFactory(FOURCC('CINF'), FFactoryFunc(FCharLayoutInfo));
|
m_factoryMgr.AddFactory(FOURCC('CINF'), FFactoryFunc(FCharLayoutInfo));
|
||||||
m_factoryMgr.AddFactory(FOURCC('ANCS'), FFactoryFunc(FAnimCharacterSet));
|
m_factoryMgr.AddFactory(FOURCC('ANCS'), FFactoryFunc(FAnimCharacterSet));
|
||||||
|
m_factoryMgr.AddFactory(FOURCC('ANIM'), FFactoryFunc(AnimSourceFactory));
|
||||||
|
m_factoryMgr.AddFactory(FOURCC('EVNT'), FFactoryFunc(AnimPOIDataFactory));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectResourceFactoryMP1::IndexMP1Resources(hecl::Database::Project& proj)
|
void ProjectResourceFactoryMP1::IndexMP1Resources(hecl::Database::Project& proj)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "CAllFormatsAnimSource.hpp"
|
#include "CAllFormatsAnimSource.hpp"
|
||||||
#include "logvisor/logvisor.hpp"
|
#include "logvisor/logvisor.hpp"
|
||||||
|
#include "CSimplePool.hpp"
|
||||||
|
#include "CAnimSourceReader.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
@ -24,9 +26,36 @@ CAnimFormatUnion::CAnimFormatUnion(CInputStream& in, IObjectStore& store)
|
||||||
SubConstruct(x4_storage, x0_format, in, store);
|
SubConstruct(x4_storage, x0_format, in, store);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CAnimFormatUnion::~CAnimFormatUnion()
|
||||||
|
{
|
||||||
|
switch (x0_format)
|
||||||
|
{
|
||||||
|
case EAnimFormat::Uncompressed:
|
||||||
|
reinterpret_cast<CAnimSource*>(x4_storage)->~CAnimSource();
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<CAnimSourceReaderBase>
|
||||||
|
CAllFormatsAnimSource::GetNewReader(const TLockedToken<CAllFormatsAnimSource>& tok,
|
||||||
|
const CCharAnimTime& startTime)
|
||||||
|
{
|
||||||
|
return std::make_shared<CAnimSourceReader>(tok, startTime);
|
||||||
|
}
|
||||||
|
|
||||||
CAllFormatsAnimSource::CAllFormatsAnimSource(CInputStream& in,
|
CAllFormatsAnimSource::CAllFormatsAnimSource(CInputStream& in,
|
||||||
IObjectStore& store,
|
IObjectStore& store,
|
||||||
const SObjectTag& tag)
|
const SObjectTag& tag)
|
||||||
: CAnimFormatUnion(in, store), x74_tag(tag) {}
|
: CAnimFormatUnion(in, store), x74_tag(tag) {}
|
||||||
|
|
||||||
|
CFactoryFnReturn AnimSourceFactory(const SObjectTag& tag, CInputStream& in,
|
||||||
|
const CVParamTransfer& params)
|
||||||
|
{
|
||||||
|
CSimplePool* sp = static_cast<CSimplePool*>(
|
||||||
|
static_cast<TObjOwnerParam<IObjectStore*>*>(
|
||||||
|
params.GetObj())->GetParam());
|
||||||
|
return TToken<CAllFormatsAnimSource>::GetIObjObjectFor(
|
||||||
|
std::make_unique<CAllFormatsAnimSource>(in, *sp, tag));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,12 @@
|
||||||
#include "RetroTypes.hpp"
|
#include "RetroTypes.hpp"
|
||||||
#include "zeus/CVector3f.hpp"
|
#include "zeus/CVector3f.hpp"
|
||||||
#include "CAnimSource.hpp"
|
#include "CAnimSource.hpp"
|
||||||
|
#include "CFactoryMgr.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
class IObjectStore;
|
class IObjectStore;
|
||||||
|
class CAnimSourceReaderBase;
|
||||||
|
|
||||||
enum class EAnimFormat
|
enum class EAnimFormat
|
||||||
{
|
{
|
||||||
|
@ -24,6 +26,7 @@ class CAnimFormatUnion
|
||||||
CInputStream& in, IObjectStore& store);
|
CInputStream& in, IObjectStore& store);
|
||||||
public:
|
public:
|
||||||
CAnimFormatUnion(CInputStream& in, IObjectStore& store);
|
CAnimFormatUnion(CInputStream& in, IObjectStore& store);
|
||||||
|
~CAnimFormatUnion();
|
||||||
operator CAnimSource&() {return *reinterpret_cast<CAnimSource*>(x4_storage);}
|
operator CAnimSource&() {return *reinterpret_cast<CAnimSource*>(x4_storage);}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -33,8 +36,12 @@ class CAllFormatsAnimSource : public CAnimFormatUnion
|
||||||
SObjectTag x74_tag;
|
SObjectTag x74_tag;
|
||||||
public:
|
public:
|
||||||
CAllFormatsAnimSource(CInputStream& in, IObjectStore& store, const SObjectTag& tag);
|
CAllFormatsAnimSource(CInputStream& in, IObjectStore& store, const SObjectTag& tag);
|
||||||
|
static std::shared_ptr<CAnimSourceReaderBase> GetNewReader(const TLockedToken<CAllFormatsAnimSource>& tok,
|
||||||
|
const CCharAnimTime& startTime);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CFactoryFnReturn AnimSourceFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& params);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __PSHAG_CALLFORMATANIMSOURCE_HPP__
|
#endif // __PSHAG_CALLFORMATANIMSOURCE_HPP__
|
||||||
|
|
|
@ -5,7 +5,30 @@ namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
CAnimPOIData::CAnimPOIData(CInputStream& in)
|
CAnimPOIData::CAnimPOIData(CInputStream& in)
|
||||||
|
: x0_version(in.readUint32Big())
|
||||||
{
|
{
|
||||||
|
u32 boolCount = in.readUint32Big();
|
||||||
|
x4_boolNodes.reserve(boolCount);
|
||||||
|
for (u32 i=0 ; i<boolCount ; ++i)
|
||||||
|
x4_boolNodes.emplace_back(in);
|
||||||
|
|
||||||
|
u32 int32Count = in.readUint32Big();
|
||||||
|
x14_int32Nodes.reserve(int32Count);
|
||||||
|
for (u32 i=0 ; i<int32Count ; ++i)
|
||||||
|
x14_int32Nodes.emplace_back(in);
|
||||||
|
|
||||||
|
u32 particleCount = in.readUint32Big();
|
||||||
|
x24_particleNodes.reserve(particleCount);
|
||||||
|
for (u32 i=0 ; i<particleCount ; ++i)
|
||||||
|
x24_particleNodes.emplace_back(in);
|
||||||
|
|
||||||
|
if (x0_version >= 2)
|
||||||
|
{
|
||||||
|
u32 soundCount = in.readUint32Big();
|
||||||
|
x34_soundNodes.reserve(soundCount);
|
||||||
|
for (u32 i=0 ; i<soundCount ; ++i)
|
||||||
|
x34_soundNodes.emplace_back(in);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CFactoryFnReturn AnimPOIDataFactory(const SObjectTag& tag, CInputStream& in,
|
CFactoryFnReturn AnimPOIDataFactory(const SObjectTag& tag, CInputStream& in,
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace urde
|
||||||
|
|
||||||
class CAnimPOIData
|
class CAnimPOIData
|
||||||
{
|
{
|
||||||
|
u32 x0_version;
|
||||||
std::vector<CBoolPOINode> x4_boolNodes;
|
std::vector<CBoolPOINode> x4_boolNodes;
|
||||||
std::vector<CInt32POINode> x14_int32Nodes;
|
std::vector<CInt32POINode> x14_int32Nodes;
|
||||||
std::vector<CParticlePOINode> x24_particleNodes;
|
std::vector<CParticlePOINode> x24_particleNodes;
|
||||||
|
|
|
@ -122,12 +122,11 @@ void CAnimSource::CalcAverageVelocity()
|
||||||
}
|
}
|
||||||
|
|
||||||
CAnimSource::CAnimSource(CInputStream& in, IObjectStore& store)
|
CAnimSource::CAnimSource(CInputStream& in, IObjectStore& store)
|
||||||
: x0_duration(in.readFloatBig()),
|
: x0_duration(in),
|
||||||
x4_(in.readUint32Big()),
|
|
||||||
x8_interval(in.readFloatBig()),
|
x8_interval(in.readFloatBig()),
|
||||||
xc_(in.readUint32Big()),
|
xc_(in.readUint32Big()),
|
||||||
x10_frameCount(in.readUint32Big()),
|
x10_frameCount(in.readUint32Big()),
|
||||||
x1c_(in.readUint32Big()),
|
x1c_rootBone(in),
|
||||||
x20_rotationChannels(ReadIndexTable(in)),
|
x20_rotationChannels(ReadIndexTable(in)),
|
||||||
x30_translationChannels(ReadIndexTable(in)),
|
x30_translationChannels(ReadIndexTable(in)),
|
||||||
x40_data(RotationAndOffsetStorage::CRotationAndOffsetVectors(in), x10_frameCount),
|
x40_data(RotationAndOffsetStorage::CRotationAndOffsetVectors(in), x10_frameCount),
|
||||||
|
@ -210,10 +209,10 @@ zeus::CVector3f CAnimSource::GetOffset(const CSegId& seg, const CCharAnimTime& t
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
u32 frameIdx = unsigned(time / x8_interval);
|
u32 frameIdx = unsigned(time / x8_interval);
|
||||||
float tmp = time - frameIdx * x8_interval;
|
float remTime = time - frameIdx * x8_interval;
|
||||||
if (std::fabs(tmp) < 0.00001f)
|
if (std::fabs(remTime) < 0.00001f)
|
||||||
tmp = 0.f;
|
remTime = 0.f;
|
||||||
float t = ClampZeroToOne(tmp / x8_interval);
|
float t = ClampZeroToOne(remTime / x8_interval);
|
||||||
|
|
||||||
const u32 floatsPerFrame = x40_data.x10_transPerFrame * 3 + x40_data.xc_rotPerFrame * 4;
|
const u32 floatsPerFrame = x40_data.x10_transPerFrame * 3 + x40_data.xc_rotPerFrame * 4;
|
||||||
const u32 rotFloatsPerFrame = x40_data.xc_rotPerFrame * 4;
|
const u32 rotFloatsPerFrame = x40_data.xc_rotPerFrame * 4;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "CCharAnimTime.hpp"
|
#include "CCharAnimTime.hpp"
|
||||||
#include "zeus/CQuaternion.hpp"
|
#include "zeus/CQuaternion.hpp"
|
||||||
#include "zeus/CVector3f.hpp"
|
#include "zeus/CVector3f.hpp"
|
||||||
|
#include "CSegId.hpp"
|
||||||
#include "CToken.hpp"
|
#include "CToken.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
|
@ -48,12 +49,12 @@ public:
|
||||||
|
|
||||||
class CAnimSource
|
class CAnimSource
|
||||||
{
|
{
|
||||||
float x0_duration;
|
friend class CAnimSourceInfo;
|
||||||
u32 x4_;
|
CCharAnimTime x0_duration;
|
||||||
float x8_interval;
|
float x8_interval;
|
||||||
u32 xc_;
|
u32 xc_;
|
||||||
u32 x10_frameCount;
|
u32 x10_frameCount;
|
||||||
u32 x1c_;
|
CSegId x1c_rootBone;
|
||||||
std::vector<u8> x20_rotationChannels;
|
std::vector<u8> x20_rotationChannels;
|
||||||
std::vector<u8> x30_translationChannels;
|
std::vector<u8> x30_translationChannels;
|
||||||
RotationAndOffsetStorage x40_data;
|
RotationAndOffsetStorage x40_data;
|
||||||
|
@ -77,6 +78,8 @@ public:
|
||||||
zeus::CQuaternion GetRotation(const CSegId& seg, const CCharAnimTime& time) const;
|
zeus::CQuaternion GetRotation(const CSegId& seg, const CCharAnimTime& time) const;
|
||||||
zeus::CVector3f GetOffset(const CSegId& seg, const CCharAnimTime& time) const;
|
zeus::CVector3f GetOffset(const CSegId& seg, const CCharAnimTime& time) const;
|
||||||
bool HasOffset(const CSegId& seg) const;
|
bool HasOffset(const CSegId& seg) const;
|
||||||
|
const CCharAnimTime& GetDuration() const {return x0_duration;}
|
||||||
|
const CSegId& GetRootBoneId() const {return x1c_rootBone;}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,313 @@
|
||||||
#include "CAnimSourceReader.hpp"
|
#include "CAnimSourceReader.hpp"
|
||||||
|
#include "CBoolPOINode.hpp"
|
||||||
|
#include "CInt32POINode.hpp"
|
||||||
|
#include "CParticlePOINode.hpp"
|
||||||
|
#include "CSoundPOINode.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
|
CAnimSourceInfo::CAnimSourceInfo(const TSubAnimTypeToken<CAnimSource>& token)
|
||||||
|
: x4_token(token) {}
|
||||||
|
|
||||||
|
bool CAnimSourceInfo::HasPOIData() const
|
||||||
|
{
|
||||||
|
return x4_token->x58_evntData;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::vector<CBoolPOINode>& CAnimSourceInfo::GetBoolPOIStream() const
|
||||||
|
{
|
||||||
|
return x4_token->GetBoolPOIStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::vector<CInt32POINode>& CAnimSourceInfo::GetInt32POIStream() const
|
||||||
|
{
|
||||||
|
return x4_token->GetInt32POIStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::vector<CParticlePOINode>& CAnimSourceInfo::GetParticlePOIStream() const
|
||||||
|
{
|
||||||
|
return x4_token->GetParticlePOIStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::vector<CSoundPOINode>& CAnimSourceInfo::GetSoundPOIStream() const
|
||||||
|
{
|
||||||
|
return x4_token->GetSoundPOIStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
CCharAnimTime CAnimSourceInfo::GetAnimationDuration() const
|
||||||
|
{
|
||||||
|
return x4_token->GetDuration();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::map<std::string, CParticleData::EParentedMode>
|
||||||
|
CAnimSourceReaderBase::GetUniqueParticlePOIs() const
|
||||||
|
{
|
||||||
|
const std::vector<CParticlePOINode>& particleNodes = x4_sourceInfo->GetParticlePOIStream();
|
||||||
|
std::map<std::string, CParticleData::EParentedMode> ret;
|
||||||
|
for (const CParticlePOINode& node : particleNodes)
|
||||||
|
ret[node.GetName()] = node.GetData().GetParentedMode();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::map<std::string, s32>
|
||||||
|
CAnimSourceReaderBase::GetUniqueInt32POIs() const
|
||||||
|
{
|
||||||
|
const std::vector<CInt32POINode>& int32Nodes = x4_sourceInfo->GetInt32POIStream();
|
||||||
|
std::map<std::string, s32> ret;
|
||||||
|
for (const CInt32POINode& node : int32Nodes)
|
||||||
|
ret[node.GetName()] = node.GetValue();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::map<std::string, bool>
|
||||||
|
CAnimSourceReaderBase::GetUniqueBoolPOIs() const
|
||||||
|
{
|
||||||
|
const std::vector<CBoolPOINode>& boolNodes = x4_sourceInfo->GetBoolPOIStream();
|
||||||
|
std::map<std::string, bool> ret;
|
||||||
|
for (const CBoolPOINode& node : boolNodes)
|
||||||
|
ret[node.GetName()] = node.GetValue();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAnimSourceReaderBase::PostConstruct(const CCharAnimTime& time)
|
||||||
|
{
|
||||||
|
x14_passedBoolCount = 0;
|
||||||
|
x18_passedIntCount = 0;
|
||||||
|
x1c_passedParticleCount = 0;
|
||||||
|
x20_passedSoundCount = 0;
|
||||||
|
|
||||||
|
if (x4_sourceInfo->HasPOIData())
|
||||||
|
{
|
||||||
|
std::map<std::string, bool> boolPOIs = GetUniqueBoolPOIs();
|
||||||
|
std::map<std::string, s32> int32POIs = GetUniqueInt32POIs();
|
||||||
|
std::map<std::string, CParticleData::EParentedMode> particlePOIs = GetUniqueParticlePOIs();
|
||||||
|
|
||||||
|
x24_boolStates.reserve(boolPOIs.size());
|
||||||
|
for (const auto& poi : boolPOIs)
|
||||||
|
x24_boolStates.push_back(poi);
|
||||||
|
|
||||||
|
x34_int32States.reserve(int32POIs.size());
|
||||||
|
for (const auto& poi : int32POIs)
|
||||||
|
x34_int32States.push_back(poi);
|
||||||
|
|
||||||
|
x44_particleStates.reserve(particlePOIs.size());
|
||||||
|
for (const auto& poi : particlePOIs)
|
||||||
|
x44_particleStates.push_back(poi);
|
||||||
|
}
|
||||||
|
|
||||||
|
CCharAnimTime tmpTime = time;
|
||||||
|
if (tmpTime.GreaterThanZero())
|
||||||
|
{
|
||||||
|
while (tmpTime.GreaterThanZero())
|
||||||
|
{
|
||||||
|
SAdvancementResults res = VAdvanceView(tmpTime);
|
||||||
|
tmpTime = res.x0_remTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (x4_sourceInfo->HasPOIData())
|
||||||
|
{
|
||||||
|
UpdatePOIStates();
|
||||||
|
if (!time.GreaterThanZero())
|
||||||
|
{
|
||||||
|
x14_passedBoolCount = 0;
|
||||||
|
x18_passedIntCount = 0;
|
||||||
|
x1c_passedParticleCount = 0;
|
||||||
|
x20_passedSoundCount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAnimSourceReaderBase::UpdatePOIStates()
|
||||||
|
{
|
||||||
|
const std::vector<CBoolPOINode>& boolNodes = x4_sourceInfo->GetBoolPOIStream();
|
||||||
|
const std::vector<CInt32POINode>& int32Nodes = x4_sourceInfo->GetInt32POIStream();
|
||||||
|
const std::vector<CParticlePOINode>& particleNodes = x4_sourceInfo->GetParticlePOIStream();
|
||||||
|
const std::vector<CSoundPOINode>& soundNodes = x4_sourceInfo->GetSoundPOIStream();
|
||||||
|
|
||||||
|
for (const CBoolPOINode& node : boolNodes)
|
||||||
|
{
|
||||||
|
if (node.GetTime() > xc_curTime)
|
||||||
|
break;
|
||||||
|
if (node.GetIndex() != -1)
|
||||||
|
x24_boolStates[node.GetIndex()].second = node.GetValue();
|
||||||
|
++x14_passedBoolCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const CInt32POINode& node : int32Nodes)
|
||||||
|
{
|
||||||
|
if (node.GetTime() > xc_curTime)
|
||||||
|
break;
|
||||||
|
if (node.GetIndex() != -1)
|
||||||
|
x34_int32States[node.GetIndex()].second = node.GetValue();
|
||||||
|
++x18_passedIntCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const CParticlePOINode& node : particleNodes)
|
||||||
|
{
|
||||||
|
if (node.GetTime() > xc_curTime)
|
||||||
|
break;
|
||||||
|
if (node.GetIndex() != -1)
|
||||||
|
x44_particleStates[node.GetIndex()].second = node.GetData().GetParentedMode();
|
||||||
|
++x1c_passedParticleCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const CSoundPOINode& node : soundNodes)
|
||||||
|
{
|
||||||
|
if (node.GetTime() > xc_curTime)
|
||||||
|
break;
|
||||||
|
++x20_passedSoundCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 CAnimSourceReaderBase::VGetBoolPOIList(const CCharAnimTime& time,
|
||||||
|
CBoolPOINode* listOut,
|
||||||
|
u32 capacity, u32 iterator, u32 unk) const
|
||||||
|
{
|
||||||
|
if (x4_sourceInfo->HasPOIData())
|
||||||
|
{
|
||||||
|
const std::vector<CBoolPOINode>& boolNodes = x4_sourceInfo->GetBoolPOIStream();
|
||||||
|
return CBoolPOINode::_getPOIList(time, listOut, capacity, iterator, unk, boolNodes,
|
||||||
|
xc_curTime, *x4_sourceInfo, x14_passedBoolCount);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 CAnimSourceReaderBase::VGetInt32POIList(const CCharAnimTime& time,
|
||||||
|
CInt32POINode* listOut,
|
||||||
|
u32 capacity, u32 iterator, u32 unk) const
|
||||||
|
{
|
||||||
|
if (x4_sourceInfo->HasPOIData())
|
||||||
|
{
|
||||||
|
const std::vector<CInt32POINode>& int32Nodes = x4_sourceInfo->GetInt32POIStream();
|
||||||
|
return CInt32POINode::_getPOIList(time, listOut, capacity, iterator, unk, int32Nodes,
|
||||||
|
xc_curTime, *x4_sourceInfo, x18_passedIntCount);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 CAnimSourceReaderBase::VGetParticlePOIList(const CCharAnimTime& time,
|
||||||
|
CParticlePOINode* listOut,
|
||||||
|
u32 capacity, u32 iterator, u32 unk) const
|
||||||
|
{
|
||||||
|
if (x4_sourceInfo->HasPOIData())
|
||||||
|
{
|
||||||
|
const std::vector<CParticlePOINode>& particleNodes = x4_sourceInfo->GetParticlePOIStream();
|
||||||
|
return CParticlePOINode::_getPOIList(time, listOut, capacity, iterator, unk, particleNodes,
|
||||||
|
xc_curTime, *x4_sourceInfo, x1c_passedParticleCount);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 CAnimSourceReaderBase::VGetSoundPOIList(const CCharAnimTime& time,
|
||||||
|
CSoundPOINode* listOut,
|
||||||
|
u32 capacity, u32 iterator, u32 unk) const
|
||||||
|
{
|
||||||
|
if (x4_sourceInfo->HasPOIData())
|
||||||
|
{
|
||||||
|
const std::vector<CSoundPOINode>& soundNodes = x4_sourceInfo->GetSoundPOIStream();
|
||||||
|
return CSoundPOINode::_getPOIList(time, listOut, capacity, iterator, unk, soundNodes,
|
||||||
|
xc_curTime, *x4_sourceInfo, x20_passedSoundCount);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CAnimSourceReaderBase::VGetBoolPOIState(const char* name) const
|
||||||
|
{
|
||||||
|
for (const auto& node : x24_boolStates)
|
||||||
|
if (!node.first.compare(name))
|
||||||
|
return node.second;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 CAnimSourceReaderBase::VGetInt32POIState(const char* name) const
|
||||||
|
{
|
||||||
|
for (const auto& node : x34_int32States)
|
||||||
|
if (!node.first.compare(name))
|
||||||
|
return node.second;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CParticleData::EParentedMode
|
||||||
|
CAnimSourceReaderBase::VGetParticlePOIState(const char* name) const
|
||||||
|
{
|
||||||
|
for (const auto& node : x44_particleStates)
|
||||||
|
if (!node.first.compare(name))
|
||||||
|
return node.second;
|
||||||
|
return CParticleData::EParentedMode::Initial;
|
||||||
|
}
|
||||||
|
|
||||||
CAnimSourceReaderBase::CAnimSourceReaderBase(std::unique_ptr<IAnimSourceInfo>&& sourceInfo,
|
CAnimSourceReaderBase::CAnimSourceReaderBase(std::unique_ptr<IAnimSourceInfo>&& sourceInfo,
|
||||||
const CCharAnimTime& time)
|
const CCharAnimTime& time)
|
||||||
: x4_sourceInfo(std::move(sourceInfo)), xc_curTime(time) {}
|
: x4_sourceInfo(std::move(sourceInfo)), xc_curTime(time) {}
|
||||||
|
|
||||||
|
SAdvancementResults CAnimSourceReader::VGetAdvancementResults(const CCharAnimTime& a,
|
||||||
|
const CCharAnimTime& b) const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAnimSourceReader::VSetPhase(float)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
SAdvancementResults CAnimSourceReader::VReverseView(const CCharAnimTime& time)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<IAnimReader> CAnimSourceReader::VClone() const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAnimSourceReader::VGetSegStatementSet(const CSegIdList& list,
|
||||||
|
CSegStatementSet& setOut) const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAnimSourceReader::VGetSegStatementSet(const CSegIdList& list,
|
||||||
|
CSegStatementSet& setOut,
|
||||||
|
const CCharAnimTime& time) const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
SAdvancementResults CAnimSourceReader::VAdvanceView(const CCharAnimTime& a)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CCharAnimTime CAnimSourceReader::VGetTimeRemaining() const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAnimSourceReader::VGetSteadyStateAnimInfo() const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CAnimSourceReader::VHasOffset(const CSegId& seg) const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
zeus::CVector3f CAnimSourceReader::VGetOffset(const CSegId& seg) const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
zeus::CVector3f CAnimSourceReader::VGetOffset(const CSegId& seg,
|
||||||
|
const CCharAnimTime& time) const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
zeus::CQuaternion CAnimSourceReader::VGetRotation(const CSegId& seg) const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
CAnimSourceReader::CAnimSourceReader(const TSubAnimTypeToken<CAnimSource>& source,
|
CAnimSourceReader::CAnimSourceReader(const TSubAnimTypeToken<CAnimSource>& source,
|
||||||
const CCharAnimTime& time)
|
const CCharAnimTime& time)
|
||||||
: CAnimSourceReaderBase(std::make_unique<CAnimSourceInfo>(source), CCharAnimTime()),
|
: CAnimSourceReaderBase(std::make_unique<CAnimSourceInfo>(source), CCharAnimTime()),
|
||||||
x54_source(source)
|
x54_source(source)
|
||||||
{
|
{
|
||||||
CAnimSource* sourceData = x54_source.GetObj();
|
CAnimSource* sourceData = x54_source.GetObj();
|
||||||
|
x64_duration = sourceData->GetDuration();
|
||||||
|
x6c_curRootOffset = sourceData->GetOffset(sourceData->GetRootBoneId(), time);
|
||||||
|
PostConstruct(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,20 +10,18 @@ namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class TSubAnimTypeToken : public TCachedToken<T>
|
using TSubAnimTypeToken = TCachedToken<T>;
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
class IAnimSourceInfo
|
class IAnimSourceInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~IAnimSourceInfo() = default;
|
virtual ~IAnimSourceInfo() = default;
|
||||||
virtual bool HasPOIData() const=0;
|
virtual bool HasPOIData() const=0;
|
||||||
virtual void GetBoolPOIStream() const=0;
|
virtual const std::vector<CBoolPOINode>& GetBoolPOIStream() const=0;
|
||||||
virtual void GetInt32POIStream() const=0;
|
virtual const std::vector<CInt32POINode>& GetInt32POIStream() const=0;
|
||||||
virtual void GetParticlePOIStream() const=0;
|
virtual const std::vector<CParticlePOINode>& GetParticlePOIStream() const=0;
|
||||||
virtual void GetSoundPOIStream() const=0;
|
virtual const std::vector<CSoundPOINode>& GetSoundPOIStream() const=0;
|
||||||
virtual void GetAnimationDuration() const=0;
|
virtual CCharAnimTime GetAnimationDuration() const=0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CAnimSourceInfo : public IAnimSourceInfo
|
class CAnimSourceInfo : public IAnimSourceInfo
|
||||||
|
@ -32,31 +30,31 @@ class CAnimSourceInfo : public IAnimSourceInfo
|
||||||
public:
|
public:
|
||||||
CAnimSourceInfo(const TSubAnimTypeToken<CAnimSource>& token);
|
CAnimSourceInfo(const TSubAnimTypeToken<CAnimSource>& token);
|
||||||
bool HasPOIData() const;
|
bool HasPOIData() const;
|
||||||
void GetBoolPOIStream() const;
|
const std::vector<CBoolPOINode>& GetBoolPOIStream() const;
|
||||||
void GetInt32POIStream() const;
|
const std::vector<CInt32POINode>& GetInt32POIStream() const;
|
||||||
void GetParticlePOIStream() const;
|
const std::vector<CParticlePOINode>& GetParticlePOIStream() const;
|
||||||
void GetSoundPOIStream() const;
|
const std::vector<CSoundPOINode>& GetSoundPOIStream() const;
|
||||||
void GetAnimationDuration() const;
|
CCharAnimTime GetAnimationDuration() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CAnimSourceReaderBase : public IAnimReader
|
class CAnimSourceReaderBase : public IAnimReader
|
||||||
{
|
{
|
||||||
std::unique_ptr<IAnimSourceInfo> x4_sourceInfo;
|
std::unique_ptr<IAnimSourceInfo> x4_sourceInfo;
|
||||||
CCharAnimTime xc_curTime;
|
CCharAnimTime xc_curTime;
|
||||||
u32 x14_passedBoolCount;
|
u32 x14_passedBoolCount = 0;
|
||||||
u32 x18_passedIntCount;
|
u32 x18_passedIntCount = 0;
|
||||||
u32 x1c_passedParticleCount;
|
u32 x1c_passedParticleCount = 0;
|
||||||
u32 x20_passedSoundCount;
|
u32 x20_passedSoundCount = 0;
|
||||||
std::vector<std::pair<std::string, bool>> x24_boolPOIs;
|
std::vector<std::pair<std::string, bool>> x24_boolStates;
|
||||||
std::vector<std::pair<std::string, s32>> x34_int32POIs;
|
std::vector<std::pair<std::string, s32>> x34_int32States;
|
||||||
std::vector<std::pair<std::string, CParticleData::EParentedMode>> x44_particlePOIs;
|
std::vector<std::pair<std::string, CParticleData::EParentedMode>> x44_particleStates;
|
||||||
|
|
||||||
std::map<std::string, CParticleData::EParentedMode> GetUniqueParticlePOIs() const;
|
std::map<std::string, CParticleData::EParentedMode> GetUniqueParticlePOIs() const;
|
||||||
std::map<std::string, s32> GetUniqueInt32POIs() const;
|
std::map<std::string, s32> GetUniqueInt32POIs() const;
|
||||||
std::map<std::string, bool> GetUniqueBoolPOIs() const;
|
std::map<std::string, bool> GetUniqueBoolPOIs() const;
|
||||||
void PostConstruct(const CCharAnimTime& time);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void PostConstruct(const CCharAnimTime& time);
|
||||||
void UpdatePOIStates();
|
void UpdatePOIStates();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -67,16 +65,38 @@ public:
|
||||||
u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator, u32) const;
|
u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator, u32) const;
|
||||||
u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator, u32) const;
|
u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator, u32) const;
|
||||||
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator, u32) const;
|
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator, u32) const;
|
||||||
void VGetBoolPOIState(const char*) const;
|
bool VGetBoolPOIState(const char* name) const;
|
||||||
void VGetInt32POIState(const char*) const;
|
s32 VGetInt32POIState(const char* name) const;
|
||||||
void VGetParticlePOIState(const char*) const;
|
CParticleData::EParentedMode VGetParticlePOIState(const char* name) const;
|
||||||
|
|
||||||
|
virtual zeus::CVector3f VGetOffset(const CSegId& seg, const CCharAnimTime& b) const=0;
|
||||||
|
virtual bool VSupportsReverseView() const=0;
|
||||||
|
virtual SAdvancementResults VReverseView(const CCharAnimTime& time)=0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CAnimSourceReader : public CAnimSourceReaderBase
|
class CAnimSourceReader : public CAnimSourceReaderBase
|
||||||
{
|
{
|
||||||
TSubAnimTypeToken<CAnimSource> x54_source;
|
TSubAnimTypeToken<CAnimSource> x54_source;
|
||||||
|
CCharAnimTime x64_duration;
|
||||||
|
zeus::CVector3f x6c_curRootOffset;
|
||||||
|
bool x78_ = false;
|
||||||
public:
|
public:
|
||||||
CAnimSourceReader(const TSubAnimTypeToken<CAnimSource>& source, const CCharAnimTime& time);
|
CAnimSourceReader(const TSubAnimTypeToken<CAnimSource>& source, const CCharAnimTime& time);
|
||||||
|
|
||||||
|
SAdvancementResults VGetAdvancementResults(const CCharAnimTime& a, const CCharAnimTime& b) const;
|
||||||
|
bool VSupportsReverseView() const {return true;}
|
||||||
|
void VSetPhase(float);
|
||||||
|
SAdvancementResults VReverseView(const CCharAnimTime& time);
|
||||||
|
std::shared_ptr<IAnimReader> VClone() const;
|
||||||
|
void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut) const;
|
||||||
|
void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut, const CCharAnimTime& time) const;
|
||||||
|
SAdvancementResults VAdvanceView(const CCharAnimTime& a);
|
||||||
|
CCharAnimTime VGetTimeRemaining() const;
|
||||||
|
void VGetSteadyStateAnimInfo() const;
|
||||||
|
bool VHasOffset(const CSegId& seg) const;
|
||||||
|
zeus::CVector3f VGetOffset(const CSegId& seg) const;
|
||||||
|
zeus::CVector3f VGetOffset(const CSegId& seg, const CCharAnimTime& time) const;
|
||||||
|
zeus::CQuaternion VGetRotation(const CSegId& seg) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,9 @@ public:
|
||||||
u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator, u32) const;
|
u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator, u32) const;
|
||||||
u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator, u32) const;
|
u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator, u32) const;
|
||||||
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator, u32) const;
|
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator, u32) const;
|
||||||
void VGetBoolPOIState(const char*) const;
|
bool VGetBoolPOIState(const char* name) const;
|
||||||
void VGetInt32POIState(const char*) const;
|
s32 VGetInt32POIState(const char* name) const;
|
||||||
void VGetParticlePOIState(const char*) const;
|
CParticleData::EParentedMode VGetParticlePOIState(const char* name) const;
|
||||||
void VSetPhase(float);
|
void VSetPhase(float);
|
||||||
SAdvancementResults VGetAdvancementResults(const CCharAnimTime& a, const CCharAnimTime& b) const;
|
SAdvancementResults VGetAdvancementResults(const CCharAnimTime& a, const CCharAnimTime& b) const;
|
||||||
void Depth() const;
|
void Depth() const;
|
||||||
|
|
|
@ -13,6 +13,11 @@ public:
|
||||||
CAnimTreeNode(const std::string& name) : x4_name(name) {}
|
CAnimTreeNode(const std::string& name) : x4_name(name) {}
|
||||||
bool IsCAnimTreeNode() const {return true;}
|
bool IsCAnimTreeNode() const {return true;}
|
||||||
|
|
||||||
|
virtual void Depth() const=0;
|
||||||
|
virtual void VGetContributionOfHighestInfluence() const=0;
|
||||||
|
virtual u32 VGetNumChildren() const=0;
|
||||||
|
virtual std::shared_ptr<IAnimReader> VGetBestUnblendedChild() const=0;
|
||||||
|
|
||||||
void GetContributionOfHighestInfluence() const;
|
void GetContributionOfHighestInfluence() const;
|
||||||
u32 GetNumChildren() const;
|
u32 GetNumChildren() const;
|
||||||
std::shared_ptr<IAnimReader> GetBestUnblendedChild() const;
|
std::shared_ptr<IAnimReader> GetBestUnblendedChild() const;
|
||||||
|
|
|
@ -21,11 +21,11 @@ bool CAnimTreeSingleChild::VHasOffset(const CSegId& seg) const
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAnimTreeSingleChild::VGetOffset(const CSegId& seg) const
|
zeus::CVector3f CAnimTreeSingleChild::VGetOffset(const CSegId& seg) const
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAnimTreeSingleChild::VGetRotation(const CSegId& seg) const
|
zeus::CQuaternion CAnimTreeSingleChild::VGetRotation(const CSegId& seg) const
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,15 +53,15 @@ u32 CAnimTreeSingleChild::VGetSoundPOIList(const CCharAnimTime& time,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAnimTreeSingleChild::VGetBoolPOIState(const char*) const
|
bool CAnimTreeSingleChild::VGetBoolPOIState(const char* name) const
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAnimTreeSingleChild::VGetInt32POIState(const char*) const
|
s32 CAnimTreeSingleChild::VGetInt32POIState(const char* name) const
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAnimTreeSingleChild::VGetParticlePOIState(const char*) const
|
CParticleData::EParentedMode CAnimTreeSingleChild::VGetParticlePOIState(const char* name) const
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,15 +15,15 @@ public:
|
||||||
SAdvancementResults VAdvanceView(const CCharAnimTime& a);
|
SAdvancementResults VAdvanceView(const CCharAnimTime& a);
|
||||||
CCharAnimTime VGetTimeRemaining() const;
|
CCharAnimTime VGetTimeRemaining() const;
|
||||||
bool VHasOffset(const CSegId& seg) const;
|
bool VHasOffset(const CSegId& seg) const;
|
||||||
void VGetOffset(const CSegId& seg) const;
|
zeus::CVector3f VGetOffset(const CSegId& seg) const;
|
||||||
void VGetRotation(const CSegId& seg) const;
|
zeus::CQuaternion VGetRotation(const CSegId& seg) const;
|
||||||
u32 VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const;
|
u32 VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const;
|
||||||
u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator, u32) const;
|
u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator, u32) const;
|
||||||
u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator, u32) const;
|
u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator, u32) const;
|
||||||
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator, u32) const;
|
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator, u32) const;
|
||||||
void VGetBoolPOIState(const char*) const;
|
bool VGetBoolPOIState(const char* name) const;
|
||||||
void VGetInt32POIState(const char*) const;
|
s32 VGetInt32POIState(const char* name) const;
|
||||||
void VGetParticlePOIState(const char*) const;
|
CParticleData::EParentedMode VGetParticlePOIState(const char* name) const;
|
||||||
void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut) const;
|
void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut) const;
|
||||||
void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut, const CCharAnimTime& time) const;
|
void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut, const CCharAnimTime& time) const;
|
||||||
void VSetPhase(float);
|
void VSetPhase(float);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "CBoolPOINode.hpp"
|
#include "CBoolPOINode.hpp"
|
||||||
|
#include "CAnimSourceReader.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
@ -9,4 +10,44 @@ CBoolPOINode::CBoolPOINode()
|
||||||
CBoolPOINode::CBoolPOINode(CInputStream& in)
|
CBoolPOINode::CBoolPOINode(CInputStream& in)
|
||||||
: CPOINode(in), x38_val(in.readBool()) {}
|
: CPOINode(in), x38_val(in.readBool()) {}
|
||||||
|
|
||||||
|
CBoolPOINode CBoolPOINode::CopyNodeMinusStartTime(const CBoolPOINode& node,
|
||||||
|
const CCharAnimTime& startTime)
|
||||||
|
{
|
||||||
|
CBoolPOINode ret = node;
|
||||||
|
ret.x1c_time -= startTime;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 CBoolPOINode::_getPOIList(const CCharAnimTime& time,
|
||||||
|
CBoolPOINode* listOut,
|
||||||
|
u32 capacity, u32 iterator, u32 unk1,
|
||||||
|
const std::vector<CBoolPOINode>& stream,
|
||||||
|
const CCharAnimTime& curTime,
|
||||||
|
const IAnimSourceInfo& animInfo, u32 passedCount)
|
||||||
|
{
|
||||||
|
u32 ret = 0;
|
||||||
|
if (animInfo.HasPOIData() && stream.size())
|
||||||
|
{
|
||||||
|
CCharAnimTime dur = animInfo.GetAnimationDuration();
|
||||||
|
CCharAnimTime targetTime = curTime + time;
|
||||||
|
if (targetTime >= dur)
|
||||||
|
targetTime = dur;
|
||||||
|
|
||||||
|
if (passedCount >= stream.size())
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
CCharAnimTime nodeTime = stream[passedCount].GetTime();
|
||||||
|
while (nodeTime <= targetTime)
|
||||||
|
{
|
||||||
|
u32 idx = iterator + ret;
|
||||||
|
if (idx < capacity)
|
||||||
|
listOut[idx] = CopyNodeMinusStartTime(stream[passedCount], curTime);
|
||||||
|
++passedCount;
|
||||||
|
++ret;
|
||||||
|
nodeTime = stream[passedCount].GetTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
class IAnimSourceInfo;
|
||||||
|
|
||||||
class CBoolPOINode : public CPOINode
|
class CBoolPOINode : public CPOINode
|
||||||
{
|
{
|
||||||
|
@ -13,6 +14,14 @@ public:
|
||||||
CBoolPOINode();
|
CBoolPOINode();
|
||||||
CBoolPOINode(CInputStream& in);
|
CBoolPOINode(CInputStream& in);
|
||||||
bool GetValue() const {return x38_val;}
|
bool GetValue() const {return x38_val;}
|
||||||
|
static u32 _getPOIList(const CCharAnimTime& time,
|
||||||
|
CBoolPOINode* listOut,
|
||||||
|
u32 capacity, u32 iterator, u32 unk1,
|
||||||
|
const std::vector<CBoolPOINode>& stream,
|
||||||
|
const CCharAnimTime& curTime,
|
||||||
|
const IAnimSourceInfo& animInfo, u32 passedCount);
|
||||||
|
static CBoolPOINode CopyNodeMinusStartTime(const CBoolPOINode& node,
|
||||||
|
const CCharAnimTime& startTime);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "CInt32POINode.hpp"
|
#include "CInt32POINode.hpp"
|
||||||
|
#include "CAnimSourceReader.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
@ -6,4 +7,44 @@ namespace urde
|
||||||
CInt32POINode::CInt32POINode(CInputStream& in)
|
CInt32POINode::CInt32POINode(CInputStream& in)
|
||||||
: CPOINode(in), x38_val(in.readUint32Big()), x3c_boneName(in.readString()) {}
|
: CPOINode(in), x38_val(in.readUint32Big()), x3c_boneName(in.readString()) {}
|
||||||
|
|
||||||
|
CInt32POINode CInt32POINode::CopyNodeMinusStartTime(const CInt32POINode& node,
|
||||||
|
const CCharAnimTime& startTime)
|
||||||
|
{
|
||||||
|
CInt32POINode ret = node;
|
||||||
|
ret.x1c_time -= startTime;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 CInt32POINode::_getPOIList(const CCharAnimTime& time,
|
||||||
|
CInt32POINode* listOut,
|
||||||
|
u32 capacity, u32 iterator, u32 unk1,
|
||||||
|
const std::vector<CInt32POINode>& stream,
|
||||||
|
const CCharAnimTime& curTime,
|
||||||
|
const IAnimSourceInfo& animInfo, u32 passedCount)
|
||||||
|
{
|
||||||
|
u32 ret = 0;
|
||||||
|
if (animInfo.HasPOIData() && stream.size())
|
||||||
|
{
|
||||||
|
CCharAnimTime dur = animInfo.GetAnimationDuration();
|
||||||
|
CCharAnimTime targetTime = curTime + time;
|
||||||
|
if (targetTime >= dur)
|
||||||
|
targetTime = dur;
|
||||||
|
|
||||||
|
if (passedCount >= stream.size())
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
CCharAnimTime nodeTime = stream[passedCount].GetTime();
|
||||||
|
while (nodeTime <= targetTime)
|
||||||
|
{
|
||||||
|
u32 idx = iterator + ret;
|
||||||
|
if (idx < capacity)
|
||||||
|
listOut[idx] = CopyNodeMinusStartTime(stream[passedCount], curTime);
|
||||||
|
++passedCount;
|
||||||
|
++ret;
|
||||||
|
nodeTime = stream[passedCount].GetTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,25 @@
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
class IAnimSourceInfo;
|
||||||
|
|
||||||
class CInt32POINode : public CPOINode
|
class CInt32POINode : public CPOINode
|
||||||
{
|
{
|
||||||
u32 x38_val;
|
s32 x38_val;
|
||||||
std::string x3c_boneName;
|
std::string x3c_boneName;
|
||||||
public:
|
public:
|
||||||
CInt32POINode(CInputStream& in);
|
CInt32POINode(CInputStream& in);
|
||||||
|
s32 GetValue() const {return x38_val;}
|
||||||
|
const std::string& GetBoneName() const {return x3c_boneName;}
|
||||||
|
|
||||||
|
static u32 _getPOIList(const CCharAnimTime& time,
|
||||||
|
CInt32POINode* listOut,
|
||||||
|
u32 capacity, u32 iterator, u32 unk1,
|
||||||
|
const std::vector<CInt32POINode>& stream,
|
||||||
|
const CCharAnimTime& curTime,
|
||||||
|
const IAnimSourceInfo& animInfo, u32 passedCount);
|
||||||
|
static CInt32POINode CopyNodeMinusStartTime(const CInt32POINode& node,
|
||||||
|
const CCharAnimTime& startTime);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ namespace urde
|
||||||
|
|
||||||
class CPOINode
|
class CPOINode
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
u16 x4_ = 1;
|
u16 x4_ = 1;
|
||||||
std::string x8_name;
|
std::string x8_name;
|
||||||
u16 x18_;
|
u16 x18_;
|
||||||
|
@ -25,6 +26,7 @@ public:
|
||||||
|
|
||||||
const std::string& GetName() const {return x8_name;}
|
const std::string& GetName() const {return x8_name;}
|
||||||
const CCharAnimTime& GetTime() const {return x1c_time;}
|
const CCharAnimTime& GetTime() const {return x1c_time;}
|
||||||
|
u32 GetIndex() const {return x24_index;}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ private:
|
||||||
EParentedMode x20_parentMode;
|
EParentedMode x20_parentMode;
|
||||||
public:
|
public:
|
||||||
CParticleData(CInputStream& in);
|
CParticleData(CInputStream& in);
|
||||||
|
EParentedMode GetParentedMode() const {return x20_parentMode;}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "CParticlePOINode.hpp"
|
#include "CParticlePOINode.hpp"
|
||||||
|
#include "CAnimSourceReader.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
@ -6,4 +7,44 @@ namespace urde
|
||||||
CParticlePOINode::CParticlePOINode(CInputStream& in)
|
CParticlePOINode::CParticlePOINode(CInputStream& in)
|
||||||
: CPOINode(in), x38_data(in) {}
|
: CPOINode(in), x38_data(in) {}
|
||||||
|
|
||||||
|
CParticlePOINode CParticlePOINode::CopyNodeMinusStartTime(const CParticlePOINode& node,
|
||||||
|
const CCharAnimTime& startTime)
|
||||||
|
{
|
||||||
|
CParticlePOINode ret = node;
|
||||||
|
ret.x1c_time -= startTime;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 CParticlePOINode::_getPOIList(const CCharAnimTime& time,
|
||||||
|
CParticlePOINode* listOut,
|
||||||
|
u32 capacity, u32 iterator, u32 unk1,
|
||||||
|
const std::vector<CParticlePOINode>& stream,
|
||||||
|
const CCharAnimTime& curTime,
|
||||||
|
const IAnimSourceInfo& animInfo, u32 passedCount)
|
||||||
|
{
|
||||||
|
u32 ret = 0;
|
||||||
|
if (animInfo.HasPOIData() && stream.size())
|
||||||
|
{
|
||||||
|
CCharAnimTime dur = animInfo.GetAnimationDuration();
|
||||||
|
CCharAnimTime targetTime = curTime + time;
|
||||||
|
if (targetTime >= dur)
|
||||||
|
targetTime = dur;
|
||||||
|
|
||||||
|
if (passedCount >= stream.size())
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
CCharAnimTime nodeTime = stream[passedCount].GetTime();
|
||||||
|
while (nodeTime <= targetTime)
|
||||||
|
{
|
||||||
|
u32 idx = iterator + ret;
|
||||||
|
if (idx < capacity)
|
||||||
|
listOut[idx] = CopyNodeMinusStartTime(stream[passedCount], curTime);
|
||||||
|
++passedCount;
|
||||||
|
++ret;
|
||||||
|
nodeTime = stream[passedCount].GetTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,23 @@
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
class IAnimSourceInfo;
|
||||||
|
|
||||||
class CParticlePOINode : public CPOINode
|
class CParticlePOINode : public CPOINode
|
||||||
{
|
{
|
||||||
CParticleData x38_data;
|
CParticleData x38_data;
|
||||||
public:
|
public:
|
||||||
CParticlePOINode(CInputStream& in);
|
CParticlePOINode(CInputStream& in);
|
||||||
|
const CParticleData& GetData() const {return x38_data;}
|
||||||
|
|
||||||
|
static u32 _getPOIList(const CCharAnimTime& time,
|
||||||
|
CParticlePOINode* listOut,
|
||||||
|
u32 capacity, u32 iterator, u32 unk1,
|
||||||
|
const std::vector<CParticlePOINode>& stream,
|
||||||
|
const CCharAnimTime& curTime,
|
||||||
|
const IAnimSourceInfo& animInfo, u32 passedCount);
|
||||||
|
static CParticlePOINode CopyNodeMinusStartTime(const CParticlePOINode& node,
|
||||||
|
const CCharAnimTime& startTime);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "CSoundPOINode.hpp"
|
#include "CSoundPOINode.hpp"
|
||||||
|
#include "CAnimSourceReader.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
@ -16,4 +17,44 @@ CSoundPOINode::CSoundPOINode(const std::string& name, u16 a,
|
||||||
: CPOINode(name, a, time, b, c, d, e, f),
|
: CPOINode(name, a, time, b, c, d, e, f),
|
||||||
x38_sfxId(sfxId), x3c_falloff(falloff), x40_maxDist(maxDist) {}
|
x38_sfxId(sfxId), x3c_falloff(falloff), x40_maxDist(maxDist) {}
|
||||||
|
|
||||||
|
CSoundPOINode CSoundPOINode::CopyNodeMinusStartTime(const CSoundPOINode& node,
|
||||||
|
const CCharAnimTime& startTime)
|
||||||
|
{
|
||||||
|
CSoundPOINode ret = node;
|
||||||
|
ret.x1c_time -= startTime;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 CSoundPOINode::_getPOIList(const CCharAnimTime& time,
|
||||||
|
CSoundPOINode* listOut,
|
||||||
|
u32 capacity, u32 iterator, u32 unk1,
|
||||||
|
const std::vector<CSoundPOINode>& stream,
|
||||||
|
const CCharAnimTime& curTime,
|
||||||
|
const IAnimSourceInfo& animInfo, u32 passedCount)
|
||||||
|
{
|
||||||
|
u32 ret = 0;
|
||||||
|
if (animInfo.HasPOIData() && stream.size())
|
||||||
|
{
|
||||||
|
CCharAnimTime dur = animInfo.GetAnimationDuration();
|
||||||
|
CCharAnimTime targetTime = curTime + time;
|
||||||
|
if (targetTime >= dur)
|
||||||
|
targetTime = dur;
|
||||||
|
|
||||||
|
if (passedCount >= stream.size())
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
CCharAnimTime nodeTime = stream[passedCount].GetTime();
|
||||||
|
while (nodeTime <= targetTime)
|
||||||
|
{
|
||||||
|
u32 idx = iterator + ret;
|
||||||
|
if (idx < capacity)
|
||||||
|
listOut[idx] = CopyNodeMinusStartTime(stream[passedCount], curTime);
|
||||||
|
++passedCount;
|
||||||
|
++ret;
|
||||||
|
nodeTime = stream[passedCount].GetTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
class IAnimSourceInfo;
|
||||||
|
|
||||||
class CSoundPOINode : public CPOINode
|
class CSoundPOINode : public CPOINode
|
||||||
{
|
{
|
||||||
|
@ -17,6 +18,15 @@ public:
|
||||||
CSoundPOINode(const std::string& name, u16 a,
|
CSoundPOINode(const std::string& name, u16 a,
|
||||||
const CCharAnimTime& time, u32 b, bool c,
|
const CCharAnimTime& time, u32 b, bool c,
|
||||||
float d, u32 e, u32 f, u32 sfxId, float falloff, float maxDist);
|
float d, u32 e, u32 f, u32 sfxId, float falloff, float maxDist);
|
||||||
|
|
||||||
|
static u32 _getPOIList(const CCharAnimTime& time,
|
||||||
|
CSoundPOINode* listOut,
|
||||||
|
u32 capacity, u32 iterator, u32 unk1,
|
||||||
|
const std::vector<CSoundPOINode>& stream,
|
||||||
|
const CCharAnimTime& curTime,
|
||||||
|
const IAnimSourceInfo& animInfo, u32 passedCount);
|
||||||
|
static CSoundPOINode CopyNodeMinusStartTime(const CSoundPOINode& node,
|
||||||
|
const CCharAnimTime& startTime);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "CCharAnimTime.hpp"
|
#include "CCharAnimTime.hpp"
|
||||||
#include "zeus/CVector3f.hpp"
|
#include "zeus/CVector3f.hpp"
|
||||||
#include "zeus/CQuaternion.hpp"
|
#include "zeus/CQuaternion.hpp"
|
||||||
|
#include "CParticleData.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
@ -32,25 +33,21 @@ public:
|
||||||
virtual CCharAnimTime VGetTimeRemaining() const=0;
|
virtual CCharAnimTime VGetTimeRemaining() const=0;
|
||||||
virtual void VGetSteadyStateAnimInfo() const=0;
|
virtual void VGetSteadyStateAnimInfo() const=0;
|
||||||
virtual bool VHasOffset(const CSegId& seg) const=0;
|
virtual bool VHasOffset(const CSegId& seg) const=0;
|
||||||
virtual void VGetOffset(const CSegId& seg) const=0;
|
virtual zeus::CVector3f VGetOffset(const CSegId& seg) const=0;
|
||||||
virtual void VGetRotation(const CSegId& seg) const=0;
|
virtual zeus::CQuaternion VGetRotation(const CSegId& seg) const=0;
|
||||||
virtual u32 VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const=0;
|
virtual u32 VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const=0;
|
||||||
virtual u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator, u32) const=0;
|
virtual u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator, u32) const=0;
|
||||||
virtual u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator, u32) const=0;
|
virtual u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator, u32) const=0;
|
||||||
virtual u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator, u32) const=0;
|
virtual u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator, u32) const=0;
|
||||||
virtual void VGetBoolPOIState(const char*) const=0;
|
virtual bool VGetBoolPOIState(const char*) const=0;
|
||||||
virtual void VGetInt32POIState(const char*) const=0;
|
virtual s32 VGetInt32POIState(const char*) const=0;
|
||||||
virtual void VGetParticlePOIState(const char*) const=0;
|
virtual CParticleData::EParentedMode VGetParticlePOIState(const char*) const=0;
|
||||||
virtual void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut) const=0;
|
virtual void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut) const=0;
|
||||||
virtual void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut, const CCharAnimTime& time) const=0;
|
virtual void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut, const CCharAnimTime& time) const=0;
|
||||||
virtual void VClone() const=0;
|
virtual std::shared_ptr<IAnimReader> VClone() const=0;
|
||||||
virtual std::shared_ptr<IAnimReader> VSimplified() {return {};}
|
virtual std::shared_ptr<IAnimReader> VSimplified() {return {};}
|
||||||
virtual void VSetPhase(float)=0;
|
virtual void VSetPhase(float)=0;
|
||||||
virtual SAdvancementResults VGetAdvancementResults(const CCharAnimTime& a, const CCharAnimTime& b) const;
|
virtual SAdvancementResults VGetAdvancementResults(const CCharAnimTime& a, const CCharAnimTime& b) const;
|
||||||
virtual void Depth() const=0;
|
|
||||||
virtual void VGetContributionOfHighestInfluence() const=0;
|
|
||||||
virtual u32 VGetNumChildren() const=0;
|
|
||||||
virtual std::shared_ptr<IAnimReader> VGetBestUnblendedChild() const=0;
|
|
||||||
|
|
||||||
u32 GetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const;
|
u32 GetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const;
|
||||||
u32 GetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator, u32) const;
|
u32 GetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator, u32) const;
|
||||||
|
|
Loading…
Reference in New Issue