35 for (
const std::tuple<int, float, float>& bone :
bones)
76 std::lock_guard lock(
mutex);
84 std::vector<std::pair<int, float>> composition = getStateComposition<int>();
91 if (composition.size() == 1) {
93 const std::vector<Skeleton::Bone>& skeletonState =
structures[composition[0].first].bones;
94 for (
size_t i = 0; i <
skeleton.size(); i++)
skeleton[i] =
base.
bones[i].inverseWorldToBone * skeletonState[i].worldToBone;
99 const std::vector<Skeleton::Bone>& fromSkeletonState =
structures[composition[0].first].bones;
100 const std::vector<Skeleton::Bone>& toSkeletonState =
structures[composition[1].first].bones;
101 for (
size_t i = 0; i <
skeleton.size(); i++) {
103 skeleton[i] = fromSkeletonState[i].worldToBone * composition[0].second + toSkeletonState[i].worldToBone * composition[1].second;
Vector2f transform(Vector2f vert, const std::array< std::pair< int, float >, 4 > &weights, float deltaTime)
Vector2f transformNoRecalc(Vector2f vert, const std::array< std::pair< int, float >, 4 > &weights) const
void update(size_t threadNum, const Scene &scene, float deltaTime) override
void setBase(const Skeleton &skeleton)
std::vector< Transform > skeleton
void recalculateSkeleton(float deltaTime)
const std::vector< Transform > & getSkeletonNoRecalc() const
bool skeletonRecalculated
void preUpdate(size_t threadNum, const Scene &scene, float deltaTime) override
const std::vector< Transform > & getSkeleton(float deltaTime)
std::unordered_map< int, Skeleton > structures
void updateState(float deltaTime)
static Vector2f transform(const std::vector< Transform > &offsets, Vector2f vert, const std::array< std::pair< int, float >, 4 > &weights)
std::vector< Bone > bones
static Bone calculateBone(const std::vector< Bone > &bones, int previousBone, float length, float rotation, AngleUnit unit)