diff options
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rw-r--r-- | indra/newview/llvovolume.cpp | 148 |
1 files changed, 141 insertions, 7 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 5ac6dcce5a..428af5380c 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -109,6 +109,7 @@ public: { result = te->getMediaData()->asLLSD(); // XXX HACK: workaround bug in asLLSD() where whitelist is not set properly + // See DEV-41949 if (!result.has(LLMediaEntry::WHITELIST_KEY)) { result[LLMediaEntry::WHITELIST_KEY] = LLSD::emptyArray(); @@ -139,6 +140,9 @@ public: virtual std::string getCapabilityUrl(const std::string &name) const { return mObject->getRegion()->getCapability(name); } + virtual bool isDead() const + { return mObject->isDead(); } + private: LLPointer<LLVOVolume> mObject; }; @@ -182,6 +186,22 @@ LLVOVolume::~LLVOVolume() } } +void LLVOVolume::markDead() +{ + if (!mDead) + { + // TODO: tell LLMediaDataClient to remove this object from its queue + + // Detach all media impls from this object + for(U32 i = 0 ; i < mMediaImplList.size() ; i++) + { + removeMediaImpl(i); + } + } + + LLViewerObject::markDead(); +} + // static void LLVOVolume::initClass() @@ -1668,6 +1688,13 @@ void LLVOVolume::requestMediaDataUpdate() sObjectMediaClient->fetchMedia(new LLMediaDataClientObjectImpl(this)); } +bool LLVOVolume::isMediaDataBeingFetched() const +{ + // I know what I'm doing by const_casting this away: this is just + // a wrapper class that is only going to do a lookup. + return sObjectMediaClient->isInQueue(new LLMediaDataClientObjectImpl(const_cast<LLVOVolume*>(this))); +} + void LLVOVolume::cleanUpMediaImpls() { // Iterate through our TEs and remove any Impls that are no longer used @@ -1700,10 +1727,16 @@ void LLVOVolume::updateObjectMediaData(const LLSD &media_data_array) void LLVOVolume::syncMediaData(S32 texture_index, const LLSD &media_data, bool merge, bool ignore_agent) { + if(mDead) + { + // If the object has been marked dead, don't process media updates. + return; + } + LLTextureEntry *te = getTE(texture_index); - //llinfos << "BEFORE: texture_index = " << texture_index - // << " hasMedia = " << te->hasMedia() << " : " - // << ((NULL == te->getMediaData()) ? "NULL MEDIA DATA" : ll_pretty_print_sd(te->getMediaData()->asLLSD())) << llendl; + LL_DEBUGS("MediaOnAPrim") << "BEFORE: texture_index = " << texture_index + << " hasMedia = " << te->hasMedia() << " : " + << ((NULL == te->getMediaData()) ? "NULL MEDIA DATA" : ll_pretty_print_sd(te->getMediaData()->asLLSD())) << llendl; std::string previous_url; LLMediaEntry* mep = te->getMediaData(); @@ -1743,9 +1776,9 @@ void LLVOVolume::syncMediaData(S32 texture_index, const LLSD &media_data, bool m removeMediaImpl(texture_index); } - //llinfos << "AFTER: texture_index = " << texture_index - // << " hasMedia = " << te->hasMedia() << " : " - // << ((NULL == te->getMediaData()) ? "NULL MEDIA DATA" : ll_pretty_print_sd(te->getMediaData()->asLLSD())) << llendl; + LL_DEBUGS("MediaOnAPrim") << "AFTER: texture_index = " << texture_index + << " hasMedia = " << te->hasMedia() << " : " + << ((NULL == te->getMediaData()) ? "NULL MEDIA DATA" : ll_pretty_print_sd(te->getMediaData()->asLLSD())) << llendl; } void LLVOVolume::mediaNavigateBounceBack(U8 texture_index) @@ -1768,7 +1801,7 @@ void LLVOVolume::mediaNavigateBounceBack(U8 texture_index) } if (! url.empty()) { - LL_INFOS("LLMediaDataClient") << "bouncing back to URL: " << url << LL_ENDL; + LL_INFOS("MediaOnAPrim") << "bouncing back to URL: " << url << LL_ENDL; impl->navigateTo(url, "", false, true); } } @@ -2533,6 +2566,107 @@ const LLMatrix4 LLVOVolume::getRenderMatrix() const return mDrawable->getWorldMatrix(); } +U32 LLVOVolume::getRenderCost() const +{ + U32 shame = 0; + + U32 invisi = 0; + U32 shiny = 0; + U32 glow = 0; + U32 alpha = 0; + U32 flexi = 0; + U32 animtex = 0; + U32 particles = 0; + U32 scale = 0; + U32 bump = 0; + U32 planar = 0; + + if (isFlexible()) + { + flexi = 1; + } + if (isParticleSource()) + { + particles = 1; + } + + const LLVector3& sc = getScale(); + scale += (U32) sc.mV[0] + (U32) sc.mV[1] + (U32) sc.mV[2]; + + const LLDrawable* drawablep = mDrawable; + + if (isSculpted()) + { + const LLSculptParams *sculpt_params = (LLSculptParams *) getParameterEntry(LLNetworkData::PARAMS_SCULPT); + LLUUID sculpt_id = sculpt_params->getSculptTexture(); + shame += 5; + } + + for (S32 i = 0; i < drawablep->getNumFaces(); ++i) + { + const LLFace* face = drawablep->getFace(i); + const LLTextureEntry* te = face->getTextureEntry(); + const LLViewerTexture* img = face->getTexture(); + + shame += 5; + + if (face->getPoolType() == LLDrawPool::POOL_ALPHA) + { + alpha++; + } + else if (img->getPrimaryFormat() == GL_ALPHA) + { + invisi = 1; + } + + if (te) + { + if (te->getBumpmap()) + { + bump = 1; + } + if (te->getShiny()) + { + shiny = 1; + } + if (te->getGlow() > 0.f) + { + glow = 1; + } + if (face->mTextureMatrix != NULL) + { + animtex++; + } + if (te->getTexGen()) + { + planar++; + } + } + } + + shame += invisi + shiny + glow + alpha*4 + flexi*8 + animtex*4 + particles*16+bump*4+scale+planar; + + LLViewerObject::const_child_list_t& child_list = getChildren(); + for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); + iter != child_list.end(); + ++iter) + { + const LLViewerObject* child_objectp = *iter; + const LLDrawable* child_drawablep = child_objectp->mDrawable; + if (child_drawablep) + { + const LLVOVolume* child_volumep = child_drawablep->getVOVolume(); + if (child_volumep) + { + shame += child_volumep->getRenderCost(); + } + } + } + + return shame; + +} + //static void LLVOVolume::preUpdateGeom() { |