From abf77532d8534fe98b8c05ddf049ad429da34992 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 3 Nov 2009 19:42:52 -0700 Subject: fix the bug that textuer boost level is mixed with boolean numbers. --- indra/newview/llvovolume.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 7d4bef3f7d..1d94e9118e 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -665,7 +665,7 @@ void LLVOVolume::updateTextures() { LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); LLUUID id = sculpt_params->getSculptTexture(); - mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, TRUE, FALSE, LLViewerTexture::LOD_TEXTURE); + mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); if (mSculptTexture.notNull()) { S32 lod = llmin(mLOD, 3); @@ -876,7 +876,7 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams &volume_params, const S32 detail if (isSculpted()) { - mSculptTexture = LLViewerTextureManager::getFetchedTexture(volume_params.getSculptID(), TRUE, FALSE, LLViewerTexture::LOD_TEXTURE); + mSculptTexture = LLViewerTextureManager::getFetchedTexture(volume_params.getSculptID(), TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); if (mSculptTexture.notNull()) { //ignore sculpt GL usage since bao fixed this in a separate branch -- cgit v1.2.3 From 5e56af9c9da77a98645c54166d83589db322354f Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Thu, 5 Nov 2009 11:07:03 -0800 Subject: FIX DEV-42115: Remove modify permission check that would grant navigate/interact or controls "permission" Review #27 Back when media controls (an unfortunately much-overloaded word) was called media permission (also an overloaded word), we granted "permission" for interact/navigate or controls "display" if the requestor agent had modify permissions. This decision doesn't seem to make sense, because it is a common use case to want to "disable" controls (or perhaps interaction/navigate) even for the user who created the object (i.e. who has modify permissions). This removes that check. NOTE that this check is also made on the server, but in that case modify permissions *grants* the right to navigate in that case. Although the code is very similar, the viewer version is trying to address a use case story, whereas the other is trying to prevent a griefing vector. --- indra/newview/llvovolume.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 1d94e9118e..caeda3d1db 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1796,20 +1796,19 @@ void LLVOVolume::mediaNavigateBounceBack(U8 texture_index) bool LLVOVolume::hasMediaPermission(const LLMediaEntry* media_entry, MediaPermType perm_type) { - // NOTE: This logic duplicates the logic in the server (in particular, in llmediaservice.cpp). + // NOTE: This logic ALMOST duplicates the logic in the server (in particular, in llmediaservice.cpp). if (NULL == media_entry ) return false; // XXX should we assert here? - // The agent has permissions to navigate if: - // - agent has edit permissions, or + // The agent has permissions if: // - world permissions are on, or // - group permissions are on, and agent_id is in the group, or // - agent permissions are on, and agent_id is the owner - if (permModify()) - { - return true; - } - + // *NOTE: We *used* to check for modify permissions here (i.e. permissions were + // granted if permModify() was true). However, this doesn't make sense in the + // viewer: we don't want to show controls or allow interaction if the author + // has deemed it so. See DEV-42115. + U8 media_perms = (perm_type == MEDIA_PERM_INTERACT) ? media_entry->getPermsInteract() : media_entry->getPermsControl(); // World permissions -- cgit v1.2.3 From 35e200881c38eb6c1bfd1f14ef440d4bc4da8c74 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 6 Nov 2009 06:52:24 +0000 Subject: merge QAR-1829: texture pipeline branch in viewer-2.0.0.3 --- indra/newview/llvovolume.cpp | 193 ++++++++++++++++--------------------------- 1 file changed, 72 insertions(+), 121 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 583246c23e..08b342b978 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -53,12 +53,10 @@ #include "lldrawpoolbump.h" #include "llface.h" #include "llspatialpartition.h" - -// TEMP HACK ventrella #include "llhudmanager.h" #include "llflexibleobject.h" - #include "llsky.h" +#include "lltexturefetch.h" #include "llviewercamera.h" #include "llviewertexturelist.h" #include "llviewerregion.h" @@ -75,7 +73,6 @@ const S32 MIN_QUIET_FRAMES_COALESCE = 30; const F32 FORCE_SIMPLE_RENDER_AREA = 512.f; const F32 FORCE_CULL_AREA = 8.f; const F32 MAX_LOD_DISTANCE = 24.f; -const S32 MAX_SCULPT_REZ = 128; BOOL gAnimateTextures = TRUE; @@ -100,7 +97,6 @@ LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *re mRelativeXformInvTrans.setIdentity(); mLOD = MIN_LOD; - mSculptLevel = -2; mTextureAnimp = NULL; mVObjRadius = LLVector3(1,1,0.5f).length(); mNumFaces = 0; @@ -499,28 +495,32 @@ BOOL LLVOVolume::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) return TRUE; } -void LLVOVolume::updateTextures(LLAgent &agent) +void LLVOVolume::updateTextures() { const F32 TEXTURE_AREA_REFRESH_TIME = 5.f; // seconds - if (mDrawable.notNull() && mTextureUpdateTimer.getElapsedTimeF32() > TEXTURE_AREA_REFRESH_TIME) + if (mTextureUpdateTimer.getElapsedTimeF32() > TEXTURE_AREA_REFRESH_TIME) { - if (mDrawable->isVisible()) - { - updateTextures(); - } + updateTextureVirtualSize(); } } -void LLVOVolume::updateTextures() +void LLVOVolume::updateTextureVirtualSize() { // Update the pixel area of all faces + if(mDrawable.isNull() || !mDrawable->isVisible()) + { + return ; + } + if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SIMPLE)) { return; } - - if (LLViewerTexture::sDontLoadVolumeTextures || mDrawable.isNull()) // || !mDrawable->isVisible()) + + static LLCachedControl dont_load_textures(gSavedSettings,"TextureDisable"); + + if (dont_load_textures || LLAppViewer::getTextureFetch()->mDebugPause) // || !mDrawable->isVisible()) { return; } @@ -537,14 +537,15 @@ void LLVOVolume::updateTextures() LLFace* face = mDrawable->getFace(i); const LLTextureEntry *te = face->getTextureEntry(); LLViewerTexture *imagep = face->getTexture(); - if (!imagep || !te || + if (!imagep || !te || face->mExtents[0] == face->mExtents[1]) { continue; } F32 vsize; - + F32 old_size = face->getVirtualSize(); + if (isHUDAttachment()) { F32 area = (F32) LLViewerCamera::getInstance()->getScreenPixelArea(); @@ -554,12 +555,10 @@ void LLVOVolume::updateTextures() } else { - vsize = getTextureVirtualSize(face); + vsize = face->getTextureVirtualSize(); } - mPixelArea = llmax(mPixelArea, face->getPixelArea()); - - F32 old_size = face->getVirtualSize(); + mPixelArea = llmax(mPixelArea, face->getPixelArea()); if (face->mTextureMatrix != NULL) { @@ -571,7 +570,6 @@ void LLVOVolume::updateTextures() } face->setVirtualSize(vsize); - imagep->addTextureStats(vsize); if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA)) { if (vsize < min_vsize) min_vsize = vsize; @@ -603,32 +601,44 @@ void LLVOVolume::updateTextures() mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, TRUE, FALSE, LLViewerTexture::LOD_TEXTURE); if (mSculptTexture.notNull()) { - S32 lod = llmin(mLOD, 3); - F32 lodf = ((F32)(lod + 1.0f)/4.f); - F32 tex_size = lodf * MAX_SCULPT_REZ; - mSculptTexture->addTextureStats(2.f * tex_size * tex_size); mSculptTexture->setBoostLevel(llmax((S32)mSculptTexture->getBoostLevel(), (S32)LLViewerTexture::BOOST_SCULPTED)); mSculptTexture->setForSculpt() ; - } - - S32 texture_discard = mSculptTexture->getDiscardLevel(); //try to match the texture - S32 current_discard = mSculptLevel; + + if(!mSculptTexture->isCachedRawImageReady()) + { + S32 lod = llmin(mLOD, 3); + F32 lodf = ((F32)(lod + 1.0f)/4.f); + F32 tex_size = lodf * LLViewerTexture::sMaxSculptRez ; + mSculptTexture->addTextureStats(2.f * tex_size * tex_size, FALSE); + + //if the sculpty very close to the view point, load first + { + LLVector3 lookAt = getPositionAgent() - LLViewerCamera::getInstance()->getOrigin(); + F32 dist = lookAt.normVec() ; + F32 cos_angle_to_view_dir = lookAt * LLViewerCamera::getInstance()->getXAxis() ; + mSculptTexture->setAdditionalDecodePriority(0.8f * LLFace::calcImportanceToCamera(cos_angle_to_view_dir, dist)) ; + } + } + + S32 texture_discard = mSculptTexture->getDiscardLevel(); //try to match the texture + S32 current_discard = getVolume() ? getVolume()->getSculptLevel() : -2 ; - if (texture_discard >= 0 && //texture has some data available - (texture_discard < current_discard || //texture has more data than last rebuild - current_discard < 0)) //no previous rebuild - { - gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, FALSE); - mSculptChanged = TRUE; - } + if (texture_discard >= 0 && //texture has some data available + (texture_discard < current_discard || //texture has more data than last rebuild + current_discard < 0)) //no previous rebuild + { + gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, FALSE); + mSculptChanged = TRUE; + } - if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SCULPTED)) + if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SCULPTED)) { setDebugText(llformat("T%d C%d V%d\n%dx%d", - texture_discard, current_discard, getVolume()->getSculptLevel(), - mSculptTexture->getHeight(), mSculptTexture->getWidth())); + texture_discard, current_discard, getVolume()->getSculptLevel(), + mSculptTexture->getHeight(), mSculptTexture->getWidth())); } + } } if (getLightTextureID().notNull()) @@ -649,10 +659,10 @@ void LLVOVolume::updateTextures() { setDebugText(llformat("%.0f:%.0f", fsqrtf(min_vsize),fsqrtf(max_vsize))); } - else if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY)) - { - setDebugText(llformat("%.0f:%.0f", fsqrtf(min_vsize),fsqrtf(max_vsize))); - } + else if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY)) + { + setDebugText(llformat("%.0f:%.0f", fsqrtf(min_vsize),fsqrtf(max_vsize))); + } else if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_FACE_AREA)) { setDebugText(llformat("%.0f:%.0f", fsqrtf(min_vsize),fsqrtf(max_vsize))); @@ -664,36 +674,6 @@ void LLVOVolume::updateTextures() } } -F32 LLVOVolume::getTextureVirtualSize(LLFace* face) -{ - //get area of circle around face - LLVector3 center = face->getPositionAgent(); - LLVector3 size = (face->mExtents[1] - face->mExtents[0]) * 0.5f; - - F32 face_area = LLPipeline::calcPixelArea(center, size, *LLViewerCamera::getInstance()); - - face->setPixelArea(face_area); - - if (face_area <= 0) - { - return 0.f; - } - - //get area of circle in texture space - LLVector2 tdim = face->mTexExtents[1] - face->mTexExtents[0]; - F32 texel_area = (tdim * 0.5f).lengthSquared()*3.14159f; - if (texel_area <= 0) - { - // Probably animated, use default - texel_area = 1.f; - } - - //apply texel area to face area to get accurate ratio - face_area /= llclamp(texel_area, 1.f/64.f, 16.f); - - return face_area; -} - BOOL LLVOVolume::isActive() const { return !mStatic || mTextureAnimp || (mVolumeImpl && mVolumeImpl->isActive()); @@ -770,7 +750,6 @@ LLDrawable *LLVOVolume::createDrawable(LLPipeline *pipeline) return mDrawable; } - BOOL LLVOVolume::setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume) { // Check if we need to change implementations @@ -825,7 +804,6 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams &volume_params, const S32 detail { sculpt(); } - mSculptLevel = getVolume()->getSculptLevel(); } } else @@ -840,32 +818,22 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams &volume_params, const S32 detail // sculpt replaces generate() for sculpted surfaces void LLVOVolume::sculpt() -{ - U16 sculpt_height = 0; - U16 sculpt_width = 0; - S8 sculpt_components = 0; - const U8* sculpt_data = NULL; - +{ if (mSculptTexture.notNull()) - { - S32 discard_level; - S32 desired_discard = 0; // lower discard levels have MUCH less resolution - - discard_level = desired_discard; + { + U16 sculpt_height = 0; + U16 sculpt_width = 0; + S8 sculpt_components = 0; + const U8* sculpt_data = NULL; + + S32 discard_level = mSculptTexture->getDiscardLevel() ; + LLImageRaw* raw_image = mSculptTexture->getCachedRawImage() ; S32 max_discard = mSculptTexture->getMaxDiscardLevel(); if (discard_level > max_discard) discard_level = max_discard; // clamp to the best we can do - S32 best_discard = mSculptTexture->getDiscardLevel(); - if (discard_level < best_discard) - discard_level = best_discard; // clamp to what we have - - if (best_discard == -1) - discard_level = -1; // and if we have nothing, set to nothing - - - S32 current_discard = getVolume()->getSculptLevel(); + S32 current_discard = getVolume()->getSculptLevel() ; if(current_discard < -2) { llwarns << "WARNING!!: Current discard of sculpty at " << current_discard @@ -886,18 +854,7 @@ void LLVOVolume::sculpt() if (current_discard == discard_level) // no work to do here return; - LLPointer raw_image = new LLImageRaw(); - BOOL is_valid = mSculptTexture->readBackRaw(discard_level, raw_image, FALSE); - - sculpt_height = raw_image->getHeight(); - sculpt_width = raw_image->getWidth(); - sculpt_components = raw_image->getComponents(); - - if(is_valid) - { - is_valid = mSculptTexture->isValidForSculpt(discard_level, sculpt_width, sculpt_height, sculpt_components) ; - } - if(!is_valid) + if(!raw_image) { sculpt_width = 0; sculpt_height = 0; @@ -909,10 +866,10 @@ void LLVOVolume::sculpt() } } else - { - if (raw_image->getDataSize() < sculpt_height * sculpt_width * sculpt_components) - llerrs << "Sculpt: image data size = " << raw_image->getDataSize() - << " < " << sculpt_height << " x " << sculpt_width << " x " <getHeight(); + sculpt_width = raw_image->getWidth(); + sculpt_components = raw_image->getComponents(); sculpt_data = raw_image->getData(); @@ -948,12 +905,6 @@ BOOL LLVOVolume::calcLOD() return FALSE; } - //update face texture sizes on lod calculation - //if (mDrawable->isVisible()) - //{ - // updateTextures(); - //} - S32 cur_detail = 0; F32 radius = getVolume()->mLODScaleBias.scaledVec(getScale()).length(); @@ -2608,7 +2559,7 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e if (face == -1) { start_face = 0; - end_face = volume->getNumFaces(); + end_face = volume->getNumVolumeFaces(); } else { @@ -2623,8 +2574,8 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e if (face_hit >= 0 && mDrawable->getNumFaces() > face_hit) { - LLFace* face = mDrawable->getFace(face_hit); - + LLFace* face = mDrawable->getFace(face_hit); + if (pick_transparent || !face->getTexture() || !face->getTexture()->hasGLTexture() || face->getTexture()->getMask(face->surfaceToTexture(tc, p, n))) { v_end = p; @@ -2870,7 +2821,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) LLVOVolume* vobj = drawablep->getVOVolume(); llassert_always(vobj); - vobj->updateTextures(); + vobj->updateTextureVirtualSize(); vobj->preRebuild(); drawablep->clearState(LLDrawable::HAS_ALPHA); -- cgit v1.2.3 From 904f6124b282e3e9668289bef9f7d44f8539ce51 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Fri, 6 Nov 2009 13:27:28 +0000 Subject: magic number removal rampage: 3.14159 -> M_PI or F_PI --HG-- branch : texture-pipeline --- indra/newview/llvovolume.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 1704f63376..421e6fdff5 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -739,15 +739,15 @@ F32 LLVOVolume::getTextureVirtualSize(LLFace* face) face->setPixelArea(face_area); - if (face_area <= 0) + if (face_area <= 0.f) { return 0.f; } //get area of circle in texture space LLVector2 tdim = face->mTexExtents[1] - face->mTexExtents[0]; - F32 texel_area = (tdim * 0.5f).lengthSquared()*3.14159f; - if (texel_area <= 0) + F32 texel_area = (tdim * 0.5f).lengthSquared()*F_PI; + if (texel_area <= 0.f) { // Probably animated, use default texel_area = 1.f; @@ -1036,7 +1036,7 @@ BOOL LLVOVolume::calcLOD() } // DON'T Compensate for field of view changing on FOV zoom. - distance *= 3.14159f/3.f; + distance *= F_PI/3.f; cur_detail = computeLODDetail(llround(distance, 0.01f), llround(radius, 0.01f)); -- cgit v1.2.3 From 5fba55f58e35e52485f161d069f323120ec68b6d Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Fri, 6 Nov 2009 19:30:52 -0800 Subject: Partial fix for DEV-42153. This code seems to work on some objects and not on others. I suspect I'm not doing something quite right in LLVOVolume::getApproximateFaceNormal(). --- indra/newview/llvovolume.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 78f534bacd..021fc74648 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1638,6 +1638,45 @@ bool LLVOVolume::hasMedia() const return result; } +LLVector3 LLVOVolume::getApproximateFaceNormal(U8 face_id) +{ + LLVector3 result = LLVector3::zero; + + LLFace* facep = mDrawable->getFace(face_id); + if(facep) + { + LLStrider verticesp; + LLStrider normalsp; + LLStrider texCoordsp; + LLStrider indicesp; + S32 index_offset; + index_offset = facep->getGeometry(verticesp,normalsp,texCoordsp, indicesp); + + if(index_offset != -1 && (normalsp.get() != NULL)) + { + U16 count = facep->getGeomCount(); + U16 i; + + for(i=0; i < count; i++) + { + LLVector3 normal = *normalsp++; +// llinfos << "adding " << normal << llendl; + result += normal; + } + } + } + + if(!result.isNull()) + { +// llinfos << "before conversion: " << result << llendl; + result = volumeDirectionToAgent(result); + result.normalize(); +// llinfos << "after conversion: " << result << llendl; + } + + return result; +} + void LLVOVolume::requestMediaDataUpdate() { sObjectMediaClient->fetchMedia(new LLMediaDataClientObjectImpl(this)); -- cgit v1.2.3 From e477a74feb21c4ddcb077c7256457b44e69fba24 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Mon, 9 Nov 2009 12:14:29 -0800 Subject: Better fix for DEV-42153. --- indra/newview/llvovolume.cpp | 39 ++++++++++----------------------------- 1 file changed, 10 insertions(+), 29 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 021fc74648..09769d5e80 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1640,38 +1640,19 @@ bool LLVOVolume::hasMedia() const LLVector3 LLVOVolume::getApproximateFaceNormal(U8 face_id) { - LLVector3 result = LLVector3::zero; - - LLFace* facep = mDrawable->getFace(face_id); - if(facep) - { - LLStrider verticesp; - LLStrider normalsp; - LLStrider texCoordsp; - LLStrider indicesp; - S32 index_offset; - index_offset = facep->getGeometry(verticesp,normalsp,texCoordsp, indicesp); - - if(index_offset != -1 && (normalsp.get() != NULL)) + LLVolume* volume = getVolume(); + LLVector3 result; + + if (volume && face_id < volume->getNumVolumeFaces()) + { + const LLVolumeFace& face = volume->getVolumeFace(face_id); + for (S32 i = 0; i < face.mVertices.size(); ++i) { - U16 count = facep->getGeomCount(); - U16 i; - - for(i=0; i < count; i++) - { - LLVector3 normal = *normalsp++; -// llinfos << "adding " << normal << llendl; - result += normal; - } + result += face.mVertices[i].mNormal; } - } - - if(!result.isNull()) - { -// llinfos << "before conversion: " << result << llendl; + result = volumeDirectionToAgent(result); - result.normalize(); -// llinfos << "after conversion: " << result << llendl; + result.normVec(); } return result; -- cgit v1.2.3 From b82fadeda8489134a12bb573e612f32e135d6cc5 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 9 Nov 2009 14:01:32 -0800 Subject: Fix signed/unsigned build breakage in llvovolume.cpp --- indra/newview/llvovolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 09769d5e80..a32abf3ab9 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1646,7 +1646,7 @@ LLVector3 LLVOVolume::getApproximateFaceNormal(U8 face_id) if (volume && face_id < volume->getNumVolumeFaces()) { const LLVolumeFace& face = volume->getVolumeFace(face_id); - for (S32 i = 0; i < face.mVertices.size(); ++i) + for (S32 i = 0; i < (S32)face.mVertices.size(); ++i) { result += face.mVertices[i].mNormal; } -- cgit v1.2.3 From caadf0be39b844e6bf91c5a302a837d107a1e415 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Mon, 9 Nov 2009 16:19:33 -0800 Subject: Fix for DEV-42029 (changing media on multiple faces can make a zombie SLPlugin). Made LLViewerMedia::updateMediaImpl() unload the impl's media plugin when the current URL goes empty. Made LLVOVolume::syncMediaData() call removeMediaImpl() if the media data gets deleted. --- indra/newview/llvovolume.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index a32abf3ab9..c987dd1764 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1733,6 +1733,10 @@ void LLVOVolume::syncMediaData(S32 texture_index, const LLSD &media_data, bool m addMediaImpl(media_impl, texture_index) ; } + else + { + removeMediaImpl(texture_index); + } //llinfos << "AFTER: texture_index = " << texture_index // << " hasMedia = " << te->hasMedia() << " : " -- cgit v1.2.3 From f4186b6d3d45259c83fa1b13db25abcd34f227a9 Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Mon, 9 Nov 2009 18:17:42 -0800 Subject: PARTIAL FIX (workaround) DEV-41949: LLMediaEntry::setWhitelist() and LLMediaEntry::asLLSD() have a contract conflict Review #31 So, here's what was happening, briefly: - LLMediaEntry::setWhitelist() would be a no-op if given an LLSD that did not have a WHITELIST_KEY - LLMediaEntry::asLLSD() would render the LLMediaEntry *without* a WHITELIST_KEY if the whitelist was empty Therefore, when the viewer marshalled an LLMediaEntry for the server, it would send it without a WHITELIST_KEY. When the server got it, it would not erase the last value. This is actually a workaround: it patches asLLSD() with an LLSD::emptyArray() if the key is not there. However, this should be fixed on the server: in either or both of the following ways: 1) LLMediaEntry::setWhitelist() should not be a no-op if the LLSD has no WHITELIST_KEY: it should erase the whitelist 2) LLMediaEntry::asLLSD() should render an empty whitelist in WHITELIST_KEY as an empty array Note that both could be done and still work. A unit test should and will be written next. --- indra/newview/llvovolume.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 021fc74648..3803c65e74 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -108,6 +108,11 @@ public: if (te->getMediaData() != NULL) { result = te->getMediaData()->asLLSD(); + // XXX HACK: workaround bug in asLLSD() where whitelist is not set properly + if (!result.has(LLMediaEntry::WHITELIST_KEY)) + { + result[LLMediaEntry::WHITELIST_KEY] = LLSD::emptyArray(); + } } } return result; -- cgit v1.2.3