2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2015-08-23 06:42:29 +00:00
|
|
|
|
2019-09-28 02:53:03 +00:00
|
|
|
#include "Runtime/Character/CLayoutDescription.hpp"
|
|
|
|
#include "Runtime/Character/CSegId.hpp"
|
|
|
|
#include "Runtime/Character/TSegIdMap.hpp"
|
|
|
|
|
|
|
|
#include <zeus/CQuaternion.hpp>
|
|
|
|
#include <zeus/CVector3f.hpp>
|
2016-04-13 23:07:18 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
2016-04-13 23:07:18 +00:00
|
|
|
class CCharLayoutInfo;
|
2019-09-28 02:53:03 +00:00
|
|
|
class CLayoutDescription;
|
2016-04-13 23:07:18 +00:00
|
|
|
class CPoseAsTransforms;
|
2015-08-23 06:42:29 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CHierarchyPoseBuilder {
|
2020-03-15 05:04:01 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
struct CTreeNode {
|
|
|
|
CSegId x0_child = 0;
|
|
|
|
CSegId x1_sibling = 0;
|
|
|
|
zeus::CQuaternion x4_rotation;
|
|
|
|
zeus::CVector3f x14_offset;
|
|
|
|
};
|
2020-03-15 05:04:01 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
CLayoutDescription x0_layoutDesc;
|
|
|
|
CSegId x30_rootId;
|
|
|
|
bool x34_hasRoot = false;
|
2018-12-08 05:30:43 +00:00
|
|
|
TSegIdMap<CTreeNode> x38_treeMap;
|
|
|
|
|
|
|
|
void BuildIntoHierarchy(const CCharLayoutInfo& layout, const CSegId& boneId, const CSegId& nullId);
|
|
|
|
void RecursivelyBuildNoScale(const CSegId& boneId, const CTreeNode& node, CPoseAsTransforms& pose,
|
|
|
|
const zeus::CQuaternion& rot, const zeus::CMatrix3f& scale,
|
|
|
|
const zeus::CVector3f& offset) const;
|
|
|
|
void RecursivelyBuild(const CSegId& boneId, const CTreeNode& node, CPoseAsTransforms& pose,
|
|
|
|
const zeus::CQuaternion& rot, const zeus::CMatrix3f& scale,
|
|
|
|
const zeus::CVector3f& offset) const;
|
|
|
|
|
2016-04-12 22:28:08 +00:00
|
|
|
public:
|
2020-03-31 03:52:22 +00:00
|
|
|
explicit CHierarchyPoseBuilder(const CLayoutDescription& layout);
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2020-03-06 02:25:49 +00:00
|
|
|
const TLockedToken<CCharLayoutInfo>& CharLayoutInfo() const { return x0_layoutDesc.ScaledLayout(); }
|
2020-03-13 22:29:20 +00:00
|
|
|
bool HasRoot() const { return x34_hasRoot; }
|
2018-12-08 05:30:43 +00:00
|
|
|
void BuildTransform(const CSegId& boneId, zeus::CTransform& xfOut) const;
|
|
|
|
void BuildNoScale(CPoseAsTransforms& pose);
|
|
|
|
void Insert(const CSegId& boneId, const zeus::CQuaternion& quat);
|
|
|
|
void Insert(const CSegId& boneId, const zeus::CQuaternion& quat, const zeus::CVector3f& offset);
|
|
|
|
TSegIdMap<CTreeNode>& GetTreeMap() { return x38_treeMap; }
|
2015-08-23 06:42:29 +00:00
|
|
|
};
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde
|