summaryrefslogtreecommitdiff
path: root/indra/newview/llface.cpp
diff options
context:
space:
mode:
authorVadim Savchuk <vsavchuk@productengine.com>2010-08-19 16:23:42 +0300
committerVadim Savchuk <vsavchuk@productengine.com>2010-08-19 16:23:42 +0300
commit4e62d8cc9cf7ea391ab08c6fa6eecb375eb249b0 (patch)
tree205da4dc5c4c4b10fe6d7f6c80d77641e06df193 /indra/newview/llface.cpp
parentac9f9d82a08840aac569f853e0d4b24d0e4ad103 (diff)
parent116382fdf78ca578a74c30a162208033fd021124 (diff)
Merge from default branch. Fixed gcc build.
--HG-- branch : product-engine
Diffstat (limited to 'indra/newview/llface.cpp')
-rw-r--r--indra/newview/llface.cpp45
1 files changed, 28 insertions, 17 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index f299518474..db3d90e0a0 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -1392,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) ;
@@ -1536,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;