Exemplo n.º 1
0
void for_each_child_joint(AnimSkeleton::ConstPointer skeleton, int startJoint, Func f) {
    std::queue<int> q;
    q.push(startJoint);
    while(q.size() > 0) {
        int jointIndex = q.front();
        for (int i = 0; i < skeleton->getNumJoints(); i++) {
            if (jointIndex == skeleton->getParentIndex(i)) {
                f(i);
                q.push(i);
            }
        }
        q.pop();
    }
}
Exemplo n.º 2
0
void AnimManipulator::setSkeletonInternal(AnimSkeleton::ConstPointer skeleton) {
    AnimNode::setSkeletonInternal(skeleton);

    // invalidate all jointVar indices
    for (auto& jointVar : _jointVars) {
        jointVar.jointIndex = -1;
        jointVar.hasPerformedJointLookup = false;
    }

    // potentially allocate new joints.
    _poses.resize(skeleton->getNumJoints());

    // set all joints to identity
    for (auto& pose : _poses) {
        pose = AnimPose::identity;
    }
}