summaryrefslogtreecommitdiff
path: root/indra/newview/llworld.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2023-06-28 11:02:11 -0400
committerNat Goodspeed <nat@lindenlab.com>2023-06-28 11:02:11 -0400
commit726851b039b0b0e7d623970f32b6b28616a07dc8 (patch)
tree01dd9d23638486031dcc49d201c35d8338091794 /indra/newview/llworld.cpp
parente9d2f57866e7e4dcb46b21bef525eb9955691578 (diff)
parent6f8b812ecd73bf25d44445e1b791f9e1b01f429f (diff)
DRTVWR-582: Merge branch DRTVWR-582-maint-U into contribute-frozen
to resolve conflicts in installer_template.nsi
Diffstat (limited to 'indra/newview/llworld.cpp')
-rw-r--r--indra/newview/llworld.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 3201440b95..1266011e0a 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -33,6 +33,7 @@
#include "llstl.h"
#include "llagent.h"
+#include "llagentcamera.h"
#include "llviewercontrol.h"
#include "lldrawpool.h"
#include "llglheaders.h"
@@ -1420,6 +1421,32 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi
}
}
+S32 LLWorld::getNearbyAvatarsAndCompl(std::vector<LLCharacter*> &valid_nearby_avs)
+{
+ static LLCachedControl<F32> render_far_clip(gSavedSettings, "RenderFarClip", 64);
+ S32 nearby_max_complexity = 0;
+ F32 radius = render_far_clip * render_far_clip;
+ std::vector<LLCharacter*>::iterator char_iter = LLCharacter::sInstances.begin();
+ while (char_iter != LLCharacter::sInstances.end())
+ {
+ LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(*char_iter);
+ if (avatar && !avatar->isDead() && !avatar->isControlAvatar())
+ {
+ if ((dist_vec_squared(avatar->getPositionGlobal(), gAgent.getPositionGlobal()) > radius) &&
+ (dist_vec_squared(avatar->getPositionGlobal(), gAgentCamera.getCameraPositionGlobal()) > radius))
+ {
+ char_iter++;
+ continue;
+ }
+ avatar->calculateUpdateRenderComplexity();
+ nearby_max_complexity = llmax(nearby_max_complexity, (S32)avatar->getVisualComplexity());
+ valid_nearby_avs.push_back(*char_iter);
+ }
+ char_iter++;
+ }
+ return nearby_max_complexity;
+}
+
bool LLWorld::isRegionListed(const LLViewerRegion* region) const
{
region_list_t::const_iterator it = find(mRegionList.begin(), mRegionList.end(), region);