aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorthickbrick2011-01-21 15:10:56 +0200
committerthickbrick2011-01-21 15:10:56 +0200
commit4e577785ba1417cd9ef6742a33e818016697b508 (patch)
tree6bb36698e584168bd1f84ac4fb93ac6ef1b32270
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
-rw-r--r--linden/indra/newview/llvovolume.cpp6
2 files changed, 13 insertions, 6 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 }
diff --git a/linden/indra/newview/llvovolume.cpp b/linden/indra/newview/llvovolume.cpp
index 73ff860..632bca2 100644
--- a/linden/indra/newview/llvovolume.cpp
+++ b/linden/indra/newview/llvovolume.cpp
@@ -527,8 +527,8 @@ void LLVOVolume::updateTextureVirtualSize()
527 } 527 }
528 } 528 }
529 529
530 S32 texture_discard = mSculptTexture->getCachedRawImageLevel(); //try to match the texture 530 S32 texture_discard = mSculptTexture->getDiscardLevel(); //try to match the texture
531 S32 current_discard = mSculptLevel; 531 S32 current_discard = getVolume() ? getVolume()->getSculptLevel() : -2 ;
532 532
533 if (texture_discard >= 0 && //texture has some data available 533 if (texture_discard >= 0 && //texture has some data available
534 (texture_discard < current_discard || //texture has more data than last rebuild 534 (texture_discard < current_discard || //texture has more data than last rebuild
@@ -711,7 +711,7 @@ void LLVOVolume::sculpt()
711 S8 sculpt_components = 0; 711 S8 sculpt_components = 0;
712 const U8* sculpt_data = NULL; 712 const U8* sculpt_data = NULL;
713 713
714 S32 discard_level = mSculptTexture->getCachedRawImageLevel() ; 714 S32 discard_level = mSculptTexture->getDiscardLevel();
715 LLImageRaw* raw_image = mSculptTexture->getCachedRawImage() ; 715 LLImageRaw* raw_image = mSculptTexture->getCachedRawImage() ;
716 716
717 S32 max_discard = mSculptTexture->getMaxDiscardLevel(); 717 S32 max_discard = mSculptTexture->getMaxDiscardLevel();