From d334a9e645ab14c2822f35ee67d2c1e0f2a646a6 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 13 May 2010 14:54:56 -0500 Subject: Vis that works and first pass at fetching prim cost. --- indra/newview/llspatialpartition.cpp | 7 +++++- indra/newview/llviewerobject.cpp | 1 + indra/newview/llviewerobject.h | 4 +++ indra/newview/llviewerobjectlist.cpp | 47 +++++++++++++++++++++++++++++++++++- indra/newview/llviewerobjectlist.h | 6 +++++ indra/newview/llviewerregion.cpp | 1 + 6 files changed, 64 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 025c5084c3..f11195303e 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2670,6 +2670,11 @@ void renderPhysicsShape(LLDrawable* drawable) const LLMeshDecomposition* decomp = gMeshRepo.getDecomposition(mesh_id); if (decomp) { + if (volume->getObjectCost() == -1) + { + gObjectList.updateObjectCost(volume); + } + gGL.pushMatrix(); glMultMatrixf((F32*) volume->getRelativeXform().mMatrix); static std::vector color; @@ -2688,7 +2693,7 @@ void renderPhysicsShape(LLDrawable* drawable) buff->setBuffer(LLVertexBuffer::MAP_VERTEX); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - glColor4ubv(color[i].mV); + glColor3ub(color[i].mV[0], color[i].mV[1], color[i].mV[2]); buff->drawArrays(LLRender::TRIANGLES, 0, buff->getNumVerts()); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 3aecd0175d..38a29ba432 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -232,6 +232,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mState(0), mMedia(NULL), mClickAction(0), + mObjectCost(-1), mAttachmentItemID(LLUUID::null) { if (!is_global) diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 0fd0cbfa60..d2e465fe5a 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -334,6 +334,9 @@ public: virtual void setScale(const LLVector3 &scale, BOOL damped = FALSE); + void setObjectCost(S32 cost) { mObjectCost = cost; } + S32 getObjectCost() { return mObjectCost; } + void sendShapeUpdate(); U8 getState() { return mState; } @@ -668,6 +671,7 @@ protected: U8 mState; // legacy LLViewerObjectMedia* mMedia; // NULL if no media associated U8 mClickAction; + S32 mObjectCost; //resource cost of this object or -1 if unknown static U32 sNumZombieObjects; // Objects which are dead, but not deleted diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 7ba28fef32..047241fffb 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -656,6 +656,14 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent) LLVOAvatar::cullAvatarsByPixelArea(); } +class LLObjectCostResponder : public LLCurl::Responder +{ +public: + void result(const LLSD& content) + { + llinfos << content << llendl; + } +}; void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) { @@ -753,6 +761,40 @@ 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::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(); + + LLHTTPClient::post(url, id_list, new LLObjectCostResponder()); + } + else + { + mStaleObjectCost.clear(); + mPendingObjectCost.clear(); + } + } + } + mNumSizeCulled = 0; mNumVisCulled = 0; @@ -1041,7 +1083,10 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp) } } - +void LLViewerObjectList::updateObjectCost(LLViewerObject* object) +{ + mStaleObjectCost.insert(object->getID()); +} void LLViewerObjectList::shiftObjects(const LLVector3 &offset) { diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index 706966deae..ca228a6462 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -91,6 +91,8 @@ public: void updateApparentAngles(LLAgent &agent); void update(LLAgent &agent, LLWorld &world); + void updateObjectCost(LLViewerObject* object); + void shiftObjects(const LLVector3 &offset); void renderObjectsForMap(LLNetMap &netmap); @@ -192,6 +194,10 @@ protected: std::map > mUUIDObjectMap; + //set of objects that need to update their cost + std::set mStaleObjectCost; + std::set mPendingObjectCost; + std::vector mDebugBeacons; S32 mCurLazyUpdateIndex; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 4fdabd7ff0..59d419d67a 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1497,6 +1497,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url) capabilityNames.append("FetchLibDescendents"); capabilityNames.append("GetTexture"); capabilityNames.append("GetMesh"); + capabilityNames.append("GetObjectCost"); capabilityNames.append("GroupProposalBallot"); capabilityNames.append("HomeLocation"); capabilityNames.append("LandResources"); -- cgit v1.2.3