diff options
author | Dave Parks <davep@lindenlab.com> | 2010-07-14 11:11:31 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2010-07-14 11:11:31 -0500 |
commit | 13202e744c35f0c6154cd0b582b1834896cacb79 (patch) | |
tree | 6a78237dd74c6270201afb6921e34e0b81dcfad5 /indra/newview/llviewerobjectlist.cpp | |
parent | b46fff1ba1450d14424e676f31c0cacd921bedb0 (diff) | |
parent | 2dd3a6be720ed6ce7c17415fc8d81869cf46f3a0 (diff) |
merge
Diffstat (limited to 'indra/newview/llviewerobjectlist.cpp')
-rw-r--r-- | indra/newview/llviewerobjectlist.cpp | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index fc94fbafac..900aa3ce12 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -60,6 +60,7 @@ #include "llviewercamera.h" #include "llselectmgr.h" #include "llresmgr.h" +#include "llsdutil.h" #include "llviewerregion.h" #include "llviewerstats.h" #include "llvoavatarself.h" @@ -656,6 +657,21 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent) LLVOAvatar::cullAvatarsByPixelArea(); } +class LLObjectCostResponder : public LLCurl::Responder +{ +public: + void result(const LLSD& content) + { + for (LLSD::map_const_iterator iter = content.beginMap(); iter != content.endMap(); ++iter) + { + LLUUID object_id = LLUUID(iter->first); + F32 link_cost = iter->second["LinksetResourceCost"].asReal(); + F32 prim_cost = iter->second["PrimResourceCost"].asReal(); + + gObjectList.updateObjectCost(object_id, prim_cost, link_cost); + } + } +}; void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) { @@ -753,6 +769,43 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) } } + //issue http request for stale object physics costs + if (!mStaleObjectCost.empty()) + { + LLViewerRegion* regionp = gAgent.getRegion(); + + if (regionp) + { + std::string url = regionp->getCapability("GetObjectCost"); + + if (!url.empty()) + { + LLSD id_list; + U32 idx = 0; + for (std::set<LLUUID>::iterator iter = mStaleObjectCost.begin(); iter != mStaleObjectCost.end(); ++iter) + { + if (mPendingObjectCost.find(*iter) == mPendingObjectCost.end()) + { + mPendingObjectCost.insert(*iter); + id_list[idx++] = *iter; + } + } + mPendingObjectCost = mStaleObjectCost; + mStaleObjectCost.clear(); + + if (id_list.size() > 0) + { + LLHTTPClient::post(url, id_list, new LLObjectCostResponder()); + } + } + else + { + mStaleObjectCost.clear(); + mPendingObjectCost.clear(); + } + } + } + mNumSizeCulled = 0; mNumVisCulled = 0; @@ -871,8 +924,12 @@ void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp) mNumDeadObjects++; } +static LLFastTimer::DeclareTimer FTM_REMOVE_DRAWABLE("Remove Drawable"); + void LLViewerObjectList::removeDrawable(LLDrawable* drawablep) { + LLFastTimer t(FTM_REMOVE_DRAWABLE); + if (!drawablep) { return; @@ -1037,7 +1094,22 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp) } } +void LLViewerObjectList::updateObjectCost(LLViewerObject* object) +{ + mStaleObjectCost.insert(object->getID()); +} + +void LLViewerObjectList::updateObjectCost(LLUUID object_id, F32 prim_cost, F32 link_cost) +{ + mPendingObjectCost.erase(object_id); + LLViewerObject* object = findObject(object_id); + if (object) + { + object->setObjectCost(prim_cost); + object->setLinksetCost(link_cost); + } +} void LLViewerObjectList::shiftObjects(const LLVector3 &offset) { |