aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llvovolume.cpp
diff options
context:
space:
mode:
authorMcCabe Maxsted2011-03-04 17:34:19 -0700
committerMcCabe Maxsted2011-03-04 17:34:19 -0700
commitbf2203ac04a0b9cff32b29a633fcc18eebb988ec (patch)
tree73e65c3f06a06991c5cd3e09a6639c8053260d1a /linden/indra/newview/llvovolume.cpp
parentFix #778: Textures get stuck half fetched. (diff)
parentWorkaround #726: SIGSEGV in memcpy in LLImageRaw::LLImageRaw with data=0 (diff)
downloadmeta-impy-bf2203ac04a0b9cff32b29a633fcc18eebb988ec.zip
meta-impy-bf2203ac04a0b9cff32b29a633fcc18eebb988ec.tar.gz
meta-impy-bf2203ac04a0b9cff32b29a633fcc18eebb988ec.tar.bz2
meta-impy-bf2203ac04a0b9cff32b29a633fcc18eebb988ec.tar.xz
Merge remote branch 'thickbrick/weekly' into weekly
Diffstat (limited to 'linden/indra/newview/llvovolume.cpp')
-rw-r--r--linden/indra/newview/llvovolume.cpp62
1 files changed, 49 insertions, 13 deletions
diff --git a/linden/indra/newview/llvovolume.cpp b/linden/indra/newview/llvovolume.cpp
index 73ff860..204d641 100644
--- a/linden/indra/newview/llvovolume.cpp
+++ b/linden/indra/newview/llvovolume.cpp
@@ -89,12 +89,12 @@ LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *re
89 mRelativeXformInvTrans.setIdentity(); 89 mRelativeXformInvTrans.setIdentity();
90 90
91 mLOD = MIN_LOD; 91 mLOD = MIN_LOD;
92 mSculptLevel = -2;
93 mTextureAnimp = NULL; 92 mTextureAnimp = NULL;
94 mVObjRadius = LLVector3(1,1,0.5f).length(); 93 mVObjRadius = LLVector3(1,1,0.5f).length();
95 mNumFaces = 0; 94 mNumFaces = 0;
96 mLODChanged = FALSE; 95 mLODChanged = FALSE;
97 mSculptChanged = FALSE; 96 mSculptChanged = FALSE;
97 mIndexInTex = 0;
98} 98}
99 99
100LLVOVolume::~LLVOVolume() 100LLVOVolume::~LLVOVolume()
@@ -502,9 +502,8 @@ void LLVOVolume::updateTextureVirtualSize()
502 502
503 if (isSculpted()) 503 if (isSculpted())
504 { 504 {
505 LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); 505 updateSculptTexture();
506 LLUUID id = sculpt_params->getSculptTexture(); 506
507 mSculptTexture = gImageList.getImage(id);
508 if (mSculptTexture.notNull()) 507 if (mSculptTexture.notNull())
509 { 508 {
510 mSculptTexture->setBoostLevel(llmax((S32)mSculptTexture->getBoostLevel(), 509 mSculptTexture->setBoostLevel(llmax((S32)mSculptTexture->getBoostLevel(),
@@ -527,8 +526,8 @@ void LLVOVolume::updateTextureVirtualSize()
527 } 526 }
528 } 527 }
529 528
530 S32 texture_discard = mSculptTexture->getCachedRawImageLevel(); //try to match the texture 529 S32 texture_discard = mSculptTexture->getDiscardLevel(); //try to match the texture
531 S32 current_discard = mSculptLevel; 530 S32 current_discard = getVolume() ? getVolume()->getSculptLevel() : -2 ;
532 531
533 if (texture_discard >= 0 && //texture has some data available 532 if (texture_discard >= 0 && //texture has some data available
534 (texture_discard < current_discard || //texture has more data than last rebuild 533 (texture_discard < current_discard || //texture has more data than last rebuild
@@ -682,25 +681,52 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams &volume_params, const S32 detail
682 mVolumeImpl->onSetVolume(volume_params, detail); 681 mVolumeImpl->onSetVolume(volume_params, detail);
683 } 682 }
684 683
684 updateSculptTexture();
685
685 if (isSculpted()) 686 if (isSculpted())
686 { 687 {
687 mSculptTexture = gImageList.getImage(volume_params.getSculptID());
688 if (mSculptTexture.notNull()) 688 if (mSculptTexture.notNull())
689 { 689 {
690 sculpt(); 690 sculpt();
691 mSculptLevel = getVolume()->getSculptLevel();
692 } 691 }
693 } 692 }
694 else
695 {
696 mSculptTexture = NULL;
697 }
698 693
699 return TRUE; 694 return TRUE;
700 } 695 }
701 return FALSE; 696 return FALSE;
702} 697}
703 698
699void LLVOVolume::updateSculptTexture()
700{
701 LLPointer<LLViewerImage> old_sculpt = mSculptTexture;
702
703 if (isSculpted())
704 {
705 LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT);
706 LLUUID id = sculpt_params->getSculptTexture();
707 if (id.notNull())
708 {
709 mSculptTexture = gImageList.getImage(id);
710 }
711 }
712 else
713 {
714 mSculptTexture = NULL;
715 }
716
717 if (mSculptTexture != old_sculpt)
718 {
719 if (old_sculpt.notNull())
720 {
721 old_sculpt->removeVolume(this);
722 }
723 if (mSculptTexture.notNull())
724 {
725 mSculptTexture->addVolume(this);
726 }
727 }
728}
729
704// sculpt replaces generate() for sculpted surfaces 730// sculpt replaces generate() for sculpted surfaces
705void LLVOVolume::sculpt() 731void LLVOVolume::sculpt()
706{ 732{
@@ -711,7 +737,7 @@ void LLVOVolume::sculpt()
711 S8 sculpt_components = 0; 737 S8 sculpt_components = 0;
712 const U8* sculpt_data = NULL; 738 const U8* sculpt_data = NULL;
713 739
714 S32 discard_level = mSculptTexture->getCachedRawImageLevel() ; 740 S32 discard_level = mSculptTexture->getDiscardLevel();
715 LLImageRaw* raw_image = mSculptTexture->getCachedRawImage() ; 741 LLImageRaw* raw_image = mSculptTexture->getCachedRawImage() ;
716 742
717 S32 max_discard = mSculptTexture->getMaxDiscardLevel(); 743 S32 max_discard = mSculptTexture->getMaxDiscardLevel();
@@ -754,6 +780,16 @@ void LLVOVolume::sculpt()
754 sculpt_data = raw_image->getData(); 780 sculpt_data = raw_image->getData();
755 } 781 }
756 getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level); 782 getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level);
783
784 //notify rebuild any other VOVolumes that reference this sculpty volume
785 for (S32 i = 0; i < mSculptTexture->getNumVolumes(); ++i)
786 {
787 LLVOVolume* volume = (*(mSculptTexture->getVolumeList()))[i];
788 if (volume != this && volume->getVolume() == getVolume())
789 {
790 gPipeline.markRebuild(volume->mDrawable, LLDrawable::REBUILD_GEOMETRY, FALSE);
791 }
792 }
757 } 793 }
758} 794}
759 795