Showing the changes to interface/src/AvatarVoxelSystem.cpp (1 of 1 file). Show all
Unified · Split
| @@ -83,18 +83,13 @@ public: · 82 unmodified lines | |||
| 83 | bool bindVoxelsTogether; | 83 | bool bindVoxelsTogether; |
| 84 | int maxBonesPerBind; | 84 | int maxBonesPerBind; |
| 85 | bool includeBonesOutsideBindRadius; | 85 | bool includeBonesOutsideBindRadius; |
| 86 | bool ignoreOrientations; | ||
| 87 | }; | 86 | }; |
| 88 | 87 | ||
| 89 | const Mode MODES[] = { | 88 | const Mode MODES[] = { |
| 90 | { false, BONE_ELEMENTS_PER_VERTEX, false, false }, // original | 89 | { false, BONE_ELEMENTS_PER_VERTEX, false }, // original |
| 91 | { false, 1, true, false }, // one bone per vertex | 90 | { false, 1, true }, // one bone per vertex |
| 92 | { true, 1, true, false }, // one bone per voxel | 91 | { true, 1, true }, // one bone per voxel |
| 93 | { true, BONE_ELEMENTS_PER_VERTEX, false, false }, // four bones per voxel | 92 | { true, BONE_ELEMENTS_PER_VERTEX, false } }; // four bones per voxel |
| 94 | { false, BONE_ELEMENTS_PER_VERTEX, false, true }, // no orientations | ||
| 95 | { false, 1, true, true }, // no orientations, one bone per vertex | ||
| 96 | { true, 1, true, true }, // no orientations, one bone per voxel | ||
| 97 | { true, BONE_ELEMENTS_PER_VERTEX, false, true } }; // no orientations, four bones per voxel | ||
| 98 | 93 | ||
| 99 | void AvatarVoxelSystem::cycleMode() { | 94 | void AvatarVoxelSystem::cycleMode() { |
| 100 | _mode = (_mode + 1) % (sizeof(MODES) / sizeof(MODES[0])); | 95 | _mode = (_mode + 1) % (sizeof(MODES) / sizeof(MODES[0])); |
| @@ -221,11 +216,7 @@ void AvatarVoxelSystem::applyScaleAndBindProgram(bool texture) { · 120 unmodified lines | |||
| 221 | glm::quat orientation; | 216 | glm::quat orientation; |
| 222 | _avatar->getBodyBallTransform((AvatarJointID)i, position, orientation); | 217 | _avatar->getBodyBallTransform((AvatarJointID)i, position, orientation); |
| 223 | boneMatrices[i].translate(position.x, position.y, position.z); | 218 | boneMatrices[i].translate(position.x, position.y, position.z); |
| 224 | if (MODES[_mode].ignoreOrientations) { | 219 | orientation = orientation * glm::inverse(_avatar->getSkeleton().joint[i].absoluteBindPoseRotation); |
| 225 | orientation = _avatar->getOrientation(); | ||
| 226 | } else { | ||
| 227 | orientation = orientation * glm::inverse(_avatar->getSkeleton().joint[i].absoluteBindPoseRotation); | ||
| 228 | } | ||
| 229 | boneMatrices[i].rotate(QQuaternion(orientation.w, orientation.x, orientation.y, orientation.z)); | 220 | boneMatrices[i].rotate(QQuaternion(orientation.w, orientation.x, orientation.y, orientation.z)); |
| 230 | const glm::vec3& bindPosition = _avatar->getSkeleton().joint[i].absoluteBindPosePosition; | 221 | const glm::vec3& bindPosition = _avatar->getSkeleton().joint[i].absoluteBindPosePosition; |
| 231 | boneMatrices[i].translate(-bindPosition.x, -bindPosition.y, -bindPosition.z); | 222 | boneMatrices[i].translate(-bindPosition.x, -bindPosition.y, -bindPosition.z); |