metaforce/Runtime/Character/CMetaAnimSequence.cpp

49 lines
1.5 KiB
C++
Raw Normal View History

2016-04-10 21:22:59 +00:00
#include "CMetaAnimSequence.hpp"
2016-04-11 03:59:54 +00:00
#include "CMetaAnimFactory.hpp"
2016-08-27 21:16:44 +00:00
#include "CAnimTreeSequence.hpp"
2016-04-10 21:22:59 +00:00
2018-12-08 05:30:43 +00:00
namespace urde {
2016-04-10 21:22:59 +00:00
2018-12-08 05:30:43 +00:00
std::vector<std::shared_ptr<IMetaAnim>> CMetaAnimSequence::CreateSequence(CInputStream& in) {
std::vector<std::shared_ptr<IMetaAnim>> ret;
u32 seqCount = in.readUint32Big();
ret.reserve(seqCount);
2016-04-11 03:59:54 +00:00
2018-12-08 05:30:43 +00:00
for (u32 i = 0; i < seqCount; ++i)
ret.push_back(CMetaAnimFactory::CreateMetaAnim(in));
2016-04-11 03:59:54 +00:00
2018-12-08 05:30:43 +00:00
return ret;
2016-04-10 21:22:59 +00:00
}
2018-12-08 05:30:43 +00:00
CMetaAnimSequence::CMetaAnimSequence(CInputStream& in) : x4_sequence(CreateSequence(in)) {}
2016-04-11 03:59:54 +00:00
2018-12-08 05:30:43 +00:00
void CMetaAnimSequence::GetUniquePrimitives(std::set<CPrimitive>& primsOut) const {
for (const std::shared_ptr<IMetaAnim>& anim : x4_sequence)
anim->GetUniquePrimitives(primsOut);
2016-04-10 21:22:59 +00:00
}
2018-12-08 05:30:43 +00:00
std::shared_ptr<CAnimTreeNode> CMetaAnimSequence::VGetAnimationTree(const CAnimSysContext& animSys,
const CMetaAnimTreeBuildOrders& orders) const {
if (orders.x0_recursiveAdvance) {
CMetaAnimTreeBuildOrders modOrders;
modOrders.PreAdvanceForAll(*orders.x0_recursiveAdvance);
return GetAnimationTree(animSys, modOrders);
}
2016-08-27 21:16:44 +00:00
2018-01-30 01:04:01 +00:00
#if 0
std::vector<std::string> anims;
anims.reserve(anims.size());
2016-08-27 21:16:44 +00:00
for (const std::shared_ptr<IMetaAnim>& anim : x4_sequence)
{
2018-01-30 01:04:01 +00:00
std::shared_ptr<CAnimTreeNode> chNode = anim->GetAnimationTree(animSys, orders);
anims.emplace_back(chNode->GetName());
2016-08-27 21:16:44 +00:00
}
2018-01-30 01:04:01 +00:00
#endif
2016-08-27 21:16:44 +00:00
2018-12-08 05:30:43 +00:00
std::shared_ptr<CAnimTreeNode> ret = std::make_shared<CAnimTreeSequence>(x4_sequence, animSys, "");
2016-08-27 21:16:44 +00:00
2018-12-08 05:30:43 +00:00
return ret;
2016-04-10 21:22:59 +00:00
}
2018-12-08 05:30:43 +00:00
} // namespace urde