aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerimage.cpp
diff options
context:
space:
mode:
authorthickbrick2011-01-21 15:10:56 +0200
committerthickbrick2011-01-21 15:10:56 +0200
commit4e577785ba1417cd9ef6742a33e818016697b508 (patch)
tree6bb36698e584168bd1f84ac4fb93ac6ef1b32270 /linden/indra/newview/llviewerimage.cpp
parentFix #757: Missing Raycasting tool from Advanced menu (diff)
downloadmeta-impy-4e577785ba1417cd9ef6742a33e818016697b508.zip
meta-impy-4e577785ba1417cd9ef6742a33e818016697b508.tar.gz
meta-impy-4e577785ba1417cd9ef6742a33e818016697b508.tar.bz2
meta-impy-4e577785ba1417cd9ef6742a33e818016697b508.tar.xz
Partial fix #772: Large sculpt maps are deformed
This is a partial fix for cases where the sculpt map is larger than 128x128, like in some old sculpted trees. This was done by content creators to beat bugs in old viewers. The sculpties still need a lod change to trigger a rebuild once they are fully decoded, and that doesn't always happen, because we abuse RenderVolumeLODFactor. Ported from Snowglobe2 (GPL)
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewerimage.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/linden/indra/newview/llviewerimage.cpp b/linden/indra/newview/llviewerimage.cpp
index 671a359..a600dc5 100644
--- a/linden/indra/newview/llviewerimage.cpp
+++ b/linden/indra/newview/llviewerimage.cpp
@@ -1759,13 +1759,19 @@ void LLViewerImage::setCachedRawImage()
1759 if(mForSculpt) 1759 if(mForSculpt)
1760 { 1760 {
1761 max_size = MAX_CACHED_RAW_SCULPT_IMAGE_AREA ; 1761 max_size = MAX_CACHED_RAW_SCULPT_IMAGE_AREA ;
1762 // Even though we don't use the full pixel size, we want to decode up to discard 0,
1763 // because some legacy sculpts are weird like that.
1764 mCachedRawImageReady = !mRawDiscardLevel ;
1765 }
1766 else
1767 {
1768 mCachedRawImageReady = (!mRawDiscardLevel || ((w * h) >= max_size)) ;
1762 } 1769 }
1763 1770
1764 while(((w >> i) * (h >> i)) > max_size) 1771 while(((w >> i) * (h >> i)) > max_size)
1765 { 1772 {
1766 ++i ; 1773 ++i ;
1767 } 1774 }
1768 mCachedRawImageReady = (!mRawDiscardLevel || ((w * h) >= max_size)) ;
1769 1775
1770 if(i) 1776 if(i)
1771 { 1777 {
@@ -1776,7 +1782,8 @@ void LLViewerImage::setCachedRawImage()
1776 mRawImage->scale(w >> i, h >> i) ; 1782 mRawImage->scale(w >> i, h >> i) ;
1777 } 1783 }
1778 mCachedRawImage = mRawImage ; 1784 mCachedRawImage = mRawImage ;
1779 mCachedRawDiscardLevel = mRawDiscardLevel + i ; 1785 mRawDiscardLevel += i ;
1786 mCachedRawDiscardLevel = mRawDiscardLevel ;
1780 } 1787 }
1781} 1788}
1782 1789
@@ -1784,7 +1791,7 @@ void LLViewerImage::checkCachedRawSculptImage()
1784{ 1791{
1785 if(mCachedRawImageReady && mCachedRawDiscardLevel > 0) 1792 if(mCachedRawImageReady && mCachedRawDiscardLevel > 0)
1786 { 1793 {
1787 if(mCachedRawImage->getWidth() * mCachedRawImage->getHeight() < MAX_CACHED_RAW_SCULPT_IMAGE_AREA) 1794 if(getDiscardLevel() != 0)
1788 { 1795 {
1789 mCachedRawImageReady = FALSE ; 1796 mCachedRawImageReady = FALSE ;
1790 } 1797 }