From 1475cae504083e8076d6d78fa80918e613529bd1 Mon Sep 17 00:00:00 2001 From: HifiExperiments Date: Wed, 23 Dec 2020 21:29:59 -0800 Subject: [PATCH] wip --- .../src/avatars-renderer/SkeletonModel.cpp | 4 ++-- .../avatars-renderer/src/avatars-renderer/SkeletonModel.h | 2 +- libraries/entities/src/EntityTreeElement.cpp | 3 --- libraries/render-utils/src/Model.cpp | 7 +++++-- libraries/render-utils/src/Model.h | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libraries/avatars-renderer/src/avatars-renderer/SkeletonModel.cpp b/libraries/avatars-renderer/src/avatars-renderer/SkeletonModel.cpp index 5ac808d3fb..b1c9f7262e 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/SkeletonModel.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/SkeletonModel.cpp @@ -152,11 +152,11 @@ void SkeletonModel::updateAttitude(const glm::quat& orientation) { // Called by Avatar::simulate after it has set the joint states (fullUpdate true if changed), // but just before head has been simulated. -void SkeletonModel::simulate(float deltaTime, bool fullUpdate) { +void SkeletonModel::simulate(float deltaTime, bool fullUpdate, bool skeleton) { updateAttitude(_owningAvatar->getWorldOrientation()); setBlendshapeCoefficients(_owningAvatar->getHead()->getSummedBlendshapeCoefficients()); - Parent::simulate(deltaTime, fullUpdate); + Parent::simulate(deltaTime, fullUpdate, true); if (fullUpdate) { // let rig compute the model offset glm::vec3 registrationPoint; diff --git a/libraries/avatars-renderer/src/avatars-renderer/SkeletonModel.h b/libraries/avatars-renderer/src/avatars-renderer/SkeletonModel.h index e24d969461..b21c414c37 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/SkeletonModel.h +++ b/libraries/avatars-renderer/src/avatars-renderer/SkeletonModel.h @@ -36,7 +36,7 @@ public: void initJointStates() override; - void simulate(float deltaTime, bool fullUpdate = true) override; + void simulate(float deltaTime, bool fullUpdate = true, bool skeleton = false) override; glm::vec3 avoidCrossedEyes(const glm::vec3& lookAt); void updateRig(float deltaTime, glm::mat4 parentTransform) override; void updateAttitude(const glm::quat& orientation); diff --git a/libraries/entities/src/EntityTreeElement.cpp b/libraries/entities/src/EntityTreeElement.cpp index 16b6ccac9b..66d44d89de 100644 --- a/libraries/entities/src/EntityTreeElement.cpp +++ b/libraries/entities/src/EntityTreeElement.cpp @@ -241,9 +241,6 @@ EntityItemID EntityTreeElement::evalDetailedRayIntersection(const glm::vec3& ori // now ask the entity if we actually intersect if (entity->supportsDetailedIntersection()) { QVariantMap localExtraInfo; - if (entity->getName().contains("boop")) { - qDebug() << entity->getName() << entity->getPivot() << entityFrameBox; - } if (entity->findDetailedRayIntersection(origin, direction, element, localDistance, localFace, localSurfaceNormal, localExtraInfo, searchFilter.isPrecise())) { if (localDistance < distance) { diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 78ff17a8ef..0194b838cc 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -362,6 +362,9 @@ bool Model::findRayIntersectionAgainstSubMeshes(const glm::vec3& origin, const g // we can use the AABox's intersection by mapping our origin and direction into the model frame // and testing intersection there. if (modelFrameBox.findRayIntersection(modelFrameOrigin, modelFrameDirection, 1.0f / modelFrameDirection, distance, face, surfaceNormal)) { + if (getURL().toString().toLower().contains("sink")) { + qDebug() << "boop" << modelFrameBox; + } QMutexLocker locker(&_mutex); float bestDistance = FLT_MAX; @@ -1427,7 +1430,7 @@ void Model::setUseDualQuaternionSkinning(bool value) { _useDualQuaternionSkinning = value; } -void Model::simulate(float deltaTime, bool fullUpdate) { +void Model::simulate(float deltaTime, bool fullUpdate, bool skeleton) { DETAILED_PROFILE_RANGE(simulation_detail, __FUNCTION__); fullUpdate = updateGeometry() || fullUpdate || (_scaleToFit && !_scaledToFit) || (_snapModelToRegistrationPoint && !_snappedToRegistrationPoint) || _needsTransformUpdate; @@ -1443,7 +1446,7 @@ void Model::simulate(float deltaTime, bool fullUpdate) { snapToRegistrationPoint(); } // update the world space transforms for all joints - glm::mat4 parentTransform = glm::scale(_scale) * (_snapModelToRegistrationPoint ? + glm::mat4 parentTransform = glm::scale(_scale) * ((_snapModelToRegistrationPoint || skeleton) ? glm::translate(_offset) : glm::translate(getNaturalDimensions() * (0.5f - _registrationPoint))); updateRig(deltaTime, parentTransform); _needsTransformUpdate = false; diff --git a/libraries/render-utils/src/Model.h b/libraries/render-utils/src/Model.h index 7b606840f5..800bfc7e15 100644 --- a/libraries/render-utils/src/Model.h +++ b/libraries/render-utils/src/Model.h @@ -169,7 +169,7 @@ public: bool getSnapModelToRegistrationPoint() { return _snapModelToRegistrationPoint; } bool getSnappedToRegistrationPoint() { return _snappedToRegistrationPoint; } - virtual void simulate(float deltaTime, bool fullUpdate = true); + virtual void simulate(float deltaTime, bool fullUpdate = true, bool skeleton = false); virtual void updateClusterMatrices(); virtual void updateBlendshapes();