diff options
author | Jacek Antonelli | 2011-05-22 01:24:38 -0500 |
---|---|---|
committer | Jacek Antonelli | 2011-05-22 01:24:38 -0500 |
commit | 6dd81fb0349f284b96ca0fa358263def3fb883f4 (patch) | |
tree | d2574e83851c22c0092fdfee52ac31ae598bb038 /linden/indra/newview | |
parent | Merge branch '1.3-maint' into next (diff) | |
parent | Refix #772: Rebuild all volumes that use a sculpt image when that image has m... (diff) | |
download | meta-impy-6dd81fb0349f284b96ca0fa358263def3fb883f4.zip meta-impy-6dd81fb0349f284b96ca0fa358263def3fb883f4.tar.gz meta-impy-6dd81fb0349f284b96ca0fa358263def3fb883f4.tar.bz2 meta-impy-6dd81fb0349f284b96ca0fa358263def3fb883f4.tar.xz |
Merge remote-tracking branch 'thickbrick/remerge_772' into next
Diffstat (limited to 'linden/indra/newview')
-rw-r--r-- | linden/indra/newview/llface.cpp | 1 | ||||
-rw-r--r-- | linden/indra/newview/llface.h | 2 | ||||
-rw-r--r-- | linden/indra/newview/llvovolume.cpp | 54 | ||||
-rw-r--r-- | linden/indra/newview/llvovolume.h | 4 |
4 files changed, 45 insertions, 16 deletions
diff --git a/linden/indra/newview/llface.cpp b/linden/indra/newview/llface.cpp index aa8cd15..cf681fa 100644 --- a/linden/indra/newview/llface.cpp +++ b/linden/indra/newview/llface.cpp | |||
@@ -159,6 +159,7 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp) | |||
159 | mIndicesIndex = 0; | 159 | mIndicesIndex = 0; |
160 | mTexture = NULL; | 160 | mTexture = NULL; |
161 | mTEOffset = -1; | 161 | mTEOffset = -1; |
162 | mIndexInTex = 0; | ||
162 | 163 | ||
163 | setDrawable(drawablep); | 164 | setDrawable(drawablep); |
164 | mVObjp = objp; | 165 | mVObjp = objp; |
diff --git a/linden/indra/newview/llface.h b/linden/indra/newview/llface.h index e31b93f..f870370 100644 --- a/linden/indra/newview/llface.h +++ b/linden/indra/newview/llface.h | |||
@@ -228,7 +228,7 @@ private: | |||
228 | U16 mGeomIndex; // index into draw pool | 228 | U16 mGeomIndex; // index into draw pool |
229 | U32 mIndicesCount; | 229 | U32 mIndicesCount; |
230 | U32 mIndicesIndex; // index into draw pool for indices (yeah, I know!) | 230 | U32 mIndicesIndex; // index into draw pool for indices (yeah, I know!) |
231 | S32 mIndexInTex ; | 231 | S32 mIndexInTex ; // index of this face in the texture's face list |
232 | 232 | ||
233 | //previous rebuild's geometry info | 233 | //previous rebuild's geometry info |
234 | U16 mLastGeomCount; | 234 | U16 mLastGeomCount; |
diff --git a/linden/indra/newview/llvovolume.cpp b/linden/indra/newview/llvovolume.cpp index 4a53d4e..8d5bfb4 100644 --- a/linden/indra/newview/llvovolume.cpp +++ b/linden/indra/newview/llvovolume.cpp | |||
@@ -93,7 +93,6 @@ LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *re | |||
93 | mRelativeXformInvTrans.setIdentity(); | 93 | mRelativeXformInvTrans.setIdentity(); |
94 | 94 | ||
95 | mLOD = MIN_LOD; | 95 | mLOD = MIN_LOD; |
96 | mSculptLevel = -2; | ||
97 | mTextureAnimp = NULL; | 96 | mTextureAnimp = NULL; |
98 | mVObjRadius = LLVector3(1,1,0.5f).length(); | 97 | mVObjRadius = LLVector3(1,1,0.5f).length(); |
99 | mNumFaces = 0; | 98 | mNumFaces = 0; |
@@ -507,9 +506,8 @@ void LLVOVolume::updateTextureVirtualSize() | |||
507 | 506 | ||
508 | if (isSculpted()) | 507 | if (isSculpted()) |
509 | { | 508 | { |
510 | LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); | 509 | updateSculptTexture(); |
511 | LLUUID id = sculpt_params->getSculptTexture(); | 510 | |
512 | mSculptTexture = gImageList.getImage(id); | ||
513 | if (mSculptTexture.notNull()) | 511 | if (mSculptTexture.notNull()) |
514 | { | 512 | { |
515 | mSculptTexture->setBoostLevel(llmax((S32)mSculptTexture->getBoostLevel(), | 513 | mSculptTexture->setBoostLevel(llmax((S32)mSculptTexture->getBoostLevel(), |
@@ -532,14 +530,14 @@ void LLVOVolume::updateTextureVirtualSize() | |||
532 | } | 530 | } |
533 | } | 531 | } |
534 | 532 | ||
535 | S32 texture_discard = mSculptTexture->getCachedRawImageLevel(); //try to match the texture | 533 | S32 texture_discard = mSculptTexture->getDiscardLevel(); //try to match the texture |
536 | S32 current_discard = mSculptLevel; | 534 | S32 current_discard = getVolume() ? getVolume()->getSculptLevel() : -2; |
537 | 535 | ||
538 | if (texture_discard >= 0 && //texture has some data available | 536 | if (texture_discard >= 0 && //texture has some data available |
539 | (texture_discard < current_discard || //texture has more data than last rebuild | 537 | (texture_discard < current_discard || //texture has more data than last rebuild |
540 | current_discard < 0)) //no previous rebuild | 538 | current_discard < 0)) //no previous rebuild |
541 | { | 539 | { |
542 | markForUpdate(FALSE); | 540 | gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, FALSE); |
543 | mSculptChanged = TRUE; | 541 | mSculptChanged = TRUE; |
544 | } | 542 | } |
545 | 543 | ||
@@ -687,19 +685,17 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams &volume_params, const S32 detail | |||
687 | mVolumeImpl->onSetVolume(volume_params, detail); | 685 | mVolumeImpl->onSetVolume(volume_params, detail); |
688 | } | 686 | } |
689 | 687 | ||
688 | updateSculptTexture(); | ||
690 | if (isSculpted()) | 689 | if (isSculpted()) |
691 | { | 690 | { |
692 | mSculptTexture = gImageList.getImage(volume_params.getSculptID()); | ||
693 | if (mSculptTexture.notNull()) | 691 | if (mSculptTexture.notNull()) |
694 | { | 692 | { |
695 | sculpt(); | 693 | sculpt(); |
696 | mSculptLevel = getVolume()->getSculptLevel(); | ||
697 | mSculptSurfaceArea = getVolume()->sculptGetSurfaceArea(); | 694 | mSculptSurfaceArea = getVolume()->sculptGetSurfaceArea(); |
698 | } | 695 | } |
699 | } | 696 | } |
700 | else | 697 | else |
701 | { | 698 | { |
702 | mSculptTexture = NULL; | ||
703 | mSculptSurfaceArea = 0.0; | 699 | mSculptSurfaceArea = 0.0; |
704 | } | 700 | } |
705 | 701 | ||
@@ -708,6 +704,38 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams &volume_params, const S32 detail | |||
708 | return FALSE; | 704 | return FALSE; |
709 | } | 705 | } |
710 | 706 | ||
707 | |||
708 | void LLVOVolume::updateSculptTexture() | ||
709 | { | ||
710 | LLPointer<LLViewerImage> old_sculpt = mSculptTexture; | ||
711 | if (isSculpted()) | ||
712 | { | ||
713 | LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); | ||
714 | LLUUID id = sculpt_params->getSculptTexture(); | ||
715 | if (id.notNull()) | ||
716 | { | ||
717 | mSculptTexture = gImageList.getImage(id); | ||
718 | } | ||
719 | } | ||
720 | else | ||
721 | { | ||
722 | mSculptTexture = NULL; | ||
723 | } | ||
724 | |||
725 | if (mSculptTexture != old_sculpt) | ||
726 | { | ||
727 | if (old_sculpt.notNull()) | ||
728 | { | ||
729 | old_sculpt->removeVolume(this); | ||
730 | } | ||
731 | if (mSculptTexture.notNull()) | ||
732 | { | ||
733 | mSculptTexture->addVolume(this); | ||
734 | } | ||
735 | } | ||
736 | } | ||
737 | |||
738 | |||
711 | // sculpt replaces generate() for sculpted surfaces | 739 | // sculpt replaces generate() for sculpted surfaces |
712 | void LLVOVolume::sculpt() | 740 | void LLVOVolume::sculpt() |
713 | { | 741 | { |
@@ -718,7 +746,7 @@ void LLVOVolume::sculpt() | |||
718 | S8 sculpt_components = 0; | 746 | S8 sculpt_components = 0; |
719 | const U8* sculpt_data = NULL; | 747 | const U8* sculpt_data = NULL; |
720 | 748 | ||
721 | S32 discard_level = mSculptTexture->getCachedRawImageLevel() ; | 749 | S32 discard_level = mSculptTexture->getDiscardLevel() ; |
722 | LLImageRaw* raw_image = mSculptTexture->getCachedRawImage() ; | 750 | LLImageRaw* raw_image = mSculptTexture->getCachedRawImage() ; |
723 | 751 | ||
724 | S32 max_discard = mSculptTexture->getMaxDiscardLevel(); | 752 | S32 max_discard = mSculptTexture->getMaxDiscardLevel(); |
@@ -762,7 +790,7 @@ void LLVOVolume::sculpt() | |||
762 | } | 790 | } |
763 | getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level); | 791 | getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level); |
764 | 792 | ||
765 | /*//notify rebuild any other VOVolumes that reference this sculpty volume | 793 | //notify rebuild any other VOVolumes that reference this sculpty volume |
766 | for (S32 i = 0; i < mSculptTexture->getNumVolumes(); ++i) | 794 | for (S32 i = 0; i < mSculptTexture->getNumVolumes(); ++i) |
767 | { | 795 | { |
768 | LLVOVolume* volume = (*(mSculptTexture->getVolumeList()))[i]; | 796 | LLVOVolume* volume = (*(mSculptTexture->getVolumeList()))[i]; |
@@ -770,7 +798,7 @@ void LLVOVolume::sculpt() | |||
770 | { | 798 | { |
771 | gPipeline.markRebuild(volume->mDrawable, LLDrawable::REBUILD_GEOMETRY, FALSE); | 799 | gPipeline.markRebuild(volume->mDrawable, LLDrawable::REBUILD_GEOMETRY, FALSE); |
772 | } | 800 | } |
773 | }*/ | 801 | } |
774 | } | 802 | } |
775 | } | 803 | } |
776 | 804 | ||
diff --git a/linden/indra/newview/llvovolume.h b/linden/indra/newview/llvovolume.h index 7fba28c..2da1d7a 100644 --- a/linden/indra/newview/llvovolume.h +++ b/linden/indra/newview/llvovolume.h | |||
@@ -171,6 +171,7 @@ public: | |||
171 | void setTexture(const S32 face); | 171 | void setTexture(const S32 face); |
172 | S32 getIndexInTex() const {return mIndexInTex ;} | 172 | S32 getIndexInTex() const {return mIndexInTex ;} |
173 | /*virtual*/ BOOL setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false); | 173 | /*virtual*/ BOOL setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false); |
174 | void updateSculptTexture(); | ||
174 | void setIndexInTex(S32 index) { mIndexInTex = index ;} | 175 | void setIndexInTex(S32 index) { mIndexInTex = index ;} |
175 | void sculpt(); | 176 | void sculpt(); |
176 | void updateRelativeXform(); | 177 | void updateRelativeXform(); |
@@ -232,7 +233,6 @@ private: | |||
232 | LLFrameTimer mTextureUpdateTimer; | 233 | LLFrameTimer mTextureUpdateTimer; |
233 | S32 mLOD; | 234 | S32 mLOD; |
234 | BOOL mLODChanged; | 235 | BOOL mLODChanged; |
235 | S32 mSculptLevel; | ||
236 | BOOL mSculptChanged; | 236 | BOOL mSculptChanged; |
237 | LLMatrix4 mRelativeXform; | 237 | LLMatrix4 mRelativeXform; |
238 | LLMatrix3 mRelativeXformInvTrans; | 238 | LLMatrix3 mRelativeXformInvTrans; |
@@ -240,7 +240,7 @@ private: | |||
240 | F32 mVObjRadius; | 240 | F32 mVObjRadius; |
241 | LLVolumeInterface *mVolumeImpl; | 241 | LLVolumeInterface *mVolumeImpl; |
242 | LLPointer<LLViewerImage> mSculptTexture; | 242 | LLPointer<LLViewerImage> mSculptTexture; |
243 | S32 mIndexInTex; | 243 | S32 mIndexInTex; // index of this volume in the texture's volume list |
244 | 244 | ||
245 | // statics | 245 | // statics |
246 | public: | 246 | public: |