summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2010-02-11 18:02:43 -0800
committerXiaohong Bao <bao@lindenlab.com>2010-02-11 18:02:43 -0800
commita5c725c189254388af06bdee7317774bc0264940 (patch)
tree4860d9535b0d4e529c7799826bc5675e6f5348ba /indra
parentf791d103c85fdb1a8b5f9f32365708915d1cfe74 (diff)
parente0e82c908dd7aef7a0d3010be4bbc9fa1ac4d32a (diff)
Automated merge with ssh://hg.lindenlab.com/viewer/viewer-2-0
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llface.cpp45
-rw-r--r--indra/newview/llface.h2
-rw-r--r--indra/newview/lltexturefetch.cpp7
-rw-r--r--indra/newview/llviewertexture.cpp31
-rw-r--r--indra/newview/llvovolume.cpp4
5 files changed, 45 insertions, 44 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index c0a3eb1316..80acc71a41 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -182,6 +182,7 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp)
mAtlasInfop = NULL ;
mUsingAtlas = FALSE ;
+ mHasMedia = FALSE ;
}
@@ -1348,11 +1349,12 @@ const F32 LEAST_IMPORTANCE_FOR_LARGE_IMAGE = 0.3f ;
F32 LLFace::getTextureVirtualSize()
{
F32 radius;
- F32 cos_angle_to_view_dir;
- mPixelArea = calcPixelArea(cos_angle_to_view_dir, radius);
+ F32 cos_angle_to_view_dir;
+ BOOL in_frustum = calcPixelArea(cos_angle_to_view_dir, radius);
- if (mPixelArea < 0.0001f)
+ if (mPixelArea < 0.0001f || !in_frustum)
{
+ setVirtualSize(0.f) ;
return 0.f;
}
@@ -1389,30 +1391,36 @@ F32 LLFace::getTextureVirtualSize()
}
}
+ setVirtualSize(face_area) ;
+
return face_area;
}
-F32 LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius)
+BOOL LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius)
{
//get area of circle around face
LLVector3 center = getPositionAgent();
LLVector3 size = (mExtents[1] - mExtents[0]) * 0.5f;
LLViewerCamera* camera = LLViewerCamera::getInstance();
- //if has media, check if the face is out of the view frustum.
- BOOL has_media = hasMedia() ;
- if(has_media && !camera->AABBInFrustum(center, size))
- {
- mImportanceToCamera = 0.f ;
- return 0.f ;
- }
-
F32 size_squared = size.lengthSquared() ;
LLVector3 lookAt = center - camera->getOrigin();
- F32 dist = lookAt.normVec() ;
- cos_angle_to_view_dir = lookAt * camera->getXAxis() ;
- if(has_media)
+ F32 dist = lookAt.normVec() ;
+
+ //get area of circle around node
+ F32 app_angle = atanf(fsqrtf(size_squared) / dist);
+ radius = app_angle*LLDrawable::sCurPixelAngle;
+ mPixelArea = radius*radius * 3.14159f;
+ cos_angle_to_view_dir = lookAt * camera->getXAxis() ;
+
+ //if has media, check if the face is out of the view frustum.
+ if(hasMedia())
{
+ if(!camera->AABBInFrustum(center, size))
+ {
+ mImportanceToCamera = 0.f ;
+ return false ;
+ }
if(cos_angle_to_view_dir > camera->getCosHalfFov()) //the center is within the view frustum
{
cos_angle_to_view_dir = 1.0f ;
@@ -1426,11 +1434,6 @@ F32 LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius)
}
}
- //get area of circle around node
- F32 app_angle = atanf(fsqrtf(size_squared) / dist);
- radius = app_angle*LLDrawable::sCurPixelAngle;
- F32 face_area = radius*radius * 3.14159f;
-
if(dist < mBoundingSphereRadius) //camera is very close
{
cos_angle_to_view_dir = 1.0f ;
@@ -1441,7 +1444,7 @@ F32 LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius)
mImportanceToCamera = LLFace::calcImportanceToCamera(cos_angle_to_view_dir, dist) ;
}
- return face_area ;
+ return true ;
}
//the projection of the face partially overlaps with the screen
diff --git a/indra/newview/llface.h b/indra/newview/llface.h
index bf658dc00c..67dd97e6f7 100644
--- a/indra/newview/llface.h
+++ b/indra/newview/llface.h
@@ -211,7 +211,7 @@ public:
private:
F32 adjustPartialOverlapPixelArea(F32 cos_angle_to_view_dir, F32 radius );
- F32 calcPixelArea(F32& cos_angle_to_view_dir, F32& radius) ;
+ BOOL calcPixelArea(F32& cos_angle_to_view_dir, F32& radius) ;
public:
static F32 calcImportanceToCamera(F32 to_view_dir, F32 dist);
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 4a61130785..6dcf4bc798 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -982,7 +982,12 @@ bool LLTextureFetchWorker::doWork(S32 param)
}
if (mLoadedDiscard < 0)
{
- llerrs << "Decode entered with invalid mLoadedDiscard. ID = " << mID << llendl;
+ //llerrs << "Decode entered with invalid mLoadedDiscard. ID = " << mID << llendl;
+
+ //abort, don't decode
+ mState = DONE;
+ setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority);
+ return true;
}
setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority); // Set priority first since Responder may change it
mRawImage = NULL;
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 984f003411..b66f58d853 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -1519,12 +1519,12 @@ F32 LLViewerFetchedTexture::calcDecodePriority()
}
else if (!isJustBound() && mCachedRawImageReady)
{
- if(mBoostLevel < BOOST_HIGH)
- {
- // We haven't rendered this in a while, de-prioritize it
- desired_discard += 2;
- }
- else
+ //if(mBoostLevel < BOOST_HIGH)
+ //{
+ // // We haven't rendered this in a while, de-prioritize it
+ // desired_discard += 2;
+ //}
+ //else
{
// We haven't rendered this in the last half second, and we have a cached raw image, leave the desired discard as-is
desired_discard = cur_discard;
@@ -2342,14 +2342,8 @@ void LLViewerFetchedTexture::setCachedRawImage()
{
--i ;
}
- //if(mForSculpt)
- //{
- // mRawImage->scaleDownWithoutBlending(w >> i, h >> i) ;
- //}
- //else
- {
- mRawImage->scale(w >> i, h >> i) ;
- }
+
+ mRawImage->scale(w >> i, h >> i) ;
}
mCachedRawImage = mRawImage ;
mCachedRawDiscardLevel = mRawDiscardLevel + i ;
@@ -2699,7 +2693,7 @@ void LLViewerLODTexture::processTextureStats()
}
else
{
- if(isLargeImage() && !isJustBound() && mAdditionalDecodePriority < 1.0f)
+ if(isLargeImage() && !isJustBound() && mAdditionalDecodePriority < 0.3f)
{
//if is a big image and not being used recently, nor close to the view point, do not load hi-res data.
mMaxVirtualSize = llmin(mMaxVirtualSize, (F32)LLViewerTexture::sMinLargeImageSize) ;
@@ -2885,12 +2879,11 @@ LLViewerMediaTexture::~LLViewerMediaTexture()
void LLViewerMediaTexture::reinit(BOOL usemipmaps /* = TRUE */)
{
- mGLTexturep = NULL ;
- init(false);
+ llassert(mGLTexturep.notNull()) ;
+
mUseMipMaps = usemipmaps ;
getLastReferencedTimer()->reset() ;
-
- generateGLTexture() ;
+ mGLTexturep->setUseMipMaps(mUseMipMaps) ;
mGLTexturep->setNeedsAlphaAndPickMask(FALSE) ;
}
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index bfe38c14ba..fa00396c34 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -679,6 +679,7 @@ void LLVOVolume::updateTextureVirtualSize()
vsize = area;
imagep->setBoostLevel(LLViewerTexture::BOOST_HUD);
face->setPixelArea(area); // treat as full screen
+ face->setVirtualSize(vsize);
}
else
{
@@ -695,8 +696,7 @@ void LLVOVolume::updateTextureVirtualSize()
gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD, FALSE);
}
}
-
- face->setVirtualSize(vsize);
+
if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA))
{
if (vsize < min_vsize) min_vsize = vsize;