void SkeletonModel::getHandShapes(int jointIndex, QVector<const Shape*>& shapes) const { if (jointIndex < 0 || jointIndex >= int(_shapes.size())) { return; } if (jointIndex == getLeftHandJointIndex() || jointIndex == getRightHandJointIndex()) { // get all shapes that have this hand as an ancestor in the skeleton heirarchy const FBXGeometry& geometry = _geometry->getFBXGeometry(); for (int i = 0; i < _jointStates.size(); i++) { const FBXJoint& joint = geometry.joints[i]; int parentIndex = joint.parentIndex; Shape* shape = _shapes[i]; if (i == jointIndex) { // this shape is the hand if (shape) { shapes.push_back(shape); } if (parentIndex != -1 && _shapes[parentIndex]) { // also add the forearm shapes.push_back(_shapes[parentIndex]); } } else if (shape) { while (parentIndex != -1) { if (parentIndex == jointIndex) { // this shape is a child of the hand shapes.push_back(shape); break; } parentIndex = geometry.joints[parentIndex].parentIndex; } } } } }
void SkeletonModel::getHandShapes(int jointIndex, QVector<const Shape*>& shapes) const { if (jointIndex == -1) { return; } if (jointIndex == getLeftHandJointIndex() || jointIndex == getRightHandJointIndex()) { // TODO: also add fingers and other hand-parts shapes.push_back(_shapes[jointIndex]); } }
float SkeletonModel::getLeftArmLength() const { return getLimbLength(getLeftHandJointIndex()); }
bool SkeletonModel::getLeftShoulderPosition(glm::vec3& position) const { return getJointPositionInWorldFrame(getLastFreeJointIndex(getLeftHandJointIndex()), position); }
bool SkeletonModel::restoreLeftHandPosition(float fraction, float priority) { return restoreJointPosition(getLeftHandJointIndex(), fraction, priority); }
bool SkeletonModel::getLeftHandPosition(glm::vec3& position) const { return getJointPositionInWorldFrame(getLeftHandJointIndex(), position); }
void SkeletonModel::renderIKConstraints(gpu::Batch& batch) { renderJointConstraints(batch, getRightHandJointIndex()); renderJointConstraints(batch, getLeftHandJointIndex()); }
void SkeletonModel::renderIKConstraints() { renderJointConstraints(getRightHandJointIndex()); renderJointConstraints(getLeftHandJointIndex()); }