diff options
-rw-r--r-- | indra/newview/llvoavatar.cpp | 27 | ||||
-rw-r--r-- | indra/newview/llvoavatar.h | 2 |
2 files changed, 20 insertions, 9 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index b04bb99b97..797f2d27ce 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1554,7 +1554,8 @@ void LLVOAvatar::calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) size.setSub(newMax,newMin); size.mul(0.5f); - mPixelArea = LLPipeline::calcPixelArea(center, size, *LLViewerCamera::getInstance()); + F32 pixel_area = LLPipeline::calcPixelArea(center, size, *LLViewerCamera::getInstance()); + setCorrectedPixelArea(pixel_area); } void render_sphere_and_line(const LLVector3& begin_pos, const LLVector3& end_pos, F32 sphere_scale, const LLVector3& occ_color, const LLVector3& visible_color) @@ -5049,6 +5050,8 @@ void LLVOAvatar::updateVisibility() LL_DEBUGS("AvatarRender") << "visible was " << mVisible << " now " << visible << LL_ENDL; } mVisible = visible; + + mVisibilityPreference = visible ? getPixelArea() : 0; } // private @@ -7110,6 +7113,18 @@ void LLVOAvatar::updateVisualParams() dirtyMesh(); updateHeadOffset(); } + +void LLVOAvatar::setCorrectedPixelArea(F32 area) +{ + // We always want to look good to ourselves + if (isSelf()) + { + area = llmax(area, F32(getTexImageSize() / 16)); + } + + setPixelArea(area); +} + //----------------------------------------------------------------------------- // isActive() //----------------------------------------------------------------------------- @@ -7137,7 +7152,7 @@ void LLVOAvatar::setPixelAreaAndAngle(LLAgent &agent) size.mul(0.5f); mImpostorPixelArea = LLPipeline::calcPixelArea(center, size, *LLViewerCamera::getInstance()); - mPixelArea = mImpostorPixelArea; + setCorrectedPixelArea(mImpostorPixelArea); F32 range = mDrawable->mDistanceWRTCamera; @@ -7150,12 +7165,6 @@ void LLVOAvatar::setPixelAreaAndAngle(LLAgent &agent) F32 radius = size.getLength3().getF32(); mAppAngle = (F32) atan2( radius, range) * RAD_TO_DEG; } - - // We always want to look good to ourselves - if( isSelf() ) - { - mPixelArea = llmax( mPixelArea, F32(getTexImageSize() / 16) ); - } } //----------------------------------------------------------------------------- @@ -10455,7 +10464,7 @@ void LLVOAvatar::cullAvatarsByPixelArea() { LLCharacter::sInstances.sort([](LLCharacter* lhs, LLCharacter* rhs) { - return lhs->getPixelArea() > rhs->getPixelArea(); + return ((LLVOAvatar*)lhs)->mVisibilityPreference > ((LLVOAvatar*)rhs)->mVisibilityPreference; }); // Update the avatars that have changed status diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index aa6aee0de5..963eed311d 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -136,6 +136,7 @@ public: /*virtual*/ bool updateLOD(); bool updateJointLODs(); void updateLODRiggedAttachments( void ); + void setCorrectedPixelArea(F32 area); /*virtual*/ bool isActive() const; // Whether this object needs to do an idleUpdate. S32Bytes totalTextureMemForUUIDS(std::set<LLUUID>& ids); bool allTexturesCompletelyDownloaded(std::set<LLUUID>& ids) const; @@ -620,6 +621,7 @@ public: protected: void updateVisibility(); private: + F32 mVisibilityPreference; U32 mVisibilityRank; bool mVisible; |