diff options
Diffstat (limited to 'linden/indra/newview/llfloaterimagepreview.cpp')
-rw-r--r-- | linden/indra/newview/llfloaterimagepreview.cpp | 67 |
1 files changed, 45 insertions, 22 deletions
diff --git a/linden/indra/newview/llfloaterimagepreview.cpp b/linden/indra/newview/llfloaterimagepreview.cpp index 4a8c66e..24b9929 100644 --- a/linden/indra/newview/llfloaterimagepreview.cpp +++ b/linden/indra/newview/llfloaterimagepreview.cpp | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -51,6 +52,7 @@ | |||
51 | #include "llui.h" | 52 | #include "llui.h" |
52 | #include "llviewercamera.h" | 53 | #include "llviewercamera.h" |
53 | #include "llviewerwindow.h" | 54 | #include "llviewerwindow.h" |
55 | #include "llviewerobjectlist.h" | ||
54 | #include "llvoavatar.h" | 56 | #include "llvoavatar.h" |
55 | #include "pipeline.h" | 57 | #include "pipeline.h" |
56 | #include "lluictrlfactory.h" | 58 | #include "lluictrlfactory.h" |
@@ -71,7 +73,9 @@ const S32 PREVIEW_TEXTURE_HEIGHT = 300; | |||
71 | // LLFloaterImagePreview() | 73 | // LLFloaterImagePreview() |
72 | //----------------------------------------------------------------------------- | 74 | //----------------------------------------------------------------------------- |
73 | LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename) : | 75 | LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename) : |
74 | LLFloaterNameDesc(filename) | 76 | LLFloaterNameDesc(filename), |
77 | mAvatarPreview(NULL), | ||
78 | mSculptedPreview(NULL) | ||
75 | { | 79 | { |
76 | mLastMouseX = 0; | 80 | mLastMouseX = 0; |
77 | mLastMouseY = 0; | 81 | mLastMouseY = 0; |
@@ -106,7 +110,7 @@ BOOL LLFloaterImagePreview::postBuild() | |||
106 | 110 | ||
107 | childHide("bad_image_text"); | 111 | childHide("bad_image_text"); |
108 | 112 | ||
109 | if (mRawImagep.notNull()) | 113 | if (mRawImagep.notNull() && gAgent.getRegion() != NULL) |
110 | { | 114 | { |
111 | mAvatarPreview = new LLImagePreviewAvatar(256, 256); | 115 | mAvatarPreview = new LLImagePreviewAvatar(256, 256); |
112 | mAvatarPreview->setPreviewTarget("mPelvis", "mUpperBodyMesh0", mRawImagep, 2.f, FALSE); | 116 | mAvatarPreview->setPreviewTarget("mPelvis", "mUpperBodyMesh0", mRawImagep, 2.f, FALSE); |
@@ -134,6 +138,8 @@ BOOL LLFloaterImagePreview::postBuild() | |||
134 | //----------------------------------------------------------------------------- | 138 | //----------------------------------------------------------------------------- |
135 | LLFloaterImagePreview::~LLFloaterImagePreview() | 139 | LLFloaterImagePreview::~LLFloaterImagePreview() |
136 | { | 140 | { |
141 | clearAllPreviewTextures(); | ||
142 | |||
137 | mRawImagep = NULL; | 143 | mRawImagep = NULL; |
138 | delete mAvatarPreview; | 144 | delete mAvatarPreview; |
139 | delete mSculptedPreview; | 145 | delete mSculptedPreview; |
@@ -201,6 +207,24 @@ void LLFloaterImagePreview::onPreviewTypeCommit(LLUICtrl* ctrl, void* userdata) | |||
201 | fp->mSculptedPreview->refresh(); | 207 | fp->mSculptedPreview->refresh(); |
202 | } | 208 | } |
203 | 209 | ||
210 | |||
211 | //----------------------------------------------------------------------------- | ||
212 | // clearAllPreviewTextures() | ||
213 | //----------------------------------------------------------------------------- | ||
214 | void LLFloaterImagePreview::clearAllPreviewTextures() | ||
215 | { | ||
216 | if (mAvatarPreview) | ||
217 | { | ||
218 | mAvatarPreview->clearPreviewTexture("mHairMesh0"); | ||
219 | mAvatarPreview->clearPreviewTexture("mUpperBodyMesh0"); | ||
220 | mAvatarPreview->clearPreviewTexture("mLowerBodyMesh0"); | ||
221 | mAvatarPreview->clearPreviewTexture("mHeadMesh0"); | ||
222 | mAvatarPreview->clearPreviewTexture("mUpperBodyMesh0"); | ||
223 | mAvatarPreview->clearPreviewTexture("mLowerBodyMesh0"); | ||
224 | mAvatarPreview->clearPreviewTexture("mSkirtMesh0"); | ||
225 | } | ||
226 | } | ||
227 | |||
204 | //----------------------------------------------------------------------------- | 228 | //----------------------------------------------------------------------------- |
205 | // draw() | 229 | // draw() |
206 | //----------------------------------------------------------------------------- | 230 | //----------------------------------------------------------------------------- |
@@ -233,8 +257,7 @@ void LLFloaterImagePreview::draw() | |||
233 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mImagep->getTexName()); | 257 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mImagep->getTexName()); |
234 | stop_glerror(); | 258 | stop_glerror(); |
235 | 259 | ||
236 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 260 | gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); |
237 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | ||
238 | 261 | ||
239 | gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); | 262 | gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); |
240 | if (mAvatarPreview) | 263 | if (mAvatarPreview) |
@@ -592,7 +615,7 @@ LLImagePreviewAvatar::LLImagePreviewAvatar(S32 width, S32 height) : LLDynamicTex | |||
592 | mCameraPitch = 0.f; | 615 | mCameraPitch = 0.f; |
593 | mCameraZoom = 1.f; | 616 | mCameraZoom = 1.f; |
594 | 617 | ||
595 | mDummyAvatar = new LLVOAvatar(LLUUID::null, LL_PCODE_LEGACY_AVATAR, gAgent.getRegion()); | 618 | mDummyAvatar = (LLVOAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion()); |
596 | mDummyAvatar->createDrawable(&gPipeline); | 619 | mDummyAvatar->createDrawable(&gPipeline); |
597 | mDummyAvatar->mIsDummy = TRUE; | 620 | mDummyAvatar->mIsDummy = TRUE; |
598 | mDummyAvatar->mSpecialRenderMode = 2; | 621 | mDummyAvatar->mSpecialRenderMode = 2; |
@@ -646,6 +669,22 @@ void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const | |||
646 | } | 669 | } |
647 | 670 | ||
648 | //----------------------------------------------------------------------------- | 671 | //----------------------------------------------------------------------------- |
672 | // clearPreviewTexture() | ||
673 | //----------------------------------------------------------------------------- | ||
674 | void LLImagePreviewAvatar::clearPreviewTexture(const std::string& mesh_name) | ||
675 | { | ||
676 | if (mDummyAvatar) | ||
677 | { | ||
678 | LLViewerJointMesh *mesh = (LLViewerJointMesh*)mDummyAvatar->mRoot.findJoint(mesh_name); | ||
679 | // clear out existing test mesh | ||
680 | if (mesh) | ||
681 | { | ||
682 | mesh->setTestTexture(0); | ||
683 | } | ||
684 | } | ||
685 | } | ||
686 | |||
687 | //----------------------------------------------------------------------------- | ||
649 | // update() | 688 | // update() |
650 | //----------------------------------------------------------------------------- | 689 | //----------------------------------------------------------------------------- |
651 | BOOL LLImagePreviewAvatar::render() | 690 | BOOL LLImagePreviewAvatar::render() |
@@ -762,27 +801,11 @@ LLImagePreviewSculpted::LLImagePreviewSculpted(S32 width, S32 height) : LLDynami | |||
762 | 801 | ||
763 | F32 const HIGHEST_LOD = 4.0f; | 802 | F32 const HIGHEST_LOD = 4.0f; |
764 | mVolume = new LLVolume(volume_params, HIGHEST_LOD); | 803 | mVolume = new LLVolume(volume_params, HIGHEST_LOD); |
765 | |||
766 | /* | ||
767 | mDummyAvatar = new LLVOAvatar(LLUUID::null, LL_PCODE_LEGACY_AVATAR, gAgent.getRegion()); | ||
768 | mDummyAvatar->createDrawable(&gPipeline); | ||
769 | mDummyAvatar->mIsDummy = TRUE; | ||
770 | mDummyAvatar->mSpecialRenderMode = 2; | ||
771 | mDummyAvatar->setPositionAgent(LLVector3::zero); | ||
772 | mDummyAvatar->slamPosition(); | ||
773 | mDummyAvatar->updateJointLODs(); | ||
774 | mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable); | ||
775 | gPipeline.markVisible(mDummyAvatar->mDrawable, *LLViewerCamera::getInstance()); | ||
776 | mTextureName = 0; | ||
777 | */ | ||
778 | } | 804 | } |
779 | 805 | ||
780 | 806 | ||
781 | LLImagePreviewSculpted::~LLImagePreviewSculpted() | 807 | LLImagePreviewSculpted::~LLImagePreviewSculpted() |
782 | { | 808 | { |
783 | /* | ||
784 | mDummyAvatar->markDead(); | ||
785 | */ | ||
786 | } | 809 | } |
787 | 810 | ||
788 | 811 | ||