diff --git a/interface/src/avatar/FaceModel.cpp b/interface/src/avatar/FaceModel.cpp index f909489dc9..066144a425 100644 --- a/interface/src/avatar/FaceModel.cpp +++ b/interface/src/avatar/FaceModel.cpp @@ -49,7 +49,7 @@ void FaceModel::simulate(float deltaTime, bool fullUpdate) { setOffset(-_geometry->getFBXGeometry().neckPivot); for (int i = 0; i < _rig->getJointStateCount(); i++) { - updateJointState(i); + maybeUpdateNeckAndEyeRotation(i); } Model::simulateInternal(deltaTime); @@ -90,7 +90,7 @@ void FaceModel::maybeUpdateEyeRotation(Model* model, const JointState& parentSta joint.rotation, DEFAULT_PRIORITY); } -void FaceModel::updateJointState(int index) { +void FaceModel::maybeUpdateNeckAndEyeRotation(int index) { const JointState& state = _rig->getJointState(index); const FBXJoint& joint = state.getFBXJoint(); const FBXGeometry& geometry = _geometry->getFBXGeometry(); diff --git a/interface/src/avatar/FaceModel.h b/interface/src/avatar/FaceModel.h index 40f502f2d3..54d685c73c 100644 --- a/interface/src/avatar/FaceModel.h +++ b/interface/src/avatar/FaceModel.h @@ -28,7 +28,7 @@ public: void maybeUpdateNeckRotation(const JointState& parentState, const FBXJoint& joint, int index); void maybeUpdateEyeRotation(Model* model, const JointState& parentState, const FBXJoint& joint, int index); - void updateJointState(int index); + void maybeUpdateNeckAndEyeRotation(int index); /// Retrieve the positions of up to two eye meshes. /// \return whether or not both eye meshes were found diff --git a/interface/src/avatar/SkeletonModel.cpp b/interface/src/avatar/SkeletonModel.cpp index 3830360c0e..1b3298c75d 100644 --- a/interface/src/avatar/SkeletonModel.cpp +++ b/interface/src/avatar/SkeletonModel.cpp @@ -83,29 +83,6 @@ void SkeletonModel::initJointStates(QVector states) { const float PALM_PRIORITY = DEFAULT_PRIORITY; const float LEAN_PRIORITY = DEFAULT_PRIORITY; - -void SkeletonModel::updateClusterMatrices() { - const FBXGeometry& geometry = _geometry->getFBXGeometry(); - glm::mat4 modelToWorld = glm::mat4_cast(_rotation); - for (int i = 0; i < _meshStates.size(); i++) { - MeshState& state = _meshStates[i]; - const FBXMesh& mesh = geometry.meshes.at(i); - if (_showTrueJointTransforms) { - for (int j = 0; j < mesh.clusters.size(); j++) { - const FBXCluster& cluster = mesh.clusters.at(j); - state.clusterMatrices[j] = - modelToWorld * _rig->getJointTransform(cluster.jointIndex) * cluster.inverseBindMatrix; - } - } else { - for (int j = 0; j < mesh.clusters.size(); j++) { - const FBXCluster& cluster = mesh.clusters.at(j); - state.clusterMatrices[j] = - modelToWorld * _rig->getJointVisibleTransform(cluster.jointIndex) * cluster.inverseBindMatrix; - } - } - } -} - void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) { _rig->computeMotionAnimationState(deltaTime, _owningAvatar->getPosition(), _owningAvatar->getVelocity(), _owningAvatar->getOrientation()); Model::updateRig(deltaTime, parentTransform); @@ -264,16 +241,6 @@ void SkeletonModel::applyPalmData(int jointIndex, PalmData& palm) { } } -void SkeletonModel::updateJointState(int index) { - const FBXGeometry& geometry = _geometry->getFBXGeometry(); - glm::mat4 parentTransform = glm::scale(_scale) * glm::translate(_offset) * geometry.offset; - - _rig->updateJointState(index, parentTransform); - - if (index == _geometry->getFBXGeometry().rootJointIndex) { - _rig->clearJointTransformTranslation(index); - } -} void SkeletonModel::renderJointConstraints(gpu::Batch& batch, int jointIndex) { if (jointIndex == -1 || jointIndex >= _rig->getJointStateCount()) { return; diff --git a/interface/src/avatar/SkeletonModel.h b/interface/src/avatar/SkeletonModel.h index a089c7b6ef..ecc5c80118 100644 --- a/interface/src/avatar/SkeletonModel.h +++ b/interface/src/avatar/SkeletonModel.h @@ -117,19 +117,6 @@ protected: void applyHandPosition(int jointIndex, const glm::vec3& position); void applyPalmData(int jointIndex, PalmData& palm); - - /// Updates the state of the joint at the specified index. - virtual void updateJointState(int index); - - void maybeUpdateLeanRotation(const JointState& parentState, int index); - void maybeUpdateNeckRotation(const JointState& parentState, const FBXJoint& joint, int index); - void maybeUpdateEyeRotation(const JointState& parentState, const FBXJoint& joint, int index); - - void updateClusterMatrices(); - void cauterizeHead(); - void initHeadBones(); - void invalidateHeadBones(); - private: void renderJointConstraints(gpu::Batch& batch, int jointIndex); diff --git a/libraries/animation/src/AvatarRig.cpp b/libraries/animation/src/AvatarRig.cpp index 3b48b0814f..919ea43e7d 100644 --- a/libraries/animation/src/AvatarRig.cpp +++ b/libraries/animation/src/AvatarRig.cpp @@ -23,6 +23,7 @@ void AvatarRig::updateJointState(int index, glm::mat4 parentTransform) { int parentIndex = joint.parentIndex; if (parentIndex == -1) { state.computeTransform(parentTransform); + clearJointTransformTranslation(index); } else { // guard against out-of-bounds access to _jointStates if (joint.parentIndex >= 0 && joint.parentIndex < _jointStates.size()) { diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index ec423f7091..72bc818b70 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -1375,7 +1375,7 @@ void Model::simulateInternal(float deltaTime) { } } } - + // post the blender if we're not currently waiting for one to finish if (geometry.hasBlendedMeshes() && _blendshapeCoefficients != _blendedBlendshapeCoefficients) { _blendedBlendshapeCoefficients = _blendshapeCoefficients; @@ -1383,12 +1383,6 @@ void Model::simulateInternal(float deltaTime) { } } -void Model::updateJointState(int index) { - const FBXGeometry& geometry = _geometry->getFBXGeometry(); - glm::mat4 parentTransform = glm::scale(_scale) * glm::translate(_offset) * geometry.offset; - _rig->updateJointState(index, parentTransform); -} - bool Model::setJointPosition(int jointIndex, const glm::vec3& position, const glm::quat& rotation, bool useRotation, int lastFreeIndex, bool allIntermediatesFree, const glm::vec3& alignment, float priority) { const FBXGeometry& geometry = _geometry->getFBXGeometry(); diff --git a/libraries/render-utils/src/Model.h b/libraries/render-utils/src/Model.h index 449cd42a25..09504c7501 100644 --- a/libraries/render-utils/src/Model.h +++ b/libraries/render-utils/src/Model.h @@ -276,9 +276,6 @@ protected: void simulateInternal(float deltaTime); virtual void updateRig(float deltaTime, glm::mat4 parentTransform); - /// Updates the state of the joint at the specified index. - virtual void updateJointState(int index); - /// \param jointIndex index of joint in model structure /// \param position position of joint in model-frame /// \param rotation rotation of joint in model-frame