diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2025-02-04 21:11:43 +0200 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-02-05 18:50:31 +0200 |
commit | 74d2ed918dd185cbc47ed64f78be76ae6b94a60f (patch) | |
tree | 15be271670e3cd3d8891485c8fe2f3d539d6e0d3 /indra | |
parent | b84f3ff6b129cd71955bcb1fc885491b7002f87f (diff) |
#3488 Speed up nearby avatar loading after a tp
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llmeshrepository.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 36 |
2 files changed, 38 insertions, 4 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 699bec539c..fdc7520d4d 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -2313,7 +2313,11 @@ EMeshProcessingResult LLMeshRepoThread::lodReceived(const LLVolumeParams& mesh_p LLPointer<LLMeshSkinInfo> skin_info = nullptr; { LLMutexLock lock(mSkinMapMutex); - skin_info = mSkinMap[mesh_params.getSculptID()]; + skin_map::iterator iter = mSkinMap.find(mesh_params.getSculptID()); + if (iter != mSkinMap.end()) + { + skin_info = iter->second; + } } if (skin_info.notNull() && isAgentAvatarValid()) { diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 0c702b24c1..db91678254 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3147,8 +3147,9 @@ void send_agent_update(bool force_send, bool send_reliable) LL_PROFILE_ZONE_SCOPED; llassert(!gCubeSnapshot); - if (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE - && gAgent.getTeleportState() != LLAgent::TELEPORT_ARRIVING) + LLAgent::ETeleportState tp_state = gAgent.getTeleportState(); + if (tp_state != LLAgent::TELEPORT_NONE + && tp_state != LLAgent::TELEPORT_ARRIVING) { // We don't care if they want to send an agent update, they're not allowed // until the target simulator is ready to receive them @@ -3323,7 +3324,36 @@ void send_agent_update(bool force_send, bool send_reliable) msg->addVector3Fast(_PREHASH_CameraAtAxis, camera_at); msg->addVector3Fast(_PREHASH_CameraLeftAxis, LLViewerCamera::getInstance()->getLeftAxis()); msg->addVector3Fast(_PREHASH_CameraUpAxis, LLViewerCamera::getInstance()->getUpAxis()); - msg->addF32Fast(_PREHASH_Far, gAgentCamera.mDrawDistance); + + static F32 last_draw_disatance_step = 1024; + if (tp_state == LLAgent::TELEPORT_ARRIVING || LLStartUp::getStartupState() < STATE_MISC) + { + // Inform interest list, prioritize closer area. + // Reason: currently server doesn't distance sort attachments, by restricting range + // we reduce the number of attachments sent to the viewer, thus prioritizing + // closer ones. + // Todo: revise and remove once server gets distance sorting. + last_draw_disatance_step = llmax((F32)(gAgentCamera.mDrawDistance / 2.f), 64.f); + msg->addF32Fast(_PREHASH_Far, last_draw_disatance_step); + } + else if (last_draw_disatance_step < gAgentCamera.mDrawDistance) + { + static LLFrameTimer last_step_time; + if (last_step_time.getElapsedTimeF32() > 1.f) + { + // gradually increase draw distance + // Idealy this should be not per second, but based on how loaded + // mesh thread is, but hopefully this is temporary. + last_step_time.reset(); + F32 step = gAgentCamera.mDrawDistance * 0.1f; + last_draw_disatance_step = llmin(last_draw_disatance_step + step, gAgentCamera.mDrawDistance); + } + msg->addF32Fast(_PREHASH_Far, last_draw_disatance_step); + } + else + { + msg->addF32Fast(_PREHASH_Far, gAgentCamera.mDrawDistance); + } msg->addU32Fast(_PREHASH_ControlFlags, control_flags); |