From 4caf151c5ad1e07f819bc8e5ab8eda584f41420b Mon Sep 17 00:00:00 2001 From: prep linden Date: Wed, 22 Jun 2011 13:36:21 -0400 Subject: WIP for SH-1791 --- indra/newview/llviewerobject.cpp | 84 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 80 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewerobject.cpp') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index be9ff872c0..3185625094 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -104,6 +104,7 @@ #include "llaccountingquota.h" //#define DEBUG_UPDATE_TYPE +//#define EXTENDED_ENCROACHMENT_CHECK //temp: BOOL LLViewerObject::sVelocityInterpolate = TRUE; BOOL LLViewerObject::sPingInterpolate = TRUE; @@ -519,7 +520,6 @@ void LLViewerObject::setNameValueList(const std::string& name_value_list) } } - // This method returns true if the object is over land owned by the // agent. bool LLViewerObject::isReturnable() @@ -534,11 +534,87 @@ bool LLViewerObject::isReturnable() iter != mChildList.end(); iter++) { LLViewerObject* child = *iter; - boxes.push_back(LLBBox(child->getPositionRegion(), child->getRotationRegion(), child->getScale() * -0.5f, child->getScale() * 0.5f).getAxisAligned()); + boxes.push_back( LLBBox(child->getPositionRegion(), child->getRotationRegion(), child->getScale() * -0.5f, child->getScale() * 0.5f).getAxisAligned()); + } + + bool result = (mRegionp && mRegionp->objectIsReturnable(getPositionRegion(), boxes)) ? 1 : 0; +#ifdef EXTENDED_ENCROACHMENT_CHECK + //Get list of neighboring regions + std::vector uniqueRegions; + //Store this vo's region + uniqueRegions.push_back( mRegionp ); + //Build list of neighboring regions realtive to this vo's region + mRegionp->getNeighboringRegions( uniqueRegions ); + + //Build aabb's - for root and all children + std::vector returnables; + if ( !result ) + { + //Current region + PotentialReturnableObject returnableObj; + returnableObj.box = LLBBox( getPositionRegion(), getRotationRegion(), getScale() * -0.5f, getScale() * 0.5f).getAxisAligned() ; + returnableObj.pRegion = getRegion(); + + for (child_list_t::iterator iter = mChildList.begin(); iter != mChildList.end(); iter++) + { + LLViewerObject* pChild = *iter; + buildReturnablesForChildrenVO( returnables, pChild ); + } + } + + //TBD# Should probably create a region -> box map + typedef std::vector::iterator ReturnablesIt; + ReturnablesIt retCurrentIt = returnables.begin(); + ReturnablesIt retEndIt = returnables.end(); + + for ( ; retCurrentIt !=retEndIt; ++retCurrentIt ) + { + boxes.clear(); + LLViewerRegion* pRegion = (*retCurrentIt).pRegion; + boxes.push_back( (*retCurrentIt).box ); + //LLVector3 boxPos = (*retCurrentIt).box.getPositionAgent(); + //TBD# Should we just use pRegion->objectIsReturnable, instead? + //As it does various other checks, childrenObjectReturnable does not. + bool retResult = (mRegionp && pRegion->childrenObjectReturnable( boxes )) ? 1 : 0; + if ( retResult ) + { + result = true; + break; + } + } +#endif + return result; +} + +void LLViewerObject::buildReturnablesForChildrenVO( std::vector& returnables, LLViewerObject* pChild ) +{ + if ( !pChild ) + { + llerrs<<"child viewerobject is NULL "<mChildList.begin(); iter != pChild->mChildList.end(); iter++) + { + LLViewerObject* pChildofChild = *iter; + buildReturnablesForChildrenVO( returnables, pChildofChild ); + } +} - return mRegionp - && mRegionp->objectIsReturnable(getPositionRegion(), boxes); +void LLViewerObject::constructAndAddReturnable( std::vector& returnables, LLViewerObject* pChild ) +{ + PotentialReturnableObject returnableObj; + LLViewerRegion* pRegion = pChild->getRegion(); + + LLVector3d posGlobal = pRegion->getPosGlobalFromRegion( pChild->getPositionRegion() ); + LLVector3 targetRegionPos = pRegion->getPosRegionFromGlobal( posGlobal ); + + returnableObj.box = LLBBox( targetRegionPos, pChild->getRotationRegion(), pChild->getScale() * -0.5f, + pChild->getScale() * 0.5f).getAxisAligned(); + returnableObj.pRegion = pRegion; + returnables.push_back( returnableObj ); } BOOL LLViewerObject::setParent(LLViewerObject* parent) -- cgit v1.2.3 From 0961c3baaa6f5be42d4c3996c0563f905a8df053 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 22 Jun 2011 15:54:16 -0400 Subject: WIP SH-1791 - constructAndAddReturnable() now accepts target region --- indra/newview/llviewerobject.cpp | 95 ++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 47 deletions(-) (limited to 'indra/newview/llviewerobject.cpp') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 3185625094..a3a6ef1888 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -104,7 +104,7 @@ #include "llaccountingquota.h" //#define DEBUG_UPDATE_TYPE -//#define EXTENDED_ENCROACHMENT_CHECK //temp: +#define EXTENDED_ENCROACHMENT_CHECK //temp: BOOL LLViewerObject::sVelocityInterpolate = TRUE; BOOL LLViewerObject::sPingInterpolate = TRUE; @@ -538,82 +538,83 @@ bool LLViewerObject::isReturnable() } bool result = (mRegionp && mRegionp->objectIsReturnable(getPositionRegion(), boxes)) ? 1 : 0; + #ifdef EXTENDED_ENCROACHMENT_CHECK - //Get list of neighboring regions - std::vector uniqueRegions; - //Store this vo's region - uniqueRegions.push_back( mRegionp ); - //Build list of neighboring regions realtive to this vo's region - mRegionp->getNeighboringRegions( uniqueRegions ); - //Build aabb's - for root and all children - std::vector returnables; if ( !result ) - { - //Current region - PotentialReturnableObject returnableObj; - returnableObj.box = LLBBox( getPositionRegion(), getRotationRegion(), getScale() * -0.5f, getScale() * 0.5f).getAxisAligned() ; - returnableObj.pRegion = getRegion(); - - for (child_list_t::iterator iter = mChildList.begin(); iter != mChildList.end(); iter++) - { - LLViewerObject* pChild = *iter; - buildReturnablesForChildrenVO( returnables, pChild ); - } - } + { + std::vector uniqueRegions; + //Get list of neighboring regions relative to this vo's region + mRegionp->getNeighboringRegions( uniqueRegions ); + + //Build aabb's - for root and all children + std::vector returnables; + typedef std::vector::iterator RegionIt; + RegionIt regionStart = uniqueRegions.begin(); + RegionIt regionEnd = uniqueRegions.end(); + for (; regionStart != regionEnd; ++regionStart ) + { + LLViewerRegion* pTargetRegion = *regionStart; + for (child_list_t::iterator iter = mChildList.begin(); iter != mChildList.end(); iter++) + { + LLViewerObject* pChild = *iter; + buildReturnablesForChildrenVO( returnables, pChild, pTargetRegion ); + } + } - //TBD# Should probably create a region -> box map - typedef std::vector::iterator ReturnablesIt; - ReturnablesIt retCurrentIt = returnables.begin(); - ReturnablesIt retEndIt = returnables.end(); + //TBD# Should probably create a region -> box list map + typedef std::vector::iterator ReturnablesIt; + ReturnablesIt retCurrentIt = returnables.begin(); + ReturnablesIt retEndIt = returnables.end(); - for ( ; retCurrentIt !=retEndIt; ++retCurrentIt ) - { - boxes.clear(); - LLViewerRegion* pRegion = (*retCurrentIt).pRegion; - boxes.push_back( (*retCurrentIt).box ); - //LLVector3 boxPos = (*retCurrentIt).box.getPositionAgent(); - //TBD# Should we just use pRegion->objectIsReturnable, instead? - //As it does various other checks, childrenObjectReturnable does not. - bool retResult = (mRegionp && pRegion->childrenObjectReturnable( boxes )) ? 1 : 0; - if ( retResult ) - { - result = true; - break; + for ( ; retCurrentIt !=retEndIt; ++retCurrentIt ) + { + boxes.clear(); + LLViewerRegion* pRegion = (*retCurrentIt).pRegion; + boxes.push_back( (*retCurrentIt).box ); + //LLVector3 boxPos = (*retCurrentIt).box.getPositionAgent(); + //TBD# Should we just use pRegion->objectIsReturnable, instead? + //As it does various other checks, childrenObjectReturnable does not. + bool retResult = (mRegionp && pRegion->childrenObjectReturnable( boxes )) ? 1 : 0; + if ( retResult ) + { + result = true; + break; + } } } #endif return result; } -void LLViewerObject::buildReturnablesForChildrenVO( std::vector& returnables, LLViewerObject* pChild ) +void LLViewerObject::buildReturnablesForChildrenVO( std::vector& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion ) { if ( !pChild ) { llerrs<<"child viewerobject is NULL "<mChildList.begin(); iter != pChild->mChildList.end(); iter++) { LLViewerObject* pChildofChild = *iter; - buildReturnablesForChildrenVO( returnables, pChildofChild ); + buildReturnablesForChildrenVO( returnables, pChildofChild, pTargetRegion ); } } -void LLViewerObject::constructAndAddReturnable( std::vector& returnables, LLViewerObject* pChild ) +void LLViewerObject::constructAndAddReturnable( std::vector& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion ) { PotentialReturnableObject returnableObj; - LLViewerRegion* pRegion = pChild->getRegion(); - + + LLViewerRegion* pRegion = pChild->getRegion(); LLVector3d posGlobal = pRegion->getPosGlobalFromRegion( pChild->getPositionRegion() ); - LLVector3 targetRegionPos = pRegion->getPosRegionFromGlobal( posGlobal ); + LLVector3 targetRegionPos = pTargetRegion->getPosRegionFromGlobal( posGlobal ); returnableObj.box = LLBBox( targetRegionPos, pChild->getRotationRegion(), pChild->getScale() * -0.5f, pChild->getScale() * 0.5f).getAxisAligned(); - returnableObj.pRegion = pRegion; + returnableObj.pRegion = pTargetRegion; returnables.push_back( returnableObj ); } -- cgit v1.2.3 From e7c5913c0541c9c5ebcab93ec5fe4e8b1102eb23 Mon Sep 17 00:00:00 2001 From: prep linden Date: Fri, 24 Jun 2011 15:21:50 -0400 Subject: Bug fixes for SH-1791 --- indra/newview/llviewerobject.cpp | 47 +++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 18 deletions(-) (limited to 'indra/newview/llviewerobject.cpp') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index a3a6ef1888..c3a7d345f5 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -104,7 +104,6 @@ #include "llaccountingquota.h" //#define DEBUG_UPDATE_TYPE -#define EXTENDED_ENCROACHMENT_CHECK //temp: BOOL LLViewerObject::sVelocityInterpolate = TRUE; BOOL LLViewerObject::sPingInterpolate = TRUE; @@ -528,6 +527,7 @@ bool LLViewerObject::isReturnable() { return false; } + std::vector boxes; boxes.push_back(LLBBox(getPositionRegion(), getRotationRegion(), getScale() * -0.5f, getScale() * 0.5f).getAxisAligned()); for (child_list_t::iterator iter = mChildList.begin(); @@ -538,13 +538,11 @@ bool LLViewerObject::isReturnable() } bool result = (mRegionp && mRegionp->objectIsReturnable(getPositionRegion(), boxes)) ? 1 : 0; - -#ifdef EXTENDED_ENCROACHMENT_CHECK if ( !result ) { - std::vector uniqueRegions; //Get list of neighboring regions relative to this vo's region + std::vector uniqueRegions; mRegionp->getNeighboringRegions( uniqueRegions ); //Build aabb's - for root and all children @@ -552,9 +550,14 @@ bool LLViewerObject::isReturnable() typedef std::vector::iterator RegionIt; RegionIt regionStart = uniqueRegions.begin(); RegionIt regionEnd = uniqueRegions.end(); + for (; regionStart != regionEnd; ++regionStart ) { LLViewerRegion* pTargetRegion = *regionStart; + //Add the root vo as there may be no children and we still want + //to test for any edge overlap + buildReturnablesForChildrenVO( returnables, this, pTargetRegion ); + //Add it's children for (child_list_t::iterator iter = mChildList.begin(); iter != mChildList.end(); iter++) { LLViewerObject* pChild = *iter; @@ -562,7 +565,7 @@ bool LLViewerObject::isReturnable() } } - //TBD# Should probably create a region -> box list map + //TBD#Eventually create a region -> box list map typedef std::vector::iterator ReturnablesIt; ReturnablesIt retCurrentIt = returnables.begin(); ReturnablesIt retEndIt = returnables.end(); @@ -572,10 +575,7 @@ bool LLViewerObject::isReturnable() boxes.clear(); LLViewerRegion* pRegion = (*retCurrentIt).pRegion; boxes.push_back( (*retCurrentIt).box ); - //LLVector3 boxPos = (*retCurrentIt).box.getPositionAgent(); - //TBD# Should we just use pRegion->objectIsReturnable, instead? - //As it does various other checks, childrenObjectReturnable does not. - bool retResult = (mRegionp && pRegion->childrenObjectReturnable( boxes )) ? 1 : 0; + bool retResult = (pRegion && pRegion->childrenObjectReturnable( boxes )) ? 1 : 0; if ( retResult ) { result = true; @@ -583,7 +583,6 @@ bool LLViewerObject::isReturnable() } } } -#endif return result; } @@ -606,16 +605,28 @@ void LLViewerObject::buildReturnablesForChildrenVO( std::vector& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion ) { - PotentialReturnableObject returnableObj; - - LLViewerRegion* pRegion = pChild->getRegion(); - LLVector3d posGlobal = pRegion->getPosGlobalFromRegion( pChild->getPositionRegion() ); - LLVector3 targetRegionPos = pTargetRegion->getPosRegionFromGlobal( posGlobal ); - returnableObj.box = LLBBox( targetRegionPos, pChild->getRotationRegion(), pChild->getScale() * -0.5f, + LLVector3 targetRegionPos; + targetRegionPos.setVec( pChild->getPositionGlobal() ); + + LLBBox childBBox = LLBBox( targetRegionPos, pChild->getRotationRegion(), pChild->getScale() * -0.5f, pChild->getScale() * 0.5f).getAxisAligned(); - returnableObj.pRegion = pTargetRegion; - returnables.push_back( returnableObj ); + + LLVector3 edgeA = targetRegionPos + childBBox.getMinLocal(); + LLVector3 edgeB = targetRegionPos + childBBox.getMaxLocal(); + + LLVector3d edgeAd, edgeBd; + edgeAd.setVec(edgeA); + edgeBd.setVec(edgeB); + + //Only add the box when either of the extents are in a neighboring region + if ( pTargetRegion->pointInRegionGlobal( edgeAd ) || pTargetRegion->pointInRegionGlobal( edgeBd ) ) + { + PotentialReturnableObject returnableObj; + returnableObj.box = childBBox; + returnableObj.pRegion = pTargetRegion; + returnables.push_back( returnableObj ); + } } BOOL LLViewerObject::setParent(LLViewerObject* parent) -- cgit v1.2.3 From 74c5c0a0d7761d0762bb0e7775259e0556fd392a Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Wed, 6 Jul 2011 20:05:38 +0300 Subject: SH-1945 FIXED Added a check for Estate Managership when checking whether an object encroaching on the region can be returned. --- indra/newview/llviewerobject.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewerobject.cpp') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index c3a7d345f5..fdf1e4a89b 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -575,7 +575,9 @@ bool LLViewerObject::isReturnable() boxes.clear(); LLViewerRegion* pRegion = (*retCurrentIt).pRegion; boxes.push_back( (*retCurrentIt).box ); - bool retResult = (pRegion && pRegion->childrenObjectReturnable( boxes )) ? 1 : 0; + bool retResult = pRegion + && pRegion->childrenObjectReturnable( boxes ) + && pRegion->canManageEstate(); if ( retResult ) { result = true; -- cgit v1.2.3 From 8b7e33ad36bc33c2356300f8eabc8ddae578070e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 19 Jul 2011 15:19:07 -0400 Subject: Cherry pick of https://bitbucket.org/lindenlab/mesh-development/changeset/9cea44ebea3b by don, to fix old viewer crashes in mesh regions --- indra/newview/llviewerobject.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llviewerobject.cpp') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index bbe929b7f7..b5fdca632b 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4877,6 +4877,10 @@ void LLViewerObject::adjustAudioGain(const F32 gain) bool LLViewerObject::unpackParameterEntry(U16 param_type, LLDataPacker *dp) { + if (LLNetworkData::PARAMS_MESH == param_type) + { + param_type = LLNetworkData::PARAMS_SCULPT; + } ExtraParameter* param = getExtraParameterEntryCreate(param_type); if (param) { -- cgit v1.2.3