From af1431731802320e241037486b8bff0003a4d827 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Thu, 2 May 2013 13:56:10 -0400 Subject: SH-4060 FIX avatar hover being set to minimum at seemingly random times avatar hover was being temporarily set to -2.0 for the preview render, which was triggering the minimum enforcement, even when the user's requested value is no where near the minimum. Added a flag to disable the minimum enforcement if we are temporarily changing the value. --- indra/llappearance/llavatarappearance.cpp | 28 ---------------------------- indra/llappearance/llavatarappearance.h | 2 +- indra/newview/lltoolmorph.cpp | 12 ++++++++++++ indra/newview/llviewerwearable.h | 4 ++++ indra/newview/llvoavatar.cpp | 30 ++++++++++++++++++++++++++++++ indra/newview/llvoavatar.h | 3 +++ 6 files changed, 50 insertions(+), 29 deletions(-) (limited to 'indra') diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp index 0abe9ccb87..e3497c107d 100644 --- a/indra/llappearance/llavatarappearance.cpp +++ b/indra/llappearance/llavatarappearance.cpp @@ -488,34 +488,6 @@ void LLAvatarAppearance::computeBodySize() mAvatarOffset.mV[VX] = 0.0f; mAvatarOffset.mV[VY] = 0.0f; - // Certain configurations of avatars can force the overall height (with offset) to go negative. - // Enforce a constraint to make sure we don't go below 0.1 meters. - // Camera positioning and other things start to break down when your avatar is "walking" while being fully underground - if (new_body_size.mV[VZ] + mAvatarOffset.mV[VZ] < 1.1f && mAvatarOffset.mV[VZ] < 0.0f) - { - mAvatarOffset.mV[VZ] = -(new_body_size.mV[VZ] - 1.11f); // avoid floating point rounding making the above check continue to fail. - - llassert(new_body_size.mV[VZ] + mAvatarOffset.mV[VZ] >= 1.1f); - - - // some mesh avatars force the default height to be less than 1.1 meters. Do not force hover to be positive. - // This will allow them to appear to be on the ground, even if the server forces their physics shape to be - // taller than their visual representation. - if (mAvatarOffset.mV[VZ] > 0.0f) - { - mAvatarOffset.mV[VZ] = 0.0f; - } - - if (mWearableData && isSelf()) - { - LLWearable* shape = mWearableData->getWearable(LLWearableType::WT_SHAPE, 0); - if (shape) - { - shape->setVisualParamWeight(AVATAR_HOVER, mAvatarOffset.mV[VZ], false); - } - } - } - if (new_body_size != mBodySize || old_offset != mAvatarOffset.mV[VZ]) { mBodySize = new_body_size; diff --git a/indra/llappearance/llavatarappearance.h b/indra/llappearance/llavatarappearance.h index bce2540258..0a6a236d34 100644 --- a/indra/llappearance/llavatarappearance.h +++ b/indra/llappearance/llavatarappearance.h @@ -137,7 +137,7 @@ public: typedef std::map joint_map_t; joint_map_t mJointMap; - void computeBodySize(); + virtual void computeBodySize(); protected: diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp index 148e5a015b..f39b98dd31 100644 --- a/indra/newview/lltoolmorph.cpp +++ b/indra/newview/lltoolmorph.cpp @@ -54,6 +54,7 @@ #include "llviewercamera.h" #include "llviewertexturelist.h" #include "llviewerobject.h" +#include "llviewerwearable.h" #include "llviewerwindow.h" #include "llvoavatarself.h" #include "pipeline.h" @@ -147,6 +148,11 @@ BOOL LLVisualParamHint::needsRender() void LLVisualParamHint::preRender(BOOL clear_depth) { + LLViewerWearable* wearable = (LLViewerWearable*)mWearablePtr; + if (wearable) + { + wearable->setVolitile(TRUE); + } mLastParamWeight = mVisualParam->getWeight(); mWearablePtr->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight, FALSE); gAgentAvatarp->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight, FALSE); @@ -239,6 +245,12 @@ BOOL LLVisualParamHint::render() } gAgentAvatarp->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight); mWearablePtr->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight, FALSE); + LLViewerWearable* wearable = (LLViewerWearable*)mWearablePtr; + if (wearable) + { + wearable->setVolitile(FALSE); + } + gAgentAvatarp->updateVisualParams(); gGL.color4f(1,1,1,1); mGLTexturep->setGLTextureCreated(true); diff --git a/indra/newview/llviewerwearable.h b/indra/newview/llviewerwearable.h index 65566f23a5..047b2ce143 100644 --- a/indra/newview/llviewerwearable.h +++ b/indra/newview/llviewerwearable.h @@ -68,6 +68,8 @@ public: void setParamsToDefaults(); void setTexturesToDefaults(); + void setVolitile(BOOL volitle) { mVolitle = volitle; } // TRUE when doing preview renders, some updates will be suppressed. + BOOL getVolitile() { return mVolitle; } /*virtual*/ LLUUID getDefaultTextureImageID(LLAvatarAppearanceDefines::ETextureIndex index) const; @@ -96,6 +98,8 @@ protected: LLAssetID mAssetID; LLTransactionID mTransactionID; + BOOL mVolitle; // True when rendering preview images. Can suppress some updates. + LLUUID mItemID; // ID of the inventory item in the agent's inventory }; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index a56e09cde0..919627c47c 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5214,6 +5214,36 @@ void LLVOAvatar::updateVisualParams() updateHeadOffset(); } +/*virtual*/ +void LLVOAvatar::computeBodySize() +{ + LLAvatarAppearance::computeBodySize(); + + // Certain configurations of avatars can force the overall height (with offset) to go negative. + // Enforce a constraint to make sure we don't go below 0.1 meters. + // Camera positioning and other things start to break down when your avatar is "walking" while being fully underground + if (isSelf() && getWearableData()) + { + LLViewerWearable* shape = (LLViewerWearable*)getWearableData()->getWearable(LLWearableType::WT_SHAPE, 0); + if (shape && shape->getVolitile()) + { + F32 hover_value = shape->getVisualParamWeight(AVATAR_HOVER); + if (hover_value < 0.0f && (mBodySize.mV[VZ] + hover_value < 1.1f)) + { + hover_value = -(mBodySize.mV[VZ] - 1.1f); // avoid floating point rounding making the above check continue to fail. + llassert(mBodySize.mV[VZ] + hover_value >= 1.1f); + + hover_value = llmin(hover_value, 0.0f); // don't force the hover value to be greater than 0. + + mAvatarOffset.mV[VZ] = hover_value; + shape->setVisualParamWeight(AVATAR_HOVER,hover_value, FALSE); + + } + } + } +} + + //----------------------------------------------------------------------------- // isActive() //----------------------------------------------------------------------------- diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 98e8491cb1..19ad49d3a1 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -212,6 +212,9 @@ public: /*virtual*/ LLVector3 getPosAgentFromGlobal(const LLVector3d &position); virtual void updateVisualParams(); + /*virtual*/ void computeBodySize(); + + /** Inherited ** ** -- cgit v1.2.3