diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-08-20 12:16:46 -0700 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-08-20 12:16:46 -0700 |
commit | bb8919c013b1c219d79e2a71b89c4a842058f7bf (patch) | |
tree | f9a96c1072d101d598240952eabe2d6b62d4cc97 /indra/newview/llface.cpp | |
parent | 45b60984777e26b2cfe3c289fe60b5155eafb847 (diff) | |
parent | 116382fdf78ca578a74c30a162208033fd021124 (diff) |
merge from viewer-release
Diffstat (limited to 'indra/newview/llface.cpp')
-rw-r--r-- | indra/newview/llface.cpp | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index cfe8b4c9a4..bbf0351bde 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1412,24 +1412,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 +1545,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; |