Showing the changes to interface/src/avatar/SkeletonModel.cpp (1 of 14 files). Show all
Unified · Split
| @@ -39,12 +39,12 @@ SkeletonModel::~SkeletonModel() { · 38 unmodified lines | ||
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | void SkeletonModel::initJointStates() { |
| 42 | − const FBXGeometry& geometry = _geometry->getFBXGeometry(); | |
| 42 | + const FBXGeometry& geometry = getFBXGeometry(); | |
| 43 | 43 | glm::mat4 modelOffset = glm::scale(_scale) * glm::translate(_offset); |
| 44 | 44 | _rig->initJointStates(geometry, modelOffset); |
| 45 | 45 | |
| 46 | 46 | // Determine the default eye position for avatar scale = 1.0 |
| 47 | − int headJointIndex = _geometry->getFBXGeometry().headJointIndex; | |
| 47 | + int headJointIndex = geometry.headJointIndex; | |
| 48 | 48 | if (0 > headJointIndex || headJointIndex >= _rig->getJointStateCount()) { |
| 49 | 49 | qCWarning(interfaceapp) << "Bad head joint! Got:" << headJointIndex << "jointCount:" << _rig->getJointStateCount(); |
| 50 | 50 | } |
| @@ -52,7 +52,7 @@ void SkeletonModel::initJointStates() { · 1 unmodified line | ||
| 52 | 52 | getEyeModelPositions(leftEyePosition, rightEyePosition); |
| 53 | 53 | glm::vec3 midEyePosition = (leftEyePosition + rightEyePosition) / 2.0f; |
| 54 | 54 | |
| 55 | − int rootJointIndex = _geometry->getFBXGeometry().rootJointIndex; | |
| 55 | + int rootJointIndex = geometry.rootJointIndex; | |
| 56 | 56 | glm::vec3 rootModelPosition; |
| 57 | 57 | getJointPosition(rootJointIndex, rootModelPosition); |
| 58 | 58 | |
| @@ -87,10 +87,12 @@ Rig::CharacterControllerState convertCharacterControllerState(CharacterControlle · 28 unmodified lines | ||
| 87 | 87 | |
| 88 | 88 | // Called within Model::simulate call, below. |
| 89 | 89 | void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) { |
| 90 | + const FBXGeometry& geometry = getFBXGeometry(); | |
| 91 | + | |
| 90 | 92 | Head* head = _owningAvatar->getHead(); |
| 93 | + | |
| 91 | 94 | if (_owningAvatar->isMyAvatar()) { |
| 92 | 95 | MyAvatar* myAvatar = static_cast<MyAvatar*>(_owningAvatar); |
| 93 | − const FBXGeometry& geometry = _geometry->getFBXGeometry(); | |
| 94 | 96 | |
| 95 | 97 | Rig::HeadParameters headParams; |
| 96 | 98 | headParams.enableLean = qApp->isHMDMode(); |
| @@ -183,7 +185,6 @@ void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) { · 86 unmodified lines | ||
| 183 | 185 | // Thus this should really only be ... else if (_owningAvatar->getHead()->isLookingAtMe()) {... |
| 184 | 186 | // However, in the !isLookingAtMe case, the eyes aren't rotating the way they should right now. |
| 185 | 187 | // We will revisit that as priorities allow, and particularly after the new rig/animation/joints. |
| 186 | − const FBXGeometry& geometry = _geometry->getFBXGeometry(); | |
| 187 | 188 | |
| 188 | 189 | // If the head is not positioned, updateEyeJoints won't get the math right |
| 189 | 190 | glm::quat headOrientation; |
| @@ -329,22 +330,23 @@ float SkeletonModel::getRightArmLength() const { · 139 unmodified lines | ||
| 329 | 330 | } |
| 330 | 331 | |
| 331 | 332 | bool SkeletonModel::getHeadPosition(glm::vec3& headPosition) const { |
| 332 | − return isActive() && getJointPositionInWorldFrame(_geometry->getFBXGeometry().headJointIndex, headPosition); | |
| 333 | + return isActive() && getJointPositionInWorldFrame(getFBXGeometry().headJointIndex, headPosition); | |
| 333 | 334 | } |
| 334 | 335 | |
| 335 | 336 | bool SkeletonModel::getNeckPosition(glm::vec3& neckPosition) const { |
| 336 | − return isActive() && getJointPositionInWorldFrame(_geometry->getFBXGeometry().neckJointIndex, neckPosition); | |
| 337 | + return isActive() && getJointPositionInWorldFrame(getFBXGeometry().neckJointIndex, neckPosition); | |
| 337 | 338 | } |
| 338 | 339 | |
| 339 | 340 | bool SkeletonModel::getLocalNeckPosition(glm::vec3& neckPosition) const { |
| 340 | − return isActive() && getJointPosition(_geometry->getFBXGeometry().neckJointIndex, neckPosition); | |
| 341 | + return isActive() && getJointPosition(getFBXGeometry().neckJointIndex, neckPosition); | |
| 341 | 342 | } |
| 342 | 343 | |
| 343 | 344 | bool SkeletonModel::getEyeModelPositions(glm::vec3& firstEyePosition, glm::vec3& secondEyePosition) const { |
| 344 | 345 | if (!isActive()) { |
| 345 | 346 | return false; |
| 346 | 347 | } |
| 347 | − const FBXGeometry& geometry = _geometry->getFBXGeometry(); | |
| 348 | + const FBXGeometry& geometry = getFBXGeometry(); | |
| 349 | + | |
| 348 | 350 | if (getJointPosition(geometry.leftEyeJointIndex, firstEyePosition) && |
| 349 | 351 | getJointPosition(geometry.rightEyeJointIndex, secondEyePosition)) { |
| 350 | 352 | return true; |
| @@ -386,11 +388,11 @@ float VERY_BIG_MASS = 1.0e6f; · 35 unmodified lines | ||
| 386 | 388 | |
| 387 | 389 | // virtual |
| 388 | 390 | void SkeletonModel::computeBoundingShape() { |
| 389 | − if (_geometry == NULL || _rig->jointStatesEmpty()) { | |
| 391 | + if (!isLoaded() || _rig->jointStatesEmpty()) { | |
| 390 | 392 | return; |
| 391 | 393 | } |
| 392 | 394 | |
| 393 | − const FBXGeometry& geometry = _geometry->getFBXGeometry(); | |
| 395 | + const FBXGeometry& geometry = getFBXGeometry(); | |
| 394 | 396 | if (geometry.joints.isEmpty() || geometry.rootJointIndex == -1) { |
| 395 | 397 | // rootJointIndex == -1 if the avatar model has no skeleton |
| 396 | 398 | return; |
| @@ -429,7 +431,7 @@ void SkeletonModel::renderBoundingCollisionShapes(gpu::Batch& batch, float scale · 32 unmodified lines | ||
| 429 | 431 | } |
| 430 | 432 | |
| 431 | 433 | bool SkeletonModel::hasSkeleton() { |
| 432 | − return isActive() ? _geometry->getFBXGeometry().rootJointIndex != -1 : false; | |
| 434 | + return isActive() ? getFBXGeometry().rootJointIndex != -1 : false; | |
| 433 | 435 | } |
| 434 | 436 | |
| 435 | 437 | void SkeletonModel::onInvalidate() { |