summaryrefslogtreecommitdiff
path: root/indra/newview/llface.cpp
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2010-08-18 11:33:01 -0600
committerXiaohong Bao <bao@lindenlab.com>2010-08-18 11:33:01 -0600
commit247ca1660bf4029d4e5bb701654433f14c785ab5 (patch)
tree1bcc6a234b1c3dd6908c9a1999a3dce19a4da566 /indra/newview/llface.cpp
parent2afe1f3999f85e21f2cdfcb614670b89762dfeef (diff)
EXT-8673: FIXED: UDP texture loading is slower in 2.x viewers than 1.23.5
Improved the following: 1, make sure the texture callback queue is properly handled and cleaned in time; 2, estimate the LLVOTree pixel area more accurately; 3, eliminate the possibility of back and forth stopping/restarting a texture fetching
Diffstat (limited to 'indra/newview/llface.cpp')
-rw-r--r--indra/newview/llface.cpp65
1 files changed, 28 insertions, 37 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index cfe8b4c9a4..db3d90e0a0 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -862,26 +862,6 @@ void LLFace::updateRebuildFlags()
}
}
-
-bool LLFace::canRenderAsMask()
-{
- const LLTextureEntry* te = getTextureEntry();
- return (
- (
- (LLPipeline::sRenderDeferred && LLPipeline::sAutoMaskAlphaDeferred) ||
-
- (!LLPipeline::sRenderDeferred && LLPipeline::sAutoMaskAlphaNonDeferred)
- ) // do we want masks at all?
- &&
- (te->getColor().mV[3] == 1.0f) && // can't treat as mask if we have face alpha
- !(LLPipeline::sRenderDeferred && te->getFullbright()) && // hack: alpha masking renders fullbright faces invisible in deferred rendering mode, need to figure out why - for now, avoid
- (te->getGlow() == 0.f) && // glowing masks are hard to implement - don't mask
-
- getTexture()->getIsAlphaMask() // texture actually qualifies for masking (lazily recalculated but expensive)
- );
-}
-
-
static LLFastTimer::DeclareTimer FTM_FACE_GET_GEOM("Face Geom");
BOOL LLFace::getGeometryVolume(const LLVolume& volume,
@@ -1412,24 +1392,13 @@ F32 LLFace::getTextureVirtualSize()
face_area = mPixelArea / llclamp(texel_area, 0.015625f, 128.f);
}
- if(face_area > LLViewerTexture::sMaxSmallImageSize)
+ face_area = LLFace::adjustPixelArea(mImportanceToCamera, face_area) ;
+ if(face_area > LLViewerTexture::sMinLargeImageSize) //if is large image, shrink face_area by considering the partial overlapping.
{
- if(mImportanceToCamera < LEAST_IMPORTANCE) //if the face is not important, do not load hi-res.
- {
- static const F32 MAX_LEAST_IMPORTANCE_IMAGE_SIZE = 128.0f * 128.0f ;
- face_area = llmin(face_area * 0.5f, MAX_LEAST_IMPORTANCE_IMAGE_SIZE) ;
- }
- else if(face_area > LLViewerTexture::sMinLargeImageSize) //if is large image, shrink face_area by considering the partial overlapping.
- {
- if(mImportanceToCamera < LEAST_IMPORTANCE_FOR_LARGE_IMAGE)//if the face is not important, do not load hi-res.
- {
- face_area = LLViewerTexture::sMinLargeImageSize ;
- }
- else if(mTexture.notNull() && mTexture->isLargeImage())
- {
- face_area *= adjustPartialOverlapPixelArea(cos_angle_to_view_dir, radius );
- }
- }
+ if(mImportanceToCamera > LEAST_IMPORTANCE_FOR_LARGE_IMAGE && mTexture.notNull() && mTexture->isLargeImage())
+ {
+ face_area *= adjustPartialOverlapPixelArea(cos_angle_to_view_dir, radius );
+ }
}
setVirtualSize(face_area) ;
@@ -1556,6 +1525,28 @@ F32 LLFace::calcImportanceToCamera(F32 cos_angle_to_view_dir, F32 dist)
return importance ;
}
+//static
+F32 LLFace::adjustPixelArea(F32 importance, F32 pixel_area)
+{
+ if(pixel_area > LLViewerTexture::sMaxSmallImageSize)
+ {
+ if(importance < LEAST_IMPORTANCE) //if the face is not important, do not load hi-res.
+ {
+ static const F32 MAX_LEAST_IMPORTANCE_IMAGE_SIZE = 128.0f * 128.0f ;
+ pixel_area = llmin(pixel_area * 0.5f, MAX_LEAST_IMPORTANCE_IMAGE_SIZE) ;
+ }
+ else if(pixel_area > LLViewerTexture::sMinLargeImageSize) //if is large image, shrink face_area by considering the partial overlapping.
+ {
+ if(importance < LEAST_IMPORTANCE_FOR_LARGE_IMAGE)//if the face is not important, do not load hi-res.
+ {
+ pixel_area = LLViewerTexture::sMinLargeImageSize ;
+ }
+ }
+ }
+
+ return pixel_area ;
+}
+
BOOL LLFace::verify(const U32* indices_array) const
{
BOOL ok = TRUE;