From 1d6b24fcc219f504c13e771a220112a60c3a85e8 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 14 Jun 2018 20:06:32 +0100 Subject: MAINT-8653 - enforce z-height offset for animated mesh objects --- indra/newview/llviewerobject.cpp | 14 +++++++++++++- indra/newview/llvoavatar.cpp | 15 ++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 5ca6b25a18..29b2a217cc 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4137,8 +4137,20 @@ const LLVector3 LLViewerObject::getRenderPosition() const { if (mDrawable.notNull() && mDrawable->isState(LLDrawable::RIGGED)) { + LLControlAvatar *cav = getControlAvatar(); + if (isRoot() && cav) + { + F32 fixup; + if ( cav->hasPelvisFixup( fixup) ) + { + //Apply a pelvis fixup (as defined by the avs skin) + LLVector3 pos = mDrawable->getPositionAgent(); + pos[VZ] += fixup; + return pos; + } + } LLVOAvatar* avatar = getAvatar(); - if (avatar && !getControlAvatar()) + if ((avatar) && !getControlAvatar()) { return avatar->getPositionAgent(); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 728155382f..8d9a063670 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1296,11 +1296,15 @@ void LLVOAvatar::calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) LL_RECORD_BLOCK_TIME(FTM_AVATAR_EXTENT_UPDATE); S32 box_detail = gSavedSettings.getS32("AvatarBoundingBoxComplexity"); - LLVector4a buffer(0.1); + + // AXON the update_min_max function used below assumes there is a + // known starting point, but in general there isn't. Ideally the + // box update logic should be modified to handle the no-point-yet + // case. For most models, starting with the pelvis is safe though. LLVector4a pos; pos.load3(mPelvisp->getWorldPosition().mV); - newMin.setSub(pos, buffer); - newMax.setAdd(pos, buffer); + newMin = pos; + newMax = pos; //stretch bounding box by joint positions. No point doing this for //control avs, where the polymeshes aren't maintained or @@ -1429,8 +1433,9 @@ void LLVOAvatar::calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) //pad bounding box - newMin.sub(buffer); - newMax.add(buffer); + LLVector4a padding(0.1); + newMin.sub(padding); + newMax.add(padding); } void render_sphere_and_line(const LLVector3& begin_pos, const LLVector3& end_pos, F32 sphere_scale, const LLVector3& occ_color, const LLVector3& visible_color) -- cgit v1.2.3