summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/CMakeLists.txt1
-rw-r--r--indra/cmake/CMakeLists.txt2
-rw-r--r--indra/cmake/LLAppearance.cmake7
-rw-r--r--indra/cmake/Viewer.cmake7
-rw-r--r--indra/llappearance/CMakeLists.txt92
-rw-r--r--indra/llappearance/llavatarappearance.cpp173
-rw-r--r--indra/llappearance/llavatarappearance.h119
-rw-r--r--indra/llappearance/llavatarappearancedefines.cpp (renamed from indra/newview/llvoavatardefines.cpp)78
-rw-r--r--indra/llappearance/llavatarappearancedefines.h (renamed from indra/newview/llvoavatardefines.h)32
-rw-r--r--indra/llappearance/llinventoryicon.cpp (renamed from indra/newview/llinventoryicon.cpp)3
-rw-r--r--indra/llappearance/llinventoryicon.h (renamed from indra/newview/llinventoryicon.h)0
-rw-r--r--indra/llappearance/lljointpickname.h46
-rw-r--r--indra/llappearance/lllocaltextureobject.cpp (renamed from indra/newview/lllocaltextureobject.cpp)13
-rw-r--r--indra/llappearance/lllocaltextureobject.h (renamed from indra/newview/lllocaltextureobject.h)12
-rw-r--r--indra/llappearance/lltexglobalcolor.cpp (renamed from indra/newview/lltexglobalcolor.cpp)18
-rw-r--r--indra/llappearance/lltexglobalcolor.h (renamed from indra/newview/lltexglobalcolor.h)12
-rw-r--r--indra/llappearance/lltexlayer.cpp (renamed from indra/newview/lltexlayer.cpp)855
-rw-r--r--indra/llappearance/lltexlayer.h (renamed from indra/newview/lltexlayer.h)159
-rw-r--r--indra/llappearance/lltexlayerparams.cpp (renamed from indra/newview/lltexlayerparams.cpp)60
-rw-r--r--indra/llappearance/lltexlayerparams.h (renamed from indra/newview/lltexlayerparams.h)18
-rw-r--r--indra/llappearance/lltexturemanagerbridge.cpp32
-rw-r--r--indra/llappearance/lltexturemanagerbridge.h45
-rw-r--r--indra/llappearance/llviewervisualparam.cpp (renamed from indra/newview/llviewervisualparam.cpp)3
-rw-r--r--indra/llappearance/llviewervisualparam.h (renamed from indra/newview/llviewervisualparam.h)0
-rw-r--r--indra/llappearance/llwearable.cpp474
-rw-r--r--indra/llappearance/llwearable.h (renamed from indra/newview/llwearable.h)83
-rw-r--r--indra/llappearance/llwearabletype.cpp (renamed from indra/newview/llwearabletype.cpp)5
-rw-r--r--indra/llappearance/llwearabletype.h (renamed from indra/newview/llwearabletype.h)0
-rw-r--r--indra/llcharacter/CMakeLists.txt1
-rw-r--r--indra/llrender/llglslshader.h2
-rw-r--r--indra/llrender/lltexture.h46
-rwxr-xr-xindra/newview/CMakeLists.txt25
-rwxr-xr-xindra/newview/llagent.cpp10
-rw-r--r--indra/newview/llagent.h4
-rw-r--r--indra/newview/llagentcamera.cpp2
-rwxr-xr-xindra/newview/llagentwearables.cpp132
-rwxr-xr-xindra/newview/llagentwearables.h55
-rw-r--r--indra/newview/llappearance.h8
-rwxr-xr-xindra/newview/llappearancemgr.cpp28
-rwxr-xr-xindra/newview/llappearancemgr.h1
-rw-r--r--indra/newview/llassetuploadresponders.cpp2
-rwxr-xr-xindra/newview/llavatariconctrl.cpp2
-rw-r--r--indra/newview/lldriverparam.cpp17
-rw-r--r--indra/newview/llfloaterauction.cpp1
-rw-r--r--indra/newview/llfloateravatartextures.cpp15
-rw-r--r--indra/newview/llfloateravatartextures.h4
-rw-r--r--indra/newview/llgroupiconctrl.cpp1
-rwxr-xr-xindra/newview/llinventorybridge.cpp4
-rw-r--r--indra/newview/llinventorybridge.h6
-rw-r--r--indra/newview/lllocalbitmaps.cpp104
-rw-r--r--indra/newview/lllocalbitmaps.h5
-rw-r--r--indra/newview/llpanelclassified.cpp1
-rw-r--r--indra/newview/llpaneleditwearable.cpp30
-rw-r--r--indra/newview/llpaneleditwearable.h22
-rw-r--r--indra/newview/llpostcard.cpp1
-rw-r--r--indra/newview/llsidepanelappearance.cpp10
-rw-r--r--indra/newview/llsidepanelappearance.h8
-rwxr-xr-xindra/newview/lltextureview.cpp10
-rw-r--r--indra/newview/llviewerjoint.h20
-rwxr-xr-xindra/newview/llviewerjointmesh.cpp4
-rwxr-xr-xindra/newview/llviewerjointmesh.h6
-rwxr-xr-xindra/newview/llviewermenu.cpp4
-rw-r--r--indra/newview/llviewershadermgr.h1
-rwxr-xr-xindra/newview/llviewerstats.cpp2
-rw-r--r--indra/newview/llviewertexlayer.cpp815
-rw-r--r--indra/newview/llviewertexlayer.h172
-rw-r--r--indra/newview/llviewertexture.cpp25
-rwxr-xr-xindra/newview/llviewertexture.h48
-rw-r--r--indra/newview/llviewerwearable.cpp (renamed from indra/newview/llwearable.cpp)585
-rw-r--r--indra/newview/llviewerwearable.h118
-rwxr-xr-xindra/newview/llvoavatar.cpp270
-rwxr-xr-xindra/newview/llvoavatar.h94
-rwxr-xr-xindra/newview/llvoavatarself.cpp195
-rwxr-xr-xindra/newview/llvoavatarself.h66
-rw-r--r--indra/newview/llwearablelist.cpp24
-rw-r--r--indra/newview/llwearablelist.h12
76 files changed, 3057 insertions, 2310 deletions
diff --git a/indra/CMakeLists.txt b/indra/CMakeLists.txt
index 1cebb53a07..078b17bf53 100644
--- a/indra/CMakeLists.txt
+++ b/indra/CMakeLists.txt
@@ -41,6 +41,7 @@ endif ("${CMAKE_SOURCE_DIR}/../autobuild.xml" IS_NEWER_THAN "${CMAKE_BINARY_DIR}
add_subdirectory(cmake)
add_subdirectory(${LIBS_OPEN_PREFIX}llaudio)
+add_subdirectory(${LIBS_OPEN_PREFIX}llappearance)
add_subdirectory(${LIBS_OPEN_PREFIX}llcharacter)
add_subdirectory(${LIBS_OPEN_PREFIX}llcommon)
add_subdirectory(${LIBS_OPEN_PREFIX}llimage)
diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt
index 569034a6fb..875b5be152 100644
--- a/indra/cmake/CMakeLists.txt
+++ b/indra/cmake/CMakeLists.txt
@@ -40,6 +40,7 @@ set(cmake_SOURCE_FILES
Hunspell.cmake
JPEG.cmake
LLAddBuildTest.cmake
+ LLAppearance.cmake
LLAudio.cmake
LLCharacter.cmake
LLCommon.cmake
@@ -77,6 +78,7 @@ set(cmake_SOURCE_FILES
Tut.cmake
UI.cmake
UnixInstall.cmake
+ Viewer.cmake
Variables.cmake
XmlRpcEpi.cmake
ZLIB.cmake
diff --git a/indra/cmake/LLAppearance.cmake b/indra/cmake/LLAppearance.cmake
new file mode 100644
index 0000000000..36cebe9816
--- /dev/null
+++ b/indra/cmake/LLAppearance.cmake
@@ -0,0 +1,7 @@
+# -*- cmake -*-
+
+set(LLAPPEARANCE_INCLUDE_DIRS
+ ${LIBS_OPEN_DIR}/llappearance
+ )
+
+set(LLAPPEARANCE_LIBRARIES llappearance)
diff --git a/indra/cmake/Viewer.cmake b/indra/cmake/Viewer.cmake
new file mode 100644
index 0000000000..771bb0ed7a
--- /dev/null
+++ b/indra/cmake/Viewer.cmake
@@ -0,0 +1,7 @@
+# -*- cmake -*-
+
+set(VIEWER_INCLUDE_DIRS
+ ${LIBS_OPEN_DIR}/newview
+ )
+
+set(VIEWER_LIBRARIES viewer)
diff --git a/indra/llappearance/CMakeLists.txt b/indra/llappearance/CMakeLists.txt
new file mode 100644
index 0000000000..f77c7e6440
--- /dev/null
+++ b/indra/llappearance/CMakeLists.txt
@@ -0,0 +1,92 @@
+# -*- cmake -*-
+
+project(llappearance)
+
+include(00-Common)
+include(LLCommon)
+include(Viewer)
+include(LLAudio)
+include(LLCharacter)
+include(LLCommon)
+include(LLImage)
+include(LLImageJ2COJ)
+include(LLInventory)
+include(LLMath)
+include(LLMessage)
+include(LLPhysicsExtensions)
+include(LLPlugin)
+include(LLPrimitive)
+include(LLRender)
+include(LLUI)
+include(LLVFS)
+include(LLWindow)
+include(LLXML)
+include(Linking)
+include(LLKDU)
+include(ViewerMiscLibs)
+include(LLLogin)
+
+include_directories(
+ ${LLCOMMON_INCLUDE_DIRS}
+ ${LLCHARACTER_INCLUDE_DIRS}
+ ${LLPHYSICS_INCLUDE_DIRS}
+ ${LLIMAGE_INCLUDE_DIRS}
+ ${LLKDU_INCLUDE_DIRS}
+ ${LLINVENTORY_INCLUDE_DIRS}
+ ${LLMATH_INCLUDE_DIRS}
+ ${LLRENDER_INCLUDE_DIRS}
+ ${LLUI_INCLUDE_DIRS}
+ ${LLVFS_INCLUDE_DIRS}
+ ${LLWINDOW_INCLUDE_DIRS}
+ ${LLXML_INCLUDE_DIRS}
+ )
+
+set(llappearance_SOURCE_FILES
+ llavatarappearance.cpp
+ llinventoryicon.cpp
+ lllocaltextureobject.cpp
+ lltexglobalcolor.cpp
+ lltexlayer.cpp
+ lltexlayerparams.cpp
+ lltexturemanagerbridge.cpp
+ llwearable.cpp
+ llwearabletype.cpp
+ llviewervisualparam.cpp
+ llavatarappearancedefines.cpp
+ )
+
+set(llappearance_HEADER_FILES
+ CMakeLists.txt
+
+ llavatarappearance.h
+ llinventoryicon.h
+ lljointpickname.h
+ lllocaltextureobject.h
+ lltexglobalcolor.h
+ lltexlayer.h
+ lltexlayerparams.h
+ lltexturemanagerbridge.h
+ llwearable.h
+ llwearabletype.h
+ llviewervisualparam.h
+ llavatarappearancedefines.h
+ )
+
+set_source_files_properties(${llappearance_HEADER_FILES}
+ PROPERTIES HEADER_FILE_ONLY TRUE)
+
+list(APPEND llappearance_SOURCE_FILES ${llappearance_HEADER_FILES})
+
+add_library (llappearance ${llappearance_SOURCE_FILES})
+
+#add unit tests
+#if (LL_TESTS)
+# INCLUDE(LLAddBuildTest)
+# SET(llappearance_TEST_SOURCE_FILES
+# # no real unit tests yet!
+# )
+# LL_ADD_PROJECT_UNIT_TESTS(llappearance "${llappearance_TEST_SOURCE_FILES}")
+
+ #set(TEST_DEBUG on)
+# set(test_libs llappearance ${LLCOMMON_LIBRARIES})
+#endif (LL_TESTS)
diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp
new file mode 100644
index 0000000000..2cc38ae2ab
--- /dev/null
+++ b/indra/llappearance/llavatarappearance.cpp
@@ -0,0 +1,173 @@
+/**
+ * @File llavatarappearance.cpp
+ * @brief Implementation of LLAvatarAppearance class
+ *
+ * $LicenseInfo:firstyear=2012&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "linden_common.h"
+
+#include "llavatarappearance.h"
+#include "lltexglobalcolor.h"
+
+const LLColor4 DUMMY_COLOR = LLColor4(0.5,0.5,0.5,1.0);
+
+LLAvatarAppearance::LLAvatarAppearance() :
+ LLCharacter(),
+ mTexSkinColor( NULL ),
+ mTexHairColor( NULL ),
+ mTexEyeColor( NULL ),
+ mIsDummy(FALSE)
+{
+}
+
+using namespace LLAvatarAppearanceDefines;
+
+//static
+BOOL LLAvatarAppearance::teToColorParams( ETextureIndex te, U32 *param_name )
+{
+ switch( te )
+ {
+ case TEX_UPPER_SHIRT:
+ param_name[0] = 803; //"shirt_red";
+ param_name[1] = 804; //"shirt_green";
+ param_name[2] = 805; //"shirt_blue";
+ break;
+
+ case TEX_LOWER_PANTS:
+ param_name[0] = 806; //"pants_red";
+ param_name[1] = 807; //"pants_green";
+ param_name[2] = 808; //"pants_blue";
+ break;
+
+ case TEX_LOWER_SHOES:
+ param_name[0] = 812; //"shoes_red";
+ param_name[1] = 813; //"shoes_green";
+ param_name[2] = 817; //"shoes_blue";
+ break;
+
+ case TEX_LOWER_SOCKS:
+ param_name[0] = 818; //"socks_red";
+ param_name[1] = 819; //"socks_green";
+ param_name[2] = 820; //"socks_blue";
+ break;
+
+ case TEX_UPPER_JACKET:
+ case TEX_LOWER_JACKET:
+ param_name[0] = 834; //"jacket_red";
+ param_name[1] = 835; //"jacket_green";
+ param_name[2] = 836; //"jacket_blue";
+ break;
+
+ case TEX_UPPER_GLOVES:
+ param_name[0] = 827; //"gloves_red";
+ param_name[1] = 829; //"gloves_green";
+ param_name[2] = 830; //"gloves_blue";
+ break;
+
+ case TEX_UPPER_UNDERSHIRT:
+ param_name[0] = 821; //"undershirt_red";
+ param_name[1] = 822; //"undershirt_green";
+ param_name[2] = 823; //"undershirt_blue";
+ break;
+
+ case TEX_LOWER_UNDERPANTS:
+ param_name[0] = 824; //"underpants_red";
+ param_name[1] = 825; //"underpants_green";
+ param_name[2] = 826; //"underpants_blue";
+ break;
+
+ case TEX_SKIRT:
+ param_name[0] = 921; //"skirt_red";
+ param_name[1] = 922; //"skirt_green";
+ param_name[2] = 923; //"skirt_blue";
+ break;
+
+ case TEX_HEAD_TATTOO:
+ case TEX_LOWER_TATTOO:
+ case TEX_UPPER_TATTOO:
+ param_name[0] = 1071; //"tattoo_red";
+ param_name[1] = 1072; //"tattoo_green";
+ param_name[2] = 1073; //"tattoo_blue";
+ break;
+
+ default:
+ llassert(0);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+void LLAvatarAppearance::setClothesColor( ETextureIndex te, const LLColor4& new_color, BOOL upload_bake )
+{
+ U32 param_name[3];
+ if( teToColorParams( te, param_name ) )
+ {
+ setVisualParamWeight( param_name[0], new_color.mV[VX], upload_bake );
+ setVisualParamWeight( param_name[1], new_color.mV[VY], upload_bake );
+ setVisualParamWeight( param_name[2], new_color.mV[VZ], upload_bake );
+ }
+}
+
+LLColor4 LLAvatarAppearance::getClothesColor( ETextureIndex te )
+{
+ LLColor4 color;
+ U32 param_name[3];
+ if( teToColorParams( te, param_name ) )
+ {
+ color.mV[VX] = getVisualParamWeight( param_name[0] );
+ color.mV[VY] = getVisualParamWeight( param_name[1] );
+ color.mV[VZ] = getVisualParamWeight( param_name[2] );
+ }
+ return color;
+}
+
+// static
+LLColor4 LLAvatarAppearance::getDummyColor()
+{
+ return DUMMY_COLOR;
+}
+
+LLColor4 LLAvatarAppearance::getGlobalColor( const std::string& color_name ) const
+{
+ if (color_name=="skin_color" && mTexSkinColor)
+ {
+ return mTexSkinColor->getColor();
+ }
+ else if(color_name=="hair_color" && mTexHairColor)
+ {
+ return mTexHairColor->getColor();
+ }
+ if(color_name=="eye_color" && mTexEyeColor)
+ {
+ return mTexEyeColor->getColor();
+ }
+ else
+ {
+// return LLColor4( .5f, .5f, .5f, .5f );
+ return LLColor4( 0.f, 1.f, 1.f, 1.f ); // good debugging color
+ }
+}
+
+
+
diff --git a/indra/llappearance/llavatarappearance.h b/indra/llappearance/llavatarappearance.h
new file mode 100644
index 0000000000..0ab3960e64
--- /dev/null
+++ b/indra/llappearance/llavatarappearance.h
@@ -0,0 +1,119 @@
+/**
+ * @file llavatarappearance.h
+ * @brief Declaration of LLAvatarAppearance class
+ *
+ * $LicenseInfo:firstyear=2012&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_AVATAR_APPEARANCE_H
+#define LL_AVATAR_APPEARANCE_H
+
+#include "llcharacter.h"
+#include "llframetimer.h"
+#include "llavatarappearancedefines.h"
+
+class LLTexGlobalColor;
+class LLTexLayerSet;
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// LLAvatarAppearance
+//
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+class LLAvatarAppearance : public LLCharacter
+{
+ LOG_CLASS(LLAvatarAppearance);
+
+public:
+ LLAvatarAppearance();
+
+ //--------------------------------------------------------------------
+ // Clothing colors (convenience functions to access visual parameters)
+ //--------------------------------------------------------------------
+public:
+ void setClothesColor(LLAvatarAppearanceDefines::ETextureIndex te, const LLColor4& new_color, BOOL upload_bake);
+ LLColor4 getClothesColor(LLAvatarAppearanceDefines::ETextureIndex te);
+ static BOOL teToColorParams(LLAvatarAppearanceDefines::ETextureIndex te, U32 *param_name);
+
+ //--------------------------------------------------------------------
+ // Global colors
+ //--------------------------------------------------------------------
+public:
+ LLColor4 getGlobalColor(const std::string& color_name ) const;
+ virtual void onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake) = 0;
+protected:
+ LLTexGlobalColor* mTexSkinColor;
+ LLTexGlobalColor* mTexHairColor;
+ LLTexGlobalColor* mTexEyeColor;
+
+ //--------------------------------------------------------------------
+ // Morph masks
+ //--------------------------------------------------------------------
+public:
+ virtual void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES) = 0;
+
+ //--------------------------------------------------------------------
+ // Composites
+ //--------------------------------------------------------------------
+public:
+ virtual void invalidateComposite(LLTexLayerSet* layerset, BOOL upload_result) = 0;
+
+/********************************************************************************
+ ** **
+ ** MESHES
+ **/
+ virtual void dirtyMesh() = 0; // Dirty the avatar mesh
+ virtual void dirtyMesh(S32 priority) = 0; // Dirty the avatar mesh, with priority
+
+/********************************************************************************
+ ** **
+ ** RENDERING
+ **/
+ BOOL mIsDummy; // for special views
+
+/********************************************************************************
+ ** **
+ ** STATE
+ **/
+public:
+ virtual bool isSelf() const { return false; } // True if this avatar is for this viewer's agent
+ virtual BOOL isUsingBakedTextures() const = 0;
+
+/********************************************************************************
+ ** **
+ ** WEARABLES
+ **/
+public:
+ virtual U32 getWearableCount(const LLWearableType::EType type) const = 0;
+ virtual U32 getWearableCount(const U32 tex_index) const = 0;
+
+ virtual LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) = 0;
+ virtual const LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const = 0;
+
+ virtual BOOL isWearingWearableType(LLWearableType::EType type ) const = 0;
+
+public:
+ static LLColor4 getDummyColor();
+ virtual void updateMeshTextures() = 0;
+};
+
+#endif // LL_AVATAR_APPEARANCE_H
diff --git a/indra/newview/llvoavatardefines.cpp b/indra/llappearance/llavatarappearancedefines.cpp
index ef96a9e923..2c3cf781c1 100644
--- a/indra/newview/llvoavatardefines.cpp
+++ b/indra/llappearance/llavatarappearancedefines.cpp
@@ -1,6 +1,6 @@
/**
- * @file llvoavatar.cpp
- * @brief Implementation of LLVOAvatar class which is a derivation fo LLViewerObject
+ * @file llavatarappearancedefines.cpp
+ * @brief Implementation of LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
@@ -24,21 +24,20 @@
* $/LicenseInfo$
*/
-#include "llviewerprecompiledheaders.h"
-#include "llvoavatardefines.h"
-#include "llviewercontrol.h" // gSavedSettings
+#include "linden_common.h"
+#include "llavatarappearancedefines.h"
-const S32 LLVOAvatarDefines::SCRATCH_TEX_WIDTH = 512;
-const S32 LLVOAvatarDefines::SCRATCH_TEX_HEIGHT = 512;
-const S32 LLVOAvatarDefines::IMPOSTOR_PERIOD = 2;
+const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH = 512;
+const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT = 512;
+const S32 LLAvatarAppearanceDefines::IMPOSTOR_PERIOD = 2;
-using namespace LLVOAvatarDefines;
+using namespace LLAvatarAppearanceDefines;
/*********************************************************************************
* Edit this function to add/remove/change textures and mesh definitions for avatars.
*/
-LLVOAvatarDictionary::Textures::Textures()
+LLAvatarAppearanceDictionary::Textures::Textures()
{
addEntry(TEX_HEAD_BODYPAINT, new TextureEntry("head_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN));
addEntry(TEX_UPPER_SHIRT, new TextureEntry("upper_shirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShirtUUID", LLWearableType::WT_SHIRT));
@@ -74,7 +73,7 @@ LLVOAvatarDictionary::Textures::Textures()
addEntry(TEX_SKIRT_BAKED, new TextureEntry("skirt-baked", FALSE, BAKED_SKIRT, "skirt"));
}
-LLVOAvatarDictionary::BakedTextures::BakedTextures()
+LLAvatarAppearanceDictionary::BakedTextures::BakedTextures()
{
// Baked textures
addEntry(BAKED_HEAD, new BakedEntry(TEX_HEAD_BAKED,
@@ -110,36 +109,36 @@ LLVOAvatarDictionary::BakedTextures::BakedTextures()
2, LLWearableType::WT_HAIR, LLWearableType::WT_ALPHA));
}
-LLVOAvatarDictionary::Meshes::Meshes()
+LLAvatarAppearanceDictionary::Meshes::Meshes()
{
// Meshes
- addEntry(MESH_ID_HAIR, new MeshEntry(BAKED_HAIR, "hairMesh", 6, LLViewerJoint::PN_4));
- addEntry(MESH_ID_HEAD, new MeshEntry(BAKED_HEAD, "headMesh", 5, LLViewerJoint::PN_5));
- addEntry(MESH_ID_EYELASH, new MeshEntry(BAKED_HEAD, "eyelashMesh", 1, LLViewerJoint::PN_0)); // no baked mesh associated currently
- addEntry(MESH_ID_UPPER_BODY, new MeshEntry(BAKED_UPPER, "upperBodyMesh", 5, LLViewerJoint::PN_1));
- addEntry(MESH_ID_LOWER_BODY, new MeshEntry(BAKED_LOWER, "lowerBodyMesh", 5, LLViewerJoint::PN_2));
- addEntry(MESH_ID_EYEBALL_LEFT, new MeshEntry(BAKED_EYES, "eyeBallLeftMesh", 2, LLViewerJoint::PN_3));
- addEntry(MESH_ID_EYEBALL_RIGHT, new MeshEntry(BAKED_EYES, "eyeBallRightMesh", 2, LLViewerJoint::PN_3));
- addEntry(MESH_ID_SKIRT, new MeshEntry(BAKED_SKIRT, "skirtMesh", 5, LLViewerJoint::PN_5));
+ addEntry(MESH_ID_HAIR, new MeshEntry(BAKED_HAIR, "hairMesh", 6, PN_4));
+ addEntry(MESH_ID_HEAD, new MeshEntry(BAKED_HEAD, "headMesh", 5, PN_5));
+ addEntry(MESH_ID_EYELASH, new MeshEntry(BAKED_HEAD, "eyelashMesh", 1, PN_0)); // no baked mesh associated currently
+ addEntry(MESH_ID_UPPER_BODY, new MeshEntry(BAKED_UPPER, "upperBodyMesh", 5, PN_1));
+ addEntry(MESH_ID_LOWER_BODY, new MeshEntry(BAKED_LOWER, "lowerBodyMesh", 5, PN_2));
+ addEntry(MESH_ID_EYEBALL_LEFT, new MeshEntry(BAKED_EYES, "eyeBallLeftMesh", 2, PN_3));
+ addEntry(MESH_ID_EYEBALL_RIGHT, new MeshEntry(BAKED_EYES, "eyeBallRightMesh", 2, PN_3));
+ addEntry(MESH_ID_SKIRT, new MeshEntry(BAKED_SKIRT, "skirtMesh", 5, PN_5));
}
/*
*
*********************************************************************************/
-LLVOAvatarDictionary::LLVOAvatarDictionary()
+LLAvatarAppearanceDictionary::LLAvatarAppearanceDictionary()
{
createAssociations();
}
//virtual
-LLVOAvatarDictionary::~LLVOAvatarDictionary()
+LLAvatarAppearanceDictionary::~LLAvatarAppearanceDictionary()
{
}
// Baked textures are composites of textures; for each such composited texture,
// map it to the baked texture.
-void LLVOAvatarDictionary::createAssociations()
+void LLAvatarAppearanceDictionary::createAssociations()
{
for (BakedTextures::const_iterator iter = mBakedTextures.begin(); iter != mBakedTextures.end(); iter++)
{
@@ -160,7 +159,7 @@ void LLVOAvatarDictionary::createAssociations()
}
-LLVOAvatarDictionary::TextureEntry::TextureEntry(const std::string &name,
+LLAvatarAppearanceDictionary::TextureEntry::TextureEntry(const std::string &name,
bool is_local_texture,
EBakedTextureIndex baked_texture_index,
const std::string &default_image_name,
@@ -175,17 +174,17 @@ LLVOAvatarDictionary::TextureEntry::TextureEntry(const std::string &name,
{
}
-LLVOAvatarDictionary::MeshEntry::MeshEntry(EBakedTextureIndex baked_index,
+LLAvatarAppearanceDictionary::MeshEntry::MeshEntry(EBakedTextureIndex baked_index,
const std::string &name,
U8 level,
- LLViewerJoint::PickName pick) :
+ LLJointPickName pick) :
LLDictionaryEntry(name),
mBakedID(baked_index),
mLOD(level),
mPickName(pick)
{
}
-LLVOAvatarDictionary::BakedEntry::BakedEntry(ETextureIndex tex_index,
+LLAvatarAppearanceDictionary::BakedEntry::BakedEntry(ETextureIndex tex_index,
const std::string &name,
const std::string &hash_name,
U32 num_local_textures,
@@ -216,18 +215,18 @@ LLVOAvatarDictionary::BakedEntry::BakedEntry(ETextureIndex tex_index,
}
// static
-ETextureIndex LLVOAvatarDictionary::bakedToLocalTextureIndex(EBakedTextureIndex index)
+ETextureIndex LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(EBakedTextureIndex index)
{
- return LLVOAvatarDictionary::getInstance()->getBakedTexture(index)->mTextureIndex;
+ return LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(index)->mTextureIndex;
}
//static
-EBakedTextureIndex LLVOAvatarDictionary::findBakedByRegionName(std::string name)
+EBakedTextureIndex LLAvatarAppearanceDictionary::findBakedByRegionName(std::string name)
{
U8 index = 0;
while (index < BAKED_NUM_INDICES)
{
- const BakedEntry *be = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex) index);
+ const BakedEntry *be = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex) index);
if (be && be->mName.compare(name) == 0)
{
// baked texture found
@@ -239,23 +238,8 @@ EBakedTextureIndex LLVOAvatarDictionary::findBakedByRegionName(std::string name)
return BAKED_NUM_INDICES;
}
-//static
-const LLUUID LLVOAvatarDictionary::getDefaultTextureImageID(ETextureIndex index)
-{
- const TextureEntry *texture_dict = getInstance()->getTexture(index);
- const std::string &default_image_name = texture_dict->mDefaultImageName;
- if (default_image_name == "")
- {
- return IMG_DEFAULT_AVATAR;
- }
- else
- {
- return LLUUID(gSavedSettings.getString(default_image_name));
- }
-}
-
// static
-LLWearableType::EType LLVOAvatarDictionary::getTEWearableType(ETextureIndex index )
+LLWearableType::EType LLAvatarAppearanceDictionary::getTEWearableType(ETextureIndex index )
{
return getInstance()->getTexture(index)->mWearableType;
}
diff --git a/indra/newview/llvoavatardefines.h b/indra/llappearance/llavatarappearancedefines.h
index 35bb37463a..c5285ddc02 100644
--- a/indra/newview/llvoavatardefines.h
+++ b/indra/llappearance/llavatarappearancedefines.h
@@ -1,6 +1,6 @@
/**
- * @file llvoavatar.h
- * @brief Declaration of LLVOAvatar class which is a derivation fo
+ * @file llavatarappearancedefines.h
+ * @brief Various LLAvatarAppearance related definitions
* LLViewerObject
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
@@ -25,15 +25,15 @@
* $/LicenseInfo$
*/
-#ifndef LLVOAVATAR_DEFINES_H
-#define LLVOAVATAR_DEFINES_H
+#ifndef LL_AVATARAPPEARANCE_DEFINES_H
+#define LL_AVATARAPPEARANCE_DEFINES_H
#include <vector>
#include "llwearable.h"
-#include "llviewerjoint.h"
+#include "lljointpickname.h"
#include "lldictionary.h"
-namespace LLVOAvatarDefines
+namespace LLAvatarAppearanceDefines
{
extern const S32 SCRATCH_TEX_WIDTH;
@@ -111,21 +111,21 @@ typedef std::vector<EMeshIndex> mesh_vec_t;
typedef std::vector<LLWearableType::EType> wearables_vec_t;
//------------------------------------------------------------------------
-// LLVOAvatarDictionary
+// LLAvatarAppearanceDictionary
//
// Holds dictionary static entries for textures, baked textures, meshes, etc.; i.e.
// information that is common to all avatars.
//
// This holds const data - it is initialized once and the contents never change after that.
//------------------------------------------------------------------------
-class LLVOAvatarDictionary : public LLSingleton<LLVOAvatarDictionary>
+class LLAvatarAppearanceDictionary : public LLSingleton<LLAvatarAppearanceDictionary>
{
//--------------------------------------------------------------------
// Constructors and Destructors
//--------------------------------------------------------------------
public:
- LLVOAvatarDictionary();
- virtual ~LLVOAvatarDictionary();
+ LLAvatarAppearanceDictionary();
+ virtual ~LLAvatarAppearanceDictionary();
private:
void createAssociations();
@@ -166,12 +166,12 @@ public:
MeshEntry(EBakedTextureIndex baked_index,
const std::string &name, // names of mesh types as they are used in avatar_lad.xml
U8 level,
- LLViewerJoint::PickName pick);
+ LLJointPickName pick);
// Levels of Detail for each mesh. Must match levels of detail present in avatar_lad.xml
// Otherwise meshes will be unable to be found, or levels of detail will be ignored
const U8 mLOD;
const EBakedTextureIndex mBakedID;
- const LLViewerJoint::PickName mPickName;
+ const LLJointPickName mPickName;
};
struct Meshes : public LLDictionary<EMeshIndex, MeshEntry>
@@ -216,13 +216,11 @@ public:
// find a baked texture index based on its name
static EBakedTextureIndex findBakedByRegionName(std::string name);
- static const LLUUID getDefaultTextureImageID(ETextureIndex index);
-
// Given a texture entry, determine which wearable type owns it.
static LLWearableType::EType getTEWearableType(ETextureIndex index);
-}; // End LLVOAvatarDictionary
+}; // End LLAvatarAppearanceDictionary
-} // End namespace LLVOAvatarDefines
+} // End namespace LLAvatarAppearanceDefines
-#endif //LL_VO_AVATARDEFINES_H
+#endif //LL_AVATARAPPEARANCE_DEFINES_H
diff --git a/indra/newview/llinventoryicon.cpp b/indra/llappearance/llinventoryicon.cpp
index 34734d57c5..62261058ef 100644
--- a/indra/newview/llinventoryicon.cpp
+++ b/indra/llappearance/llinventoryicon.cpp
@@ -24,7 +24,8 @@
* $/LicenseInfo$
*/
-#include "llviewerprecompiledheaders.h"
+//#include "llviewerprecompiledheaders.h"
+#include "linden_common.h"
#include "llinventoryicon.h"
#include "lldictionary.h"
diff --git a/indra/newview/llinventoryicon.h b/indra/llappearance/llinventoryicon.h
index c7e2998a20..c7e2998a20 100644
--- a/indra/newview/llinventoryicon.h
+++ b/indra/llappearance/llinventoryicon.h
diff --git a/indra/llappearance/lljointpickname.h b/indra/llappearance/lljointpickname.h
new file mode 100644
index 0000000000..17181520e3
--- /dev/null
+++ b/indra/llappearance/lljointpickname.h
@@ -0,0 +1,46 @@
+/**
+ * @file lljointpickname.h
+ * @brief Defines OpenGL seleciton stack names
+ *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+
+#ifndef LL_LLJOINTPICKNAME_H
+#define LL_LLJOINTPICKNAME_H
+
+
+// Sets the OpenGL selection stack name that is pushed and popped
+// with this joint state. The default value indicates that no name
+// should be pushed/popped.
+enum LLJointPickName
+{
+ PN_DEFAULT = -1,
+ PN_0 = 0,
+ PN_1 = 1,
+ PN_2 = 2,
+ PN_3 = 3,
+ PN_4 = 4,
+ PN_5 = 5
+};
+
+#endif // LL_LLJOINTPICKNAME_H
diff --git a/indra/newview/lllocaltextureobject.cpp b/indra/llappearance/lllocaltextureobject.cpp
index 07ec0fab95..0e77444f49 100644
--- a/indra/newview/lllocaltextureobject.cpp
+++ b/indra/llappearance/lllocaltextureobject.cpp
@@ -23,13 +23,14 @@
* $/LicenseInfo$
*/
-#include "llviewerprecompiledheaders.h"
+#include "linden_common.h"
#include "lllocaltextureobject.h"
+#include "llimage.h"
+#include "llrender.h"
#include "lltexlayer.h"
-#include "llviewertexture.h"
-#include "lltextureentry.h"
+#include "lltexture.h"
#include "lluuid.h"
#include "llwearable.h"
@@ -41,7 +42,7 @@ LLLocalTextureObject::LLLocalTextureObject() :
mImage = NULL;
}
-LLLocalTextureObject::LLLocalTextureObject(LLViewerFetchedTexture* image, const LLUUID& id) :
+LLLocalTextureObject::LLLocalTextureObject(LLTexture* image, const LLUUID& id) :
mIsBakedReady(FALSE),
mDiscard(MAX_DISCARD_LEVEL+1)
{
@@ -77,7 +78,7 @@ LLLocalTextureObject::~LLLocalTextureObject()
{
}
-LLViewerFetchedTexture* LLLocalTextureObject::getImage() const
+LLTexture* LLLocalTextureObject::getImage() const
{
return mImage;
}
@@ -126,7 +127,7 @@ BOOL LLLocalTextureObject::getBakedReady() const
return mIsBakedReady;
}
-void LLLocalTextureObject::setImage(LLViewerFetchedTexture* new_image)
+void LLLocalTextureObject::setImage(LLTexture* new_image)
{
mImage = new_image;
}
diff --git a/indra/newview/lllocaltextureobject.h b/indra/llappearance/lllocaltextureobject.h
index b9bfc5472f..8f868eb412 100644
--- a/indra/newview/lllocaltextureobject.h
+++ b/indra/llappearance/lllocaltextureobject.h
@@ -29,11 +29,11 @@
#include <boost/shared_ptr.hpp>
-#include "llviewertexture.h"
+#include "llpointer.h"
+#include "lltexture.h"
class LLUUID;
class LLTexLayer;
-class LLTextureEntry;
class LLTexLayerTemplate;
class LLWearable;
@@ -44,11 +44,11 @@ class LLLocalTextureObject
{
public:
LLLocalTextureObject();
- LLLocalTextureObject(LLViewerFetchedTexture* image, const LLUUID& id);
+ LLLocalTextureObject(LLTexture* image, const LLUUID& id);
LLLocalTextureObject(const LLLocalTextureObject& lto);
~LLLocalTextureObject();
- LLViewerFetchedTexture* getImage() const;
+ LLTexture* getImage() const;
LLTexLayer* getTexLayer(U32 index) const;
LLTexLayer* getTexLayer(const std::string &name);
U32 getNumTexLayers() const;
@@ -56,7 +56,7 @@ public:
S32 getDiscard() const;
BOOL getBakedReady() const;
- void setImage(LLViewerFetchedTexture* new_image);
+ void setImage(LLTexture* new_image);
BOOL setTexLayer(LLTexLayer *new_tex_layer, U32 index);
BOOL addTexLayer(LLTexLayer *new_tex_layer, LLWearable *wearable);
BOOL addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable);
@@ -70,7 +70,7 @@ protected:
private:
- LLPointer<LLViewerFetchedTexture> mImage;
+ LLPointer<LLTexture> mImage;
// NOTE: LLLocalTextureObject should be the exclusive owner of mTexEntry and mTexLayer
// using shared pointers here only for smart assignment & cleanup
// do NOT create new shared pointers to these objects, or keep pointers to them around
diff --git a/indra/newview/lltexglobalcolor.cpp b/indra/llappearance/lltexglobalcolor.cpp
index ebe5ccd6c0..d9c6150fc6 100644
--- a/indra/newview/lltexglobalcolor.cpp
+++ b/indra/llappearance/lltexglobalcolor.cpp
@@ -24,20 +24,22 @@
* $/LicenseInfo$
*/
-#include "llviewerprecompiledheaders.h"
-#include "llagent.h"
+#include "linden_common.h"
+
+#include "llavatarappearance.h"
#include "lltexlayer.h"
-#include "llvoavatar.h"
-#include "llwearable.h"
+//#include "llwearable.h"
#include "lltexglobalcolor.h"
+class LLWearable;
+
//-----------------------------------------------------------------------------
// LLTexGlobalColor
//-----------------------------------------------------------------------------
-LLTexGlobalColor::LLTexGlobalColor(LLVOAvatar* avatar)
+LLTexGlobalColor::LLTexGlobalColor(LLAvatarAppearance* appearance)
:
- mAvatar(avatar),
+ mAvatarAppearance(appearance),
mInfo(NULL)
{
}
@@ -91,7 +93,7 @@ const std::string& LLTexGlobalColor::getName() const
// LLTexParamGlobalColor
//-----------------------------------------------------------------------------
LLTexParamGlobalColor::LLTexParamGlobalColor(LLTexGlobalColor* tex_global_color) :
- LLTexLayerParamColor(tex_global_color->getAvatar()),
+ LLTexLayerParamColor(tex_global_color->getAvatarAppearance()),
mTexGlobalColor(tex_global_color)
{
}
@@ -105,7 +107,7 @@ LLTexParamGlobalColor::LLTexParamGlobalColor(LLTexGlobalColor* tex_global_color)
void LLTexParamGlobalColor::onGlobalColorChanged(bool upload_bake)
{
- mAvatar->onGlobalColorChanged(mTexGlobalColor, upload_bake);
+ mAvatarAppearance->onGlobalColorChanged(mTexGlobalColor, upload_bake);
}
//-----------------------------------------------------------------------------
diff --git a/indra/newview/lltexglobalcolor.h b/indra/llappearance/lltexglobalcolor.h
index ae04798445..2867479876 100644
--- a/indra/newview/lltexglobalcolor.h
+++ b/indra/llappearance/lltexglobalcolor.h
@@ -1,6 +1,6 @@
/**
* @file lltexglobalcolor.h
- * @brief This is global texture color info used by llvoavatar.
+ * @brief This is global texture color info used by llavatarappearance.
*
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
@@ -30,31 +30,31 @@
#include "lltexlayer.h"
#include "lltexlayerparams.h"
-class LLVOAvatar;
+class LLAvatarAppearance;
class LLWearable;
class LLTexGlobalColorInfo;
class LLTexGlobalColor
{
public:
- LLTexGlobalColor( LLVOAvatar* avatar );
+ LLTexGlobalColor( LLAvatarAppearance* appearance );
~LLTexGlobalColor();
LLTexGlobalColorInfo* getInfo() const { return mInfo; }
// This sets mInfo and calls initialization functions
BOOL setInfo(LLTexGlobalColorInfo *info);
- LLVOAvatar* getAvatar() const { return mAvatar; }
+ LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; }
LLColor4 getColor() const;
const std::string& getName() const;
private:
param_color_list_t mParamGlobalColorList;
- LLVOAvatar* mAvatar; // just backlink, don't LLPointer
+ LLAvatarAppearance* mAvatarAppearance; // just backlink, don't LLPointer
LLTexGlobalColorInfo *mInfo;
};
-// Used by llvoavatar to determine skin/eye/hair color.
+// Used by llavatarappearance to determine skin/eye/hair color.
class LLTexGlobalColorInfo
{
friend class LLTexGlobalColor;
diff --git a/indra/newview/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp
index 467115c928..bf2fd1e30d 100644
--- a/indra/newview/lltexlayer.cpp
+++ b/indra/llappearance/lltexlayer.cpp
@@ -24,33 +24,27 @@
* $/LicenseInfo$
*/
-#include "llviewerprecompiledheaders.h"
+#include "linden_common.h"
#include "lltexlayer.h"
-#include "llagent.h"
+#include "llavatarappearance.h"
+#include "llcrc.h"
+#include "imageids.h"
#include "llimagej2c.h"
#include "llimagetga.h"
-#include "llnotificationsutil.h"
+#include "lldir.h"
#include "llvfile.h"
#include "llvfs.h"
-#include "llviewerstats.h"
-#include "llviewerregion.h"
-#include "llvoavatar.h"
-#include "llvoavatarself.h"
-#include "pipeline.h"
-#include "llassetuploadresponders.h"
#include "lltexlayerparams.h"
+#include "lltexturemanagerbridge.h"
#include "llui.h"
-#include "llagentwearables.h"
#include "llwearable.h"
-#include "llviewercontrol.h"
-#include "llviewershadermgr.h"
#include "llviewervisualparam.h"
//#include "../tools/imdebug/imdebug.h"
-using namespace LLVOAvatarDefines;
+using namespace LLAvatarAppearanceDefines;
static const S32 BAKE_UPLOAD_ATTEMPTS = 7;
static const F32 BAKE_UPLOAD_RETRY_DELAY = 2.f; // actual delay grows by power of 2 each attempt
@@ -68,7 +62,7 @@ public:
~LLTexLayerInfo();
BOOL parseXml(LLXmlTreeNode* node);
- BOOL createVisualParams(LLVOAvatar *avatar);
+ BOOL createVisualParams(LLAvatarAppearance *appearance);
BOOL isUserSettable() { return mLocalTexture != -1; }
S32 getLocalTexture() const { return mLocalTexture; }
BOOL getOnlyAlpha() const { return mUseLocalTextureAlphaOnly; }
@@ -95,626 +89,9 @@ private:
param_alpha_info_list_t mParamAlphaInfoList;
};
-//-----------------------------------------------------------------------------
-// LLBakedUploadData()
-//-----------------------------------------------------------------------------
-LLBakedUploadData::LLBakedUploadData(const LLVOAvatarSelf* avatar,
- LLTexLayerSet* layerset,
- const LLUUID& id,
- bool highest_res) :
- mAvatar(avatar),
- mTexLayerSet(layerset),
- mID(id),
- mStartTime(LLFrameTimer::getTotalTime()), // Record starting time
- mIsHighestRes(highest_res)
-{
-}
//-----------------------------------------------------------------------------
-// LLTexLayerSetBuffer
-// The composite image that a LLTexLayerSet writes to. Each LLTexLayerSet has one.
-//-----------------------------------------------------------------------------
-
-// static
-S32 LLTexLayerSetBuffer::sGLByteCount = 0;
-
-LLTexLayerSetBuffer::LLTexLayerSetBuffer(LLTexLayerSet* const owner,
- S32 width, S32 height) :
- // ORDER_LAST => must render these after the hints are created.
- LLViewerDynamicTexture( width, height, 4, LLViewerDynamicTexture::ORDER_LAST, TRUE ),
- mUploadPending(FALSE), // Not used for any logic here, just to sync sending of updates
- mNeedsUpload(FALSE),
- mNumLowresUploads(0),
- mUploadFailCount(0),
- mNeedsUpdate(TRUE),
- mNumLowresUpdates(0),
- mTexLayerSet(owner)
-{
- LLTexLayerSetBuffer::sGLByteCount += getSize();
- mNeedsUploadTimer.start();
- mNeedsUpdateTimer.start();
-}
-
-LLTexLayerSetBuffer::~LLTexLayerSetBuffer()
-{
- LLTexLayerSetBuffer::sGLByteCount -= getSize();
- destroyGLTexture();
- for( S32 order = 0; order < ORDER_COUNT; order++ )
- {
- LLViewerDynamicTexture::sInstances[order].erase(this); // will fail in all but one case.
- }
-}
-
-//virtual
-S8 LLTexLayerSetBuffer::getType() const
-{
- return LLViewerDynamicTexture::LL_TEX_LAYER_SET_BUFFER ;
-}
-
-//virtual
-void LLTexLayerSetBuffer::restoreGLTexture()
-{
- LLViewerDynamicTexture::restoreGLTexture() ;
-}
-
-//virtual
-void LLTexLayerSetBuffer::destroyGLTexture()
-{
- LLViewerDynamicTexture::destroyGLTexture() ;
-}
-
-// static
-void LLTexLayerSetBuffer::dumpTotalByteCount()
-{
- llinfos << "Composite System GL Buffers: " << (LLTexLayerSetBuffer::sGLByteCount/1024) << "KB" << llendl;
-}
-
-void LLTexLayerSetBuffer::requestUpdate()
-{
- restartUpdateTimer();
- mNeedsUpdate = TRUE;
- mNumLowresUpdates = 0;
- // If we're in the middle of uploading a baked texture, we don't care about it any more.
- // When it's downloaded, ignore it.
- mUploadID.setNull();
-}
-
-void LLTexLayerSetBuffer::requestUpload()
-{
- conditionalRestartUploadTimer();
- mNeedsUpload = TRUE;
- mNumLowresUploads = 0;
- mUploadPending = TRUE;
-}
-
-void LLTexLayerSetBuffer::conditionalRestartUploadTimer()
-{
- // If we requested a new upload but haven't even uploaded
- // a low res version of our last upload request, then
- // keep the timer ticking instead of resetting it.
- if (mNeedsUpload && (mNumLowresUploads == 0))
- {
- mNeedsUploadTimer.unpause();
- }
- else
- {
- mNeedsUploadTimer.reset();
- mNeedsUploadTimer.start();
- }
-}
-
-void LLTexLayerSetBuffer::restartUpdateTimer()
-{
- mNeedsUpdateTimer.reset();
- mNeedsUpdateTimer.start();
-}
-
-void LLTexLayerSetBuffer::cancelUpload()
-{
- mNeedsUpload = FALSE;
- mUploadPending = FALSE;
- mNeedsUploadTimer.pause();
- mUploadRetryTimer.reset();
-}
-
-void LLTexLayerSetBuffer::pushProjection() const
-{
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.pushMatrix();
- gGL.loadIdentity();
- gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
-
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.pushMatrix();
- gGL.loadIdentity();
-}
-
-void LLTexLayerSetBuffer::popProjection() const
-{
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.popMatrix();
-
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.popMatrix();
-}
-
-BOOL LLTexLayerSetBuffer::needsRender()
-{
- llassert(mTexLayerSet->getAvatar() == gAgentAvatarp);
- if (!isAgentAvatarValid()) return FALSE;
-
- const BOOL upload_now = mNeedsUpload && isReadyToUpload();
- const BOOL update_now = mNeedsUpdate && isReadyToUpdate();
-
- // Don't render if we don't want to (or aren't ready to) upload or update.
- if (!(update_now || upload_now))
- {
- return FALSE;
- }
-
- // Don't render if we're animating our appearance.
- if (gAgentAvatarp->getIsAppearanceAnimating())
- {
- return FALSE;
- }
-
- // Don't render if we are trying to create a shirt texture but aren't wearing a skirt.
- if (gAgentAvatarp->getBakedTE(mTexLayerSet) == LLVOAvatarDefines::TEX_SKIRT_BAKED &&
- !gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT))
- {
- cancelUpload();
- return FALSE;
- }
-
- // Render if we have at least minimal level of detail for each local texture.
- return mTexLayerSet->isLocalTextureDataAvailable();
-}
-
-void LLTexLayerSetBuffer::preRender(BOOL clear_depth)
-{
- // Set up an ortho projection
- pushProjection();
-
- // keep depth buffer, we don't need to clear it
- LLViewerDynamicTexture::preRender(FALSE);
-}
-
-void LLTexLayerSetBuffer::postRender(BOOL success)
-{
- popProjection();
-
- LLViewerDynamicTexture::postRender(success);
-}
-
-BOOL LLTexLayerSetBuffer::render()
-{
- // Default color mask for tex layer render
- gGL.setColorMask(true, true);
-
- // do we need to upload, and do we have sufficient data to create an uploadable composite?
- // TODO: When do we upload the texture if gAgent.mNumPendingQueries is non-zero?
- const BOOL upload_now = mNeedsUpload && isReadyToUpload();
- const BOOL update_now = mNeedsUpdate && isReadyToUpdate();
-
- BOOL success = TRUE;
-
- bool use_shaders = LLGLSLShader::sNoFixedFunction;
-
- if (use_shaders)
- {
- gAlphaMaskProgram.bind();
- gAlphaMaskProgram.setMinimumAlpha(0.004f);
- }
-
- LLVertexBuffer::unbind();
-
- // Composite the color data
- LLGLSUIDefault gls_ui;
- success &= mTexLayerSet->render( mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight );
- gGL.flush();
-
- if(upload_now)
- {
- if (!success)
- {
- llinfos << "Failed attempt to bake " << mTexLayerSet->getBodyRegionName() << llendl;
- mUploadPending = FALSE;
- }
- else
- {
- if (mTexLayerSet->isVisible())
- {
- mTexLayerSet->getAvatar()->debugBakedTextureUpload(mTexLayerSet->getBakedTexIndex(), FALSE); // FALSE for start of upload, TRUE for finish.
- doUpload();
- }
- else
- {
- mUploadPending = FALSE;
- mNeedsUpload = FALSE;
- mNeedsUploadTimer.pause();
- mTexLayerSet->getAvatar()->setNewBakedTexture(mTexLayerSet->getBakedTexIndex(),IMG_INVISIBLE);
- }
- }
- }
-
- if (update_now)
- {
- doUpdate();
- }
-
- if (use_shaders)
- {
- gAlphaMaskProgram.unbind();
- }
-
- LLVertexBuffer::unbind();
-
- // reset GL state
- gGL.setColorMask(true, true);
- gGL.setSceneBlendType(LLRender::BT_ALPHA);
-
- // we have valid texture data now
- mGLTexturep->setGLTextureCreated(true);
-
- return success;
-}
-
-BOOL LLTexLayerSetBuffer::isInitialized(void) const
-{
- return mGLTexturep.notNull() && mGLTexturep->isGLTextureCreated();
-}
-
-BOOL LLTexLayerSetBuffer::uploadPending() const
-{
- return mUploadPending;
-}
-
-BOOL LLTexLayerSetBuffer::uploadNeeded() const
-{
- return mNeedsUpload;
-}
-
-BOOL LLTexLayerSetBuffer::uploadInProgress() const
-{
- return !mUploadID.isNull();
-}
-
-BOOL LLTexLayerSetBuffer::isReadyToUpload() const
-{
- if (!gAgentQueryManager.hasNoPendingQueries()) return FALSE; // Can't upload if there are pending queries.
- if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures()) return FALSE; // Don't upload if avatar is using composites.
-
- BOOL ready = FALSE;
- if (mTexLayerSet->isLocalTextureDataFinal())
- {
- // If we requested an upload and have the final LOD ready, upload (or wait a while if this is a retry)
- if (mUploadFailCount == 0)
- {
- ready = TRUE;
- }
- else
- {
- ready = mUploadRetryTimer.getElapsedTimeF32() >= BAKE_UPLOAD_RETRY_DELAY * (1 << (mUploadFailCount - 1));
- }
- }
- else
- {
- // Upload if we've hit a timeout. Upload is a pretty expensive process so we need to make sure
- // we aren't doing uploads too frequently.
- const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedTextureUploadTimeout");
- if (texture_timeout != 0)
- {
- // The timeout period increases exponentially between every lowres upload in order to prevent
- // spamming the server with frequent uploads.
- const U32 texture_timeout_threshold = texture_timeout*(1 << mNumLowresUploads);
-
- // If we hit our timeout and have textures available at even lower resolution, then upload.
- const BOOL is_upload_textures_timeout = mNeedsUploadTimer.getElapsedTimeF32() >= texture_timeout_threshold;
- const BOOL has_lower_lod = mTexLayerSet->isLocalTextureDataAvailable();
- ready = has_lower_lod && is_upload_textures_timeout;
- }
- }
-
- return ready;
-}
-
-BOOL LLTexLayerSetBuffer::isReadyToUpdate() const
-{
- // If we requested an update and have the final LOD ready, then update.
- if (mTexLayerSet->isLocalTextureDataFinal()) return TRUE;
-
- // If we haven't done an update yet, then just do one now regardless of state of textures.
- if (mNumLowresUpdates == 0) return TRUE;
-
- // Update if we've hit a timeout. Unlike for uploads, we can make this timeout fairly small
- // since render unnecessarily doesn't cost much.
- const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedLocalTextureUpdateTimeout");
- if (texture_timeout != 0)
- {
- // If we hit our timeout and have textures available at even lower resolution, then update.
- const BOOL is_update_textures_timeout = mNeedsUpdateTimer.getElapsedTimeF32() >= texture_timeout;
- const BOOL has_lower_lod = mTexLayerSet->isLocalTextureDataAvailable();
- if (has_lower_lod && is_update_textures_timeout) return TRUE;
- }
-
- return FALSE;
-}
-
-BOOL LLTexLayerSetBuffer::requestUpdateImmediate()
-{
- mNeedsUpdate = TRUE;
- BOOL result = FALSE;
-
- if (needsRender())
- {
- preRender(FALSE);
- result = render();
- postRender(result);
- }
-
- return result;
-}
-
-// Create the baked texture, send it out to the server, then wait for it to come
-// back so we can switch to using it.
-void LLTexLayerSetBuffer::doUpload()
-{
- llinfos << "Uploading baked " << mTexLayerSet->getBodyRegionName() << llendl;
- LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_BAKES);
-
- // Don't need caches since we're baked now. (note: we won't *really* be baked
- // until this image is sent to the server and the Avatar Appearance message is received.)
- mTexLayerSet->deleteCaches();
-
- // Get the COLOR information from our texture
- U8* baked_color_data = new U8[ mFullWidth * mFullHeight * 4 ];
- glReadPixels(mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, GL_RGBA, GL_UNSIGNED_BYTE, baked_color_data );
- stop_glerror();
-
- // Get the MASK information from our texture
- LLGLSUIDefault gls_ui;
- LLPointer<LLImageRaw> baked_mask_image = new LLImageRaw(mFullWidth, mFullHeight, 1 );
- U8* baked_mask_data = baked_mask_image->getData();
- mTexLayerSet->gatherMorphMaskAlpha(baked_mask_data, mFullWidth, mFullHeight);
-
-
- // Create the baked image from our color and mask information
- const S32 baked_image_components = 5; // red green blue [bump] clothing
- LLPointer<LLImageRaw> baked_image = new LLImageRaw( mFullWidth, mFullHeight, baked_image_components );
- U8* baked_image_data = baked_image->getData();
- S32 i = 0;
- for (S32 u=0; u < mFullWidth; u++)
- {
- for (S32 v=0; v < mFullHeight; v++)
- {
- baked_image_data[5*i + 0] = baked_color_data[4*i + 0];
- baked_image_data[5*i + 1] = baked_color_data[4*i + 1];
- baked_image_data[5*i + 2] = baked_color_data[4*i + 2];
- baked_image_data[5*i + 3] = baked_color_data[4*i + 3]; // alpha should be correct for eyelashes.
- baked_image_data[5*i + 4] = baked_mask_data[i];
- i++;
- }
- }
-
- LLPointer<LLImageJ2C> compressedImage = new LLImageJ2C;
- const char* comment_text = LINDEN_J2C_COMMENT_PREFIX "RGBHM"; // writes into baked_color_data. 5 channels (rgb, heightfield/alpha, mask)
- if (compressedImage->encode(baked_image, comment_text))
- {
- LLTransactionID tid;
- tid.generate();
- const LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
- if (LLVFile::writeFile(compressedImage->getData(), compressedImage->getDataSize(),
- gVFS, asset_id, LLAssetType::AT_TEXTURE))
- {
- // Read back the file and validate.
- BOOL valid = FALSE;
- LLPointer<LLImageJ2C> integrity_test = new LLImageJ2C;
- S32 file_size = 0;
- U8* data = LLVFile::readFile(gVFS, asset_id, LLAssetType::AT_TEXTURE, &file_size);
- if (data)
- {
- valid = integrity_test->validate(data, file_size); // integrity_test will delete 'data'
- }
- else
- {
- integrity_test->setLastError("Unable to read entire file");
- }
-
- if (valid)
- {
- const bool highest_lod = mTexLayerSet->isLocalTextureDataFinal();
- // Baked_upload_data is owned by the responder and deleted after the request completes.
- LLBakedUploadData* baked_upload_data = new LLBakedUploadData(gAgentAvatarp,
- this->mTexLayerSet,
- asset_id,
- highest_lod);
- // upload ID is used to avoid overlaps, e.g. when the user rapidly makes two changes outside of Face Edit.
- mUploadID = asset_id;
-
- // Upload the image
- const std::string url = gAgent.getRegion()->getCapability("UploadBakedTexture");
- if(!url.empty()
- && !LLPipeline::sForceOldBakedUpload // toggle debug setting UploadBakedTexOld to change between the new caps method and old method
- && (mUploadFailCount < (BAKE_UPLOAD_ATTEMPTS - 1))) // Try last ditch attempt via asset store if cap upload is failing.
- {
- LLSD body = LLSD::emptyMap();
- // The responder will call LLTexLayerSetBuffer::onTextureUploadComplete()
- LLHTTPClient::post(url, body, new LLSendTexLayerResponder(body, mUploadID, LLAssetType::AT_TEXTURE, baked_upload_data));
- llinfos << "Baked texture upload via capability of " << mUploadID << " to " << url << llendl;
- }
- else
- {
- gAssetStorage->storeAssetData(tid,
- LLAssetType::AT_TEXTURE,
- LLTexLayerSetBuffer::onTextureUploadComplete,
- baked_upload_data,
- TRUE, // temp_file
- TRUE, // is_priority
- TRUE); // store_local
- llinfos << "Baked texture upload via Asset Store." << llendl;
- }
-
- if (highest_lod)
- {
- // Sending the final LOD for the baked texture. All done, pause
- // the upload timer so we know how long it took.
- mNeedsUpload = FALSE;
- mNeedsUploadTimer.pause();
- }
- else
- {
- // Sending a lower level LOD for the baked texture. Restart the upload timer.
- mNumLowresUploads++;
- mNeedsUploadTimer.unpause();
- mNeedsUploadTimer.reset();
- }
-
- // Print out notification that we uploaded this texture.
- if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
- {
- const std::string lod_str = highest_lod ? "HighRes" : "LowRes";
- LLSD args;
- args["EXISTENCE"] = llformat("%d",(U32)mTexLayerSet->getAvatar()->debugGetExistenceTimeElapsedF32());
- args["TIME"] = llformat("%d",(U32)mNeedsUploadTimer.getElapsedTimeF32());
- args["BODYREGION"] = mTexLayerSet->getBodyRegionName();
- args["RESOLUTION"] = lod_str;
- LLNotificationsUtil::add("AvatarRezSelfBakedTextureUploadNotification",args);
- LL_DEBUGS("Avatar") << self_av_string() << "Uploading [ name: " << mTexLayerSet->getBodyRegionName() << " res:" << lod_str << " time:" << (U32)mNeedsUploadTimer.getElapsedTimeF32() << " ]" << LL_ENDL;
- }
- }
- else
- {
- // The read back and validate operation failed. Remove the uploaded file.
- mUploadPending = FALSE;
- LLVFile file(gVFS, asset_id, LLAssetType::AT_TEXTURE, LLVFile::WRITE);
- file.remove();
- llinfos << "Unable to create baked upload file (reason: corrupted)." << llendl;
- }
- }
- }
- else
- {
- // The VFS write file operation failed.
- mUploadPending = FALSE;
- llinfos << "Unable to create baked upload file (reason: failed to write file)" << llendl;
- }
-
- delete [] baked_color_data;
-}
-
-// Mostly bookkeeping; don't need to actually "do" anything since
-// render() will actually do the update.
-void LLTexLayerSetBuffer::doUpdate()
-{
- const BOOL highest_lod = mTexLayerSet->isLocalTextureDataFinal();
- if (highest_lod)
- {
- mNeedsUpdate = FALSE;
- }
- else
- {
- mNumLowresUpdates++;
- }
-
- restartUpdateTimer();
-
- // need to swtich to using this layerset if this is the first update
- // after getting the lowest LOD
- mTexLayerSet->getAvatar()->updateMeshTextures();
-
- // Print out notification that we uploaded this texture.
- if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
- {
- const BOOL highest_lod = mTexLayerSet->isLocalTextureDataFinal();
- const std::string lod_str = highest_lod ? "HighRes" : "LowRes";
- LLSD args;
- args["EXISTENCE"] = llformat("%d",(U32)mTexLayerSet->getAvatar()->debugGetExistenceTimeElapsedF32());
- args["TIME"] = llformat("%d",(U32)mNeedsUpdateTimer.getElapsedTimeF32());
- args["BODYREGION"] = mTexLayerSet->getBodyRegionName();
- args["RESOLUTION"] = lod_str;
- LLNotificationsUtil::add("AvatarRezSelfBakedTextureUpdateNotification",args);
- LL_DEBUGS("Avatar") << self_av_string() << "Locally updating [ name: " << mTexLayerSet->getBodyRegionName() << " res:" << lod_str << " time:" << (U32)mNeedsUpdateTimer.getElapsedTimeF32() << " ]" << LL_ENDL;
- }
-}
-
-// static
-void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid,
- void* userdata,
- S32 result,
- LLExtStat ext_status) // StoreAssetData callback (not fixed)
-{
- LLBakedUploadData* baked_upload_data = (LLBakedUploadData*)userdata;
-
- if (isAgentAvatarValid() &&
- !gAgentAvatarp->isDead() &&
- (baked_upload_data->mAvatar == gAgentAvatarp) && // Sanity check: only the user's avatar should be uploading textures.
- (baked_upload_data->mTexLayerSet->hasComposite()))
- {
- LLTexLayerSetBuffer* layerset_buffer = baked_upload_data->mTexLayerSet->getComposite();
- S32 failures = layerset_buffer->mUploadFailCount;
- layerset_buffer->mUploadFailCount = 0;
-
- if (layerset_buffer->mUploadID.isNull())
- {
- // The upload got canceled, we should be in the
- // process of baking a new texture so request an
- // upload with the new data
-
- // BAP: does this really belong in this callback, as
- // opposed to where the cancellation takes place?
- // suspect this does nothing.
- layerset_buffer->requestUpload();
- }
- else if (baked_upload_data->mID == layerset_buffer->mUploadID)
- {
- // This is the upload we're currently waiting for.
- layerset_buffer->mUploadID.setNull();
- const std::string name(baked_upload_data->mTexLayerSet->getBodyRegionName());
- const std::string resolution = baked_upload_data->mIsHighestRes ? " full res " : " low res ";
- if (result >= 0)
- {
- layerset_buffer->mUploadPending = FALSE; // Allows sending of AgentSetAppearance later
- LLVOAvatarDefines::ETextureIndex baked_te = gAgentAvatarp->getBakedTE(layerset_buffer->mTexLayerSet);
- // Update baked texture info with the new UUID
- U64 now = LLFrameTimer::getTotalTime(); // Record starting time
- llinfos << "Baked" << resolution << "texture upload for " << name << " took " << (S32)((now - baked_upload_data->mStartTime) / 1000) << " ms" << llendl;
- gAgentAvatarp->setNewBakedTexture(baked_te, uuid);
- }
- else
- {
- ++failures;
- S32 max_attempts = baked_upload_data->mIsHighestRes ? BAKE_UPLOAD_ATTEMPTS : 1; // only retry final bakes
- llwarns << "Baked" << resolution << "texture upload for " << name << " failed (attempt " << failures << "/" << max_attempts << ")" << llendl;
- if (failures < max_attempts)
- {
- layerset_buffer->mUploadFailCount = failures;
- layerset_buffer->mUploadRetryTimer.start();
- layerset_buffer->requestUpload();
- }
- }
- }
- else
- {
- llinfos << "Received baked texture out of date, ignored." << llendl;
- }
-
- gAgentAvatarp->dirtyMesh();
- }
- else
- {
- // Baked texture failed to upload (in which case since we
- // didn't set the new baked texture, it means that they'll try
- // and rebake it at some point in the future (after login?)),
- // or this response to upload is out of date, in which case a
- // current response should be on the way or already processed.
- llwarns << "Baked upload failed" << llendl;
- }
-
- delete baked_upload_data;
-}
-
-//-----------------------------------------------------------------------------
-// LLTexLayerSet
+// LLTexLayerSetInfo
// An ordered set of texture layers that get composited into a single texture.
//-----------------------------------------------------------------------------
@@ -784,7 +161,7 @@ BOOL LLTexLayerSetInfo::parseXml(LLXmlTreeNode* node)
}
// creates visual params without generating layersets or layers
-void LLTexLayerSetInfo::createVisualParams(LLVOAvatar *avatar)
+void LLTexLayerSetInfo::createVisualParams(LLAvatarAppearance *appearance)
{
//layer_info_list_t mLayerInfoList;
for (layer_info_list_t::iterator layer_iter = mLayerInfoList.begin();
@@ -792,7 +169,7 @@ void LLTexLayerSetInfo::createVisualParams(LLVOAvatar *avatar)
layer_iter++)
{
LLTexLayerInfo *layer_info = *layer_iter;
- layer_info->createVisualParams(avatar);
+ layer_info->createVisualParams(appearance);
}
}
@@ -803,16 +180,15 @@ void LLTexLayerSetInfo::createVisualParams(LLVOAvatar *avatar)
BOOL LLTexLayerSet::sHasCaches = FALSE;
-LLTexLayerSet::LLTexLayerSet(LLVOAvatarSelf* const avatar) :
- mComposite( NULL ),
- mAvatar( avatar ),
- mUpdatesEnabled( FALSE ),
+LLTexLayerSet::LLTexLayerSet(LLAvatarAppearance* const appearance) :
+ mAvatarAppearance( appearance ),
mIsVisible( TRUE ),
- mBakedTexIndex(LLVOAvatarDefines::BAKED_HEAD),
+ mBakedTexIndex(LLAvatarAppearanceDefines::BAKED_HEAD),
mInfo( NULL )
{
}
+// virtual
LLTexLayerSet::~LLTexLayerSet()
{
deleteCaches();
@@ -838,13 +214,13 @@ BOOL LLTexLayerSet::setInfo(const LLTexLayerSetInfo *info)
LLTexLayerInterface *layer = NULL;
if ( (*iter)->isUserSettable() )
{
- layer = new LLTexLayerTemplate( this );
+ layer = new LLTexLayerTemplate( this, getAvatarAppearance() );
}
else
{
layer = new LLTexLayer(this);
}
- // this is the first time this layer (of either type) is being created - make sure you add the parameters to the avatar
+ // this is the first time this layer (of either type) is being created - make sure you add the parameters to the avatar appearance
if (!layer->setInfo(*iter, NULL))
{
mInfo = NULL;
@@ -904,21 +280,6 @@ void LLTexLayerSet::deleteCaches()
}
}
-// Returns TRUE if at least one packet of data has been received for each of the textures that this layerset depends on.
-BOOL LLTexLayerSet::isLocalTextureDataAvailable() const
-{
- if (!mAvatar->isSelf()) return FALSE;
- return ((LLVOAvatarSelf *)mAvatar)->isLocalTextureDataAvailable(this);
-}
-
-
-// Returns TRUE if all of the data for the textures that this layerset depends on have arrived.
-BOOL LLTexLayerSet::isLocalTextureDataFinal() const
-{
- if (!mAvatar->isSelf()) return FALSE;
- return ((LLVOAvatarSelf *)mAvatar)->isLocalTextureDataFinal(this);
-}
-
BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
{
@@ -1019,91 +380,6 @@ const std::string LLTexLayerSet::getBodyRegionName() const
return mInfo->mBodyRegion;
}
-void LLTexLayerSet::requestUpdate()
-{
- if( mUpdatesEnabled )
- {
- createComposite();
- mComposite->requestUpdate();
- }
-}
-
-void LLTexLayerSet::requestUpload()
-{
- createComposite();
- mComposite->requestUpload();
-}
-
-void LLTexLayerSet::cancelUpload()
-{
- if(mComposite)
- {
- mComposite->cancelUpload();
- }
-}
-
-void LLTexLayerSet::createComposite()
-{
- if(!mComposite)
- {
- S32 width = mInfo->mWidth;
- S32 height = mInfo->mHeight;
- // Composite other avatars at reduced resolution
- if( !mAvatar->isSelf() )
- {
- llerrs << "composites should not be created for non-self avatars!" << llendl;
- }
- mComposite = new LLTexLayerSetBuffer( this, width, height );
- }
-}
-
-void LLTexLayerSet::destroyComposite()
-{
- if( mComposite )
- {
- mComposite = NULL;
- }
-}
-
-void LLTexLayerSet::setUpdatesEnabled( BOOL b )
-{
- mUpdatesEnabled = b;
-}
-
-
-void LLTexLayerSet::updateComposite()
-{
- createComposite();
- mComposite->requestUpdateImmediate();
-}
-
-LLTexLayerSetBuffer* LLTexLayerSet::getComposite()
-{
- if (!mComposite)
- {
- createComposite();
- }
- return mComposite;
-}
-
-const LLTexLayerSetBuffer* LLTexLayerSet::getComposite() const
-{
- return mComposite;
-}
-
-void LLTexLayerSet::gatherMorphMaskAlpha(U8 *data, S32 width, S32 height)
-{
- memset(data, 255, width * height);
-
- for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
- {
- LLTexLayerInterface* layer = *iter;
- layer->gatherAlphaMasks(data, mComposite->getOriginX(),mComposite->getOriginY(), width, height);
- }
-
- // Set alpha back to that of our alpha masks.
- renderAlphaMaskTextures(mComposite->getOriginX(), mComposite->getOriginY(), width, height, true);
-}
void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, bool forceClear)
{
@@ -1119,7 +395,7 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height,
{
gGL.flush();
{
- LLViewerTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(info->mStaticAlphaFileName, TRUE);
+ LLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(info->mStaticAlphaFileName, TRUE);
if( tex )
{
LLGLSUIDefault gls_ui;
@@ -1176,7 +452,7 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height,
void LLTexLayerSet::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components)
{
- mAvatar->applyMorphMask(tex_data, width, height, num_components, mBakedTexIndex);
+ mAvatarAppearance->applyMorphMask(tex_data, width, height, num_components, mBakedTexIndex);
}
BOOL LLTexLayerSet::isMorphValid() const
@@ -1291,11 +567,11 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node)
/* if ("upper_shirt" == local_texture_name)
mLocalTexture = TEX_UPPER_SHIRT; */
mLocalTexture = TEX_NUM_INDICES;
- for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
- iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
+ iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
iter++)
{
- const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second;
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
if (local_texture_name == texture_dict->mName)
{
mLocalTexture = iter->first;
@@ -1362,7 +638,7 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node)
return TRUE;
}
-BOOL LLTexLayerInfo::createVisualParams(LLVOAvatar *avatar)
+BOOL LLTexLayerInfo::createVisualParams(LLAvatarAppearance *appearance)
{
BOOL success = TRUE;
for (param_color_info_list_t::iterator color_info_iter = mParamColorInfoList.begin();
@@ -1370,7 +646,7 @@ BOOL LLTexLayerInfo::createVisualParams(LLVOAvatar *avatar)
color_info_iter++)
{
LLTexLayerParamColorInfo * color_info = *color_info_iter;
- LLTexLayerParamColor* param_color = new LLTexLayerParamColor(avatar);
+ LLTexLayerParamColor* param_color = new LLTexLayerParamColor(appearance);
if (!param_color->setInfo(color_info, TRUE))
{
llwarns << "NULL TexLayer Color Param could not be added to visual param list. Deleting." << llendl;
@@ -1384,7 +660,7 @@ BOOL LLTexLayerInfo::createVisualParams(LLVOAvatar *avatar)
alpha_info_iter++)
{
LLTexLayerParamAlphaInfo * alpha_info = *alpha_info_iter;
- LLTexLayerParamAlpha* param_alpha = new LLTexLayerParamAlpha(avatar);
+ LLTexLayerParamAlpha* param_alpha = new LLTexLayerParamAlpha(appearance);
if (!param_alpha->setInfo(alpha_info, TRUE))
{
llwarns << "NULL TexLayer Alpha Param could not be added to visual param list. Deleting." << llendl;
@@ -1631,17 +907,21 @@ void LLTexLayer::calculateTexLayerColor(const param_color_list_t &param_list, LL
BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height)
{
LLGLEnable color_mat(GL_COLOR_MATERIAL);
- gPipeline.disableLights();
+ // *TODO: Is this correct?
+ //gPipeline.disableLights();
+ stop_glerror();
+ glDisable(GL_LIGHTING);
+ stop_glerror();
bool use_shaders = LLGLSLShader::sNoFixedFunction;
LLColor4 net_color;
BOOL color_specified = findNetColor(&net_color);
- if (mTexLayerSet->getAvatar()->mIsDummy)
+ if (mTexLayerSet->getAvatarAppearance()->mIsDummy)
{
color_specified = true;
- net_color = LLVOAvatar::getDummyColor();
+ net_color = LLAvatarAppearance::getDummyColor();
}
BOOL success = TRUE;
@@ -1698,7 +978,7 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height)
if( (getInfo()->mLocalTexture != -1) && !getInfo()->mUseLocalTextureAlphaOnly )
{
{
- LLViewerTexture* tex = NULL;
+ LLTexture* tex = NULL;
if (mLocalTextureObject && mLocalTextureObject->getImage())
{
tex = mLocalTextureObject->getImage();
@@ -1711,7 +991,7 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height)
{
llinfos << "lto not defined or image not defined: " << getInfo()->getLocalTexture() << " lto: " << mLocalTextureObject << llendl;
}
-// if( mTexLayerSet->getAvatar()->getLocalTextureGL((ETextureIndex)getInfo()->mLocalTexture, &image_gl ) )
+// if( mTexLayerSet->getAvatarAppearance()->getLocalTextureGL((ETextureIndex)getInfo()->mLocalTexture, &image_gl ) )
{
if( tex )
{
@@ -1748,7 +1028,7 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height)
if( !getInfo()->mStaticImageFileName.empty() )
{
{
- LLViewerTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask);
+ LLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask);
if( tex )
{
gGL.getTexUnit(0)->bind(tex, TRUE);
@@ -1828,7 +1108,7 @@ BOOL LLTexLayer::findNetColor(LLColor4* net_color) const
{
if( !getGlobalColor().empty() )
{
- net_color->setVec( mTexLayerSet->getAvatar()->getGlobalColor( getInfo()->mGlobalColor ) );
+ net_color->setVec( mTexLayerSet->getAvatarAppearance()->getGlobalColor( getInfo()->mGlobalColor ) );
}
else if (getInfo()->mFixedColor.mV[VW])
{
@@ -1845,7 +1125,7 @@ BOOL LLTexLayer::findNetColor(LLColor4* net_color) const
if( !getGlobalColor().empty() )
{
- net_color->setVec( mTexLayerSet->getAvatar()->getGlobalColor( getGlobalColor() ) );
+ net_color->setVec( mTexLayerSet->getAvatarAppearance()->getGlobalColor( getGlobalColor() ) );
return TRUE;
}
@@ -1870,7 +1150,7 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height)
if( !getInfo()->mStaticImageFileName.empty() )
{
- LLViewerTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture( getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask );
+ LLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture( getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask );
if( tex )
{
LLGLSNoAlphaTest gls_no_alpha_test;
@@ -1895,7 +1175,7 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height)
{
if (getInfo()->mLocalTexture >=0 && getInfo()->mLocalTexture < TEX_NUM_INDICES)
{
- LLViewerTexture* tex = mLocalTextureObject->getImage();
+ LLTexture* tex = mLocalTextureObject->getImage();
if (tex)
{
LLGLSNoAlphaTest gls_no_alpha_test;
@@ -1969,7 +1249,7 @@ BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
// Accumulate the alpha component of the texture
if( getInfo()->mLocalTexture != -1 )
{
- LLViewerTexture* tex = mLocalTextureObject->getImage();
+ LLTexture* tex = mLocalTextureObject->getImage();
if( tex && (tex->getComponents() == 4) )
{
LLGLSNoAlphaTest gls_no_alpha_test;
@@ -1987,7 +1267,7 @@ BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
if( !getInfo()->mStaticImageFileName.empty() )
{
- LLViewerTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask);
+ LLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask);
if( tex )
{
if( (tex->getComponents() == 4) ||
@@ -2038,7 +1318,7 @@ BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
if (!alpha_data)
{
// clear out a slot if we have filled our cache
- S32 max_cache_entries = getTexLayerSet()->getAvatar()->isSelf() ? 4 : 1;
+ S32 max_cache_entries = getTexLayerSet()->getAvatarAppearance()->isSelf() ? 4 : 1;
while ((S32)mAlphaCache.size() >= max_cache_entries)
{
alpha_cache_t::iterator iter2 = mAlphaCache.begin(); // arbitrarily grab the first entry
@@ -2051,7 +1331,7 @@ BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
glReadPixels(x, y, width, height, GL_ALPHA, GL_UNSIGNED_BYTE, alpha_data);
}
- getTexLayerSet()->getAvatar()->dirtyMesh();
+ getTexLayerSet()->getAvatarAppearance()->dirtyMesh();
mMorphMasksValid = TRUE;
getTexLayerSet()->applyMorphMask(alpha_data, width, height, 1);
@@ -2104,7 +1384,7 @@ LLUUID LLTexLayer::getUUID() const
LLUUID uuid;
if( getInfo()->mLocalTexture != -1 )
{
- LLViewerTexture* tex = mLocalTextureObject->getImage();
+ LLTexture* tex = mLocalTextureObject->getImage();
if (tex)
{
uuid = mLocalTextureObject->getID();
@@ -2112,7 +1392,7 @@ LLUUID LLTexLayer::getUUID() const
}
if( !getInfo()->mStaticImageFileName.empty() )
{
- LLViewerTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask);
+ LLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask);
if( tex )
{
uuid = tex->getID();
@@ -2135,13 +1415,15 @@ LLUUID LLTexLayer::getUUID() const
// * a texture entry index (TE)
// * (optional) one or more alpha parameters (weighted alpha textures)
//-----------------------------------------------------------------------------
-LLTexLayerTemplate::LLTexLayerTemplate(LLTexLayerSet* layer_set) :
- LLTexLayerInterface(layer_set)
+LLTexLayerTemplate::LLTexLayerTemplate(LLTexLayerSet* layer_set, LLAvatarAppearance* const appearance) :
+ LLTexLayerInterface(layer_set),
+ mAvatarAppearance( appearance )
{
}
LLTexLayerTemplate::LLTexLayerTemplate(const LLTexLayerTemplate &layer) :
- LLTexLayerInterface(layer)
+ LLTexLayerInterface(layer),
+ mAvatarAppearance(layer.getAvatarAppearance())
{
}
@@ -2168,12 +1450,12 @@ U32 LLTexLayerTemplate::updateWearableCache() const
//this isn't a cloneable layer
return 0;
}
- LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te);
- U32 num_wearables = gAgentWearables.getWearableCount(wearable_type);
+ LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)te);
+ U32 num_wearables = getAvatarAppearance()->getWearableCount(wearable_type);
U32 added = 0;
for (U32 i = 0; i < num_wearables; i++)
{
- LLWearable* wearable = gAgentWearables.getWearable(wearable_type, i);
+ LLWearable* wearable = getAvatarAppearance()->getWearable(wearable_type, i);
if (!wearable)
{
continue;
@@ -2335,7 +1617,7 @@ LLTexLayerInterface* LLTexLayerSet::findLayerByName(const std::string& name)
return NULL;
}
-void LLTexLayerSet::cloneTemplates(LLLocalTextureObject *lto, LLVOAvatarDefines::ETextureIndex tex_index, LLWearable *wearable)
+void LLTexLayerSet::cloneTemplates(LLLocalTextureObject *lto, LLAvatarAppearanceDefines::ETextureIndex tex_index, LLWearable *wearable)
{
// initialize all texlayers with this texture type for this LTO
for( LLTexLayerSet::layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
@@ -2430,9 +1712,9 @@ LLImageTGA* LLTexLayerStaticImageList::getImageTGA(const std::string& file_name)
// Returns a GL Image (without a backing ImageRaw) that contains the decoded data from a tga file named file_name.
// Caches the result to speed identical subsequent requests.
-LLViewerTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name, BOOL is_mask)
+LLTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name, BOOL is_mask)
{
- LLPointer<LLViewerTexture> tex;
+ LLPointer<LLTexture> tex;
const char *namekey = mImageNames.addString(file_name);
texture_map_t::const_iterator iter = mStaticImageList.find(namekey);
@@ -2442,7 +1724,8 @@ LLViewerTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_n
}
else
{
- tex = LLViewerTextureManager::getLocalTexture( FALSE );
+ llassert(gTextureManagerBridgep);
+ tex = gTextureManagerBridgep->getLocalTexture( FALSE );
LLPointer<LLImageRaw> image_raw = new LLImageRaw;
if( loadImageRaw( file_name, image_raw ) )
{
@@ -2452,7 +1735,7 @@ LLViewerTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_n
// that once an image is a mask it's always a mask.
tex->setExplicitFormat( GL_ALPHA8, GL_ALPHA );
}
- tex->createGLTexture(0, image_raw, 0, TRUE, LLViewerTexture::LOCAL);
+ tex->createGLTexture(0, image_raw, 0, TRUE, LLTexture::LOCAL);
gGL.getTexUnit(0)->bind(tex);
tex->setAddressMode(LLTexUnit::TAM_CLAMP);
@@ -2486,23 +1769,3 @@ BOOL LLTexLayerStaticImageList::loadImageRaw(const std::string& file_name, LLIma
return success;
}
-const std::string LLTexLayerSetBuffer::dumpTextureInfo() const
-{
- if (!isAgentAvatarValid()) return "";
-
- const BOOL is_high_res = !mNeedsUpload;
- const U32 num_low_res = mNumLowresUploads;
- const U32 upload_time = (U32)mNeedsUploadTimer.getElapsedTimeF32();
- const std::string local_texture_info = gAgentAvatarp->debugDumpLocalTextureDataInfo(mTexLayerSet);
-
- std::string status = "CREATING ";
- if (!uploadNeeded()) status = "DONE ";
- if (uploadInProgress()) status = "UPLOADING";
-
- std::string text = llformat("[%s] [HiRes:%d LoRes:%d] [Elapsed:%d] %s",
- status.c_str(),
- is_high_res, num_low_res,
- upload_time,
- local_texture_info.c_str());
- return text;
-}
diff --git a/indra/newview/lltexlayer.h b/indra/llappearance/lltexlayer.h
index 4f43547dae..5a413e929f 100644
--- a/indra/newview/lltexlayer.h
+++ b/indra/llappearance/lltexlayer.h
@@ -28,19 +28,18 @@
#define LL_LLTEXLAYER_H
#include <deque>
-#include "lldynamictexture.h"
-#include "llvoavatardefines.h"
+#include "lltexture.h"
+#include "llframetimer.h"
+#include "llavatarappearancedefines.h"
#include "lltexlayerparams.h"
-class LLVOAvatar;
-class LLVOAvatarSelf;
+class LLAvatarAppearance;
class LLImageTGA;
class LLImageRaw;
class LLXmlTreeNode;
class LLTexLayerSet;
class LLTexLayerSetInfo;
class LLTexLayerInfo;
-class LLTexLayerSetBuffer;
class LLWearable;
class LLViewerVisualParam;
@@ -113,7 +112,7 @@ protected:
class LLTexLayerTemplate : public LLTexLayerInterface
{
public:
- LLTexLayerTemplate(LLTexLayerSet* const layer_set);
+ LLTexLayerTemplate(LLTexLayerSet* const layer_set, LLAvatarAppearance* const appearance);
LLTexLayerTemplate(const LLTexLayerTemplate &layer);
/*virtual*/ ~LLTexLayerTemplate();
/*virtual*/ BOOL render(S32 x, S32 y, S32 width, S32 height);
@@ -126,7 +125,9 @@ public:
protected:
U32 updateWearableCache() const;
LLTexLayer* getLayer(U32 i) const;
+ LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; }
private:
+ LLAvatarAppearance* const mAvatarAppearance; // note: backlink only; don't make this an LLPointer.
typedef std::vector<LLWearable*> wearable_cache_t;
mutable wearable_cache_t mWearableCache; // mutable b/c most get- require updating this cache
};
@@ -177,10 +178,9 @@ private:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerSet
{
- friend class LLTexLayerSetBuffer;
public:
- LLTexLayerSet(LLVOAvatarSelf* const avatar);
- ~LLTexLayerSet();
+ LLTexLayerSet(LLAvatarAppearance* const appearance);
+ virtual ~LLTexLayerSet();
const LLTexLayerSetInfo* getInfo() const { return mInfo; }
BOOL setInfo(const LLTexLayerSetInfo *info); // This sets mInfo and calls initialization functions
@@ -189,45 +189,30 @@ public:
void renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, bool forceClear = false);
BOOL isBodyRegion(const std::string& region) const;
- LLTexLayerSetBuffer* getComposite();
- const LLTexLayerSetBuffer* getComposite() const; // Do not create one if it doesn't exist.
- void requestUpdate();
- void requestUpload();
- void cancelUpload();
- void updateComposite();
- BOOL isLocalTextureDataAvailable() const;
- BOOL isLocalTextureDataFinal() const;
- void createComposite();
- void destroyComposite();
- void setUpdatesEnabled(BOOL b);
- BOOL getUpdatesEnabled() const { return mUpdatesEnabled; }
- void deleteCaches();
- void gatherMorphMaskAlpha(U8 *data, S32 width, S32 height);
void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components);
BOOL isMorphValid() const;
+ virtual void requestUpdate() = 0;
void invalidateMorphMasks();
+ void deleteCaches();
LLTexLayerInterface* findLayerByName(const std::string& name);
- void cloneTemplates(LLLocalTextureObject *lto, LLVOAvatarDefines::ETextureIndex tex_index, LLWearable* wearable);
+ void cloneTemplates(LLLocalTextureObject *lto, LLAvatarAppearanceDefines::ETextureIndex tex_index, LLWearable* wearable);
- LLVOAvatarSelf* getAvatar() const { return mAvatar; }
+ LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; }
const std::string getBodyRegionName() const;
- BOOL hasComposite() const { return (mComposite.notNull()); }
- LLVOAvatarDefines::EBakedTextureIndex getBakedTexIndex() { return mBakedTexIndex; }
- void setBakedTexIndex(LLVOAvatarDefines::EBakedTextureIndex index) { mBakedTexIndex = index; }
+ LLAvatarAppearanceDefines::EBakedTextureIndex getBakedTexIndex() { return mBakedTexIndex; }
+ void setBakedTexIndex(LLAvatarAppearanceDefines::EBakedTextureIndex index) { mBakedTexIndex = index; }
BOOL isVisible() const { return mIsVisible; }
static BOOL sHasCaches;
-private:
+protected:
typedef std::vector<LLTexLayerInterface *> layer_list_t;
layer_list_t mLayerList;
layer_list_t mMaskLayerList;
- LLPointer<LLTexLayerSetBuffer> mComposite;
- LLVOAvatarSelf* const mAvatar; // note: backlink only; don't make this an LLPointer.
- BOOL mUpdatesEnabled;
+ LLAvatarAppearance* const mAvatarAppearance; // note: backlink only; don't make this an LLPointer.
BOOL mIsVisible;
- LLVOAvatarDefines::EBakedTextureIndex mBakedTexIndex;
+ LLAvatarAppearanceDefines::EBakedTextureIndex mBakedTexIndex;
const LLTexLayerSetInfo* mInfo;
};
@@ -243,8 +228,10 @@ public:
LLTexLayerSetInfo();
~LLTexLayerSetInfo();
BOOL parseXml(LLXmlTreeNode* node);
- void createVisualParams(LLVOAvatar *avatar);
-private:
+ void createVisualParams(LLAvatarAppearance *appearance);
+ S32 getWidth() const { return mWidth; }
+ S32 getHeight() const { return mHeight; }
+protected:
std::string mBodyRegion;
S32 mWidth;
S32 mHeight;
@@ -255,85 +242,6 @@ private:
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// LLTexLayerSetBuffer
-//
-// The composite image that a LLTexLayerSet writes to. Each LLTexLayerSet has one.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLTexLayerSetBuffer : public LLViewerDynamicTexture
-{
- LOG_CLASS(LLTexLayerSetBuffer);
-
-public:
- LLTexLayerSetBuffer(LLTexLayerSet* const owner, S32 width, S32 height);
- virtual ~LLTexLayerSetBuffer();
-
-public:
- /*virtual*/ S8 getType() const;
- BOOL isInitialized(void) const;
- static void dumpTotalByteCount();
- const std::string dumpTextureInfo() const;
- virtual void restoreGLTexture();
- virtual void destroyGLTexture();
-protected:
- void pushProjection() const;
- void popProjection() const;
-private:
- LLTexLayerSet* const mTexLayerSet;
- static S32 sGLByteCount;
-
- //--------------------------------------------------------------------
- // Render
- //--------------------------------------------------------------------
-public:
- /*virtual*/ BOOL needsRender();
-protected:
- BOOL render(S32 x, S32 y, S32 width, S32 height);
- virtual void preRender(BOOL clear_depth);
- virtual void postRender(BOOL success);
- virtual BOOL render();
-
- //--------------------------------------------------------------------
- // Uploads
- //--------------------------------------------------------------------
-public:
- void requestUpload();
- void cancelUpload();
- BOOL uploadNeeded() const; // We need to upload a new texture
- BOOL uploadInProgress() const; // We have started uploading a new texture and are awaiting the result
- BOOL uploadPending() const; // We are expecting a new texture to be uploaded at some point
- static void onTextureUploadComplete(const LLUUID& uuid,
- void* userdata,
- S32 result, LLExtStat ext_status);
-protected:
- BOOL isReadyToUpload() const;
- void doUpload(); // Does a read back and upload.
- void conditionalRestartUploadTimer();
-private:
- BOOL mNeedsUpload; // Whether we need to send our baked textures to the server
- U32 mNumLowresUploads; // Number of times we've sent a lowres version of our baked textures to the server
- BOOL mUploadPending; // Whether we have received back the new baked textures
- LLUUID mUploadID; // The current upload process (null if none).
- LLFrameTimer mNeedsUploadTimer; // Tracks time since upload was requested and performed.
- S32 mUploadFailCount; // Number of consecutive upload failures
- LLFrameTimer mUploadRetryTimer; // Tracks time since last upload failure.
-
- //--------------------------------------------------------------------
- // Updates
- //--------------------------------------------------------------------
-public:
- void requestUpdate();
- BOOL requestUpdateImmediate();
-protected:
- BOOL isReadyToUpdate() const;
- void doUpdate();
- void restartUpdateTimer();
-private:
- BOOL mNeedsUpdate; // Whether we need to locally update our baked textures
- U32 mNumLowresUpdates; // Number of times we've locally updated with lowres version of our baked textures
- LLFrameTimer mNeedsUpdateTimer; // Tracks time since update was requested and performed.
-};
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayerStaticImageList
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -342,7 +250,7 @@ class LLTexLayerStaticImageList : public LLSingleton<LLTexLayerStaticImageList>
public:
LLTexLayerStaticImageList();
~LLTexLayerStaticImageList();
- LLViewerTexture* getTexture(const std::string& file_name, BOOL is_mask);
+ LLTexture* getTexture(const std::string& file_name, BOOL is_mask);
LLImageTGA* getImageTGA(const std::string& file_name);
void deleteCachedImages();
void dumpByteCount() const;
@@ -350,7 +258,7 @@ protected:
BOOL loadImageRaw(const std::string& file_name, LLImageRaw* image_raw);
private:
LLStringTable mImageNames;
- typedef std::map<const char*, LLPointer<LLViewerTexture> > texture_map_t;
+ typedef std::map<const char*, LLPointer<LLTexture> > texture_map_t;
texture_map_t mStaticImageList;
typedef std::map<const char*, LLPointer<LLImageTGA> > image_tga_map_t;
image_tga_map_t mStaticImageListTGA;
@@ -358,23 +266,4 @@ private:
S32 mTGABytes;
};
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// LLBakedUploadData
-//
-// Used by LLTexLayerSetBuffer for a callback.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-struct LLBakedUploadData
-{
- LLBakedUploadData(const LLVOAvatarSelf* avatar,
- LLTexLayerSet* layerset,
- const LLUUID& id,
- bool highest_res);
- ~LLBakedUploadData() {}
- const LLUUID mID;
- const LLVOAvatarSelf* mAvatar; // note: backlink only; don't LLPointer
- LLTexLayerSet* mTexLayerSet;
- const U64 mStartTime; // for measuring baked texture upload time
- const bool mIsHighestRes; // whether this is a "final" bake, or intermediate low res
-};
-
#endif // LL_LLTEXLAYER_H
diff --git a/indra/newview/lltexlayerparams.cpp b/indra/llappearance/lltexlayerparams.cpp
index 8972827eff..4f0456f315 100644
--- a/indra/newview/lltexlayerparams.cpp
+++ b/indra/llappearance/lltexlayerparams.cpp
@@ -24,14 +24,15 @@
* $/LicenseInfo$
*/
-#include "llviewerprecompiledheaders.h"
+#include "linden_common.h"
#include "lltexlayerparams.h"
-#include "llagentcamera.h"
+#include "llavatarappearance.h"
#include "llimagetga.h"
+#include "llquantize.h"
#include "lltexlayer.h"
-#include "llvoavatarself.h"
+#include "lltexturemanagerbridge.h"
#include "llwearable.h"
#include "llui.h"
@@ -40,11 +41,11 @@
//-----------------------------------------------------------------------------
LLTexLayerParam::LLTexLayerParam(LLTexLayerInterface *layer) :
mTexLayer(layer),
- mAvatar(NULL)
+ mAvatarAppearance(NULL)
{
if (mTexLayer != NULL)
{
- mAvatar = mTexLayer->getTexLayerSet()->getAvatar();
+ mAvatarAppearance = mTexLayer->getTexLayerSet()->getAvatarAppearance();
}
else
{
@@ -52,20 +53,20 @@ LLTexLayerParam::LLTexLayerParam(LLTexLayerInterface *layer) :
}
}
-LLTexLayerParam::LLTexLayerParam(LLVOAvatar *avatar) :
- mTexLayer(NULL)
+LLTexLayerParam::LLTexLayerParam(LLAvatarAppearance *appearance) :
+ mTexLayer(NULL),
+ mAvatarAppearance(appearance)
{
- mAvatar = avatar;
}
-BOOL LLTexLayerParam::setInfo(LLViewerVisualParamInfo *info, BOOL add_to_avatar )
-{
+BOOL LLTexLayerParam::setInfo(LLViewerVisualParamInfo *info, BOOL add_to_appearance)
+{
LLViewerVisualParam::setInfo(info);
- if (add_to_avatar)
+ if (add_to_appearance)
{
- mAvatar->addVisualParam( this);
+ mAvatarAppearance->addVisualParam( this);
}
return TRUE;
@@ -96,7 +97,7 @@ void LLTexLayerParamAlpha::getCacheByteCount(S32* gl_bytes)
iter != sInstances.end(); iter++)
{
LLTexLayerParamAlpha* instance = *iter;
- LLViewerTexture* tex = instance->mCachedProcessedTexture;
+ LLTexture* tex = instance->mCachedProcessedTexture;
if (tex)
{
S32 bytes = (S32)tex->getWidth() * tex->getHeight() * tex->getComponents();
@@ -120,8 +121,8 @@ LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLTexLayerInterface* layer) :
sInstances.push_front(this);
}
-LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLVOAvatar* avatar) :
- LLTexLayerParam(avatar),
+LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLAvatarAppearance* appearance) :
+ LLTexLayerParam(appearance),
mCachedProcessedTexture(NULL),
mNeedsCreateTexture(FALSE),
mStaticImageInvalid(FALSE),
@@ -173,13 +174,13 @@ void LLTexLayerParamAlpha::setWeight(F32 weight, BOOL upload_bake)
{
mCurWeight = new_weight;
- if ((mAvatar->getSex() & getSex()) && (mAvatar->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
+ if ((mAvatarAppearance->getSex() & getSex()) && (mAvatarAppearance->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
{
- if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures())
+ if (!mAvatarAppearance->isUsingBakedTextures())
{
upload_bake = FALSE;
}
- mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
+ mAvatarAppearance->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
mTexLayer->invalidateMorphMasks();
}
}
@@ -218,11 +219,11 @@ BOOL LLTexLayerParamAlpha::getSkip() const
return TRUE;
}
- const LLVOAvatar *avatar = mTexLayer->getTexLayerSet()->getAvatar();
+ const LLAvatarAppearance *appearance = mTexLayer->getTexLayerSet()->getAvatarAppearance();
if (((LLTexLayerParamAlphaInfo *)getInfo())->mSkipIfZeroWeight)
{
- F32 effective_weight = (avatar->getSex() & getSex()) ? mCurWeight : getDefaultWeight();
+ F32 effective_weight = (appearance->getSex() & getSex()) ? mCurWeight : getDefaultWeight();
if (is_approx_zero(effective_weight))
{
return TRUE;
@@ -230,7 +231,7 @@ BOOL LLTexLayerParamAlpha::getSkip() const
}
LLWearableType::EType type = (LLWearableType::EType)getWearableType();
- if ((type != LLWearableType::WT_INVALID) && !avatar->isWearingWearableType(type))
+ if ((type != LLWearableType::WT_INVALID) && !appearance->isWearingWearableType(type))
{
return TRUE;
}
@@ -248,7 +249,7 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
return success;
}
- F32 effective_weight = (mTexLayer->getTexLayerSet()->getAvatar()->getSex() & getSex()) ? mCurWeight : getDefaultWeight();
+ F32 effective_weight = (mTexLayer->getTexLayerSet()->getAvatarAppearance()->getSex() & getSex()) ? mCurWeight : getDefaultWeight();
BOOL weight_changed = effective_weight != mCachedEffectiveWeight;
if (getSkip())
{
@@ -295,7 +296,8 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
if (!mCachedProcessedTexture)
{
- mCachedProcessedTexture = LLViewerTextureManager::getLocalTexture(image_tga_width, image_tga_height, 1, FALSE);
+ llassert(gTextureManagerBridgep);
+ mCachedProcessedTexture = gTextureManagerBridgep->getLocalTexture(image_tga_width, image_tga_height, 1, FALSE);
// We now have something in one of our caches
LLTexLayerSet::sHasCaches |= mCachedProcessedTexture ? TRUE : FALSE;
@@ -332,7 +334,7 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
// Don't keep the cache for other people's avatars
// (It's not really a "cache" in that case, but the logic is the same)
- if (!mAvatar->isSelf())
+ if (!mAvatarAppearance->isSelf())
{
mCachedProcessedTexture = NULL;
}
@@ -402,8 +404,8 @@ LLTexLayerParamColor::LLTexLayerParamColor(LLTexLayerInterface* layer) :
{
}
-LLTexLayerParamColor::LLTexLayerParamColor(LLVOAvatar *avatar) :
- LLTexLayerParam(avatar),
+LLTexLayerParamColor::LLTexLayerParamColor(LLAvatarAppearance *appearance) :
+ LLTexLayerParam(appearance),
mAvgDistortionVec(1.f, 1.f, 1.f)
{
}
@@ -425,7 +427,7 @@ LLColor4 LLTexLayerParamColor::getNetColor() const
llassert(info->mNumColors >= 1);
- F32 effective_weight = (mAvatar && (mAvatar->getSex() & getSex())) ? mCurWeight : getDefaultWeight();
+ F32 effective_weight = (mAvatarAppearance && (mAvatarAppearance->getSex() & getSex())) ? mCurWeight : getDefaultWeight();
S32 index_last = info->mNumColors - 1;
F32 scaled_weight = effective_weight * index_last;
@@ -470,12 +472,12 @@ void LLTexLayerParamColor::setWeight(F32 weight, BOOL upload_bake)
return;
}
- if ((mAvatar->getSex() & getSex()) && (mAvatar->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
+ if ((mAvatarAppearance->getSex() & getSex()) && (mAvatarAppearance->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
{
onGlobalColorChanged(upload_bake);
if (mTexLayer)
{
- mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
+ mAvatarAppearance->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
}
}
diff --git a/indra/newview/lltexlayerparams.h b/indra/llappearance/lltexlayerparams.h
index 2c0da60b48..dbffd15751 100644
--- a/indra/newview/lltexlayerparams.h
+++ b/indra/llappearance/lltexlayerparams.h
@@ -27,14 +27,16 @@
#ifndef LL_LLTEXLAYERPARAMS_H
#define LL_LLTEXLAYERPARAMS_H
+#include "llpointer.h"
+#include "v4color.h"
#include "llviewervisualparam.h"
+class LLAvatarAppearance;
class LLImageRaw;
class LLImageTGA;
class LLTexLayer;
class LLTexLayerInterface;
-class LLViewerTexture;
-class LLVOAvatar;
+class LLTexture;
class LLWearable;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -45,13 +47,13 @@ class LLTexLayerParam : public LLViewerVisualParam
{
public:
LLTexLayerParam(LLTexLayerInterface *layer);
- LLTexLayerParam(LLVOAvatar *avatar);
- /*virtual*/ BOOL setInfo(LLViewerVisualParamInfo *info, BOOL add_to_avatar );
+ LLTexLayerParam(LLAvatarAppearance *appearance);
+ /*virtual*/ BOOL setInfo(LLViewerVisualParamInfo *info, BOOL add_to_appearance);
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const = 0;
protected:
LLTexLayerInterface* mTexLayer;
- LLVOAvatar* mAvatar;
+ LLAvatarAppearance* mAvatarAppearance;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -62,7 +64,7 @@ class LLTexLayerParamAlpha : public LLTexLayerParam
{
public:
LLTexLayerParamAlpha( LLTexLayerInterface* layer );
- LLTexLayerParamAlpha( LLVOAvatar* avatar );
+ LLTexLayerParamAlpha( LLAvatarAppearance* appearance );
/*virtual*/ ~LLTexLayerParamAlpha();
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const;
@@ -89,7 +91,7 @@ public:
BOOL getMultiplyBlend() const;
private:
- LLPointer<LLViewerTexture> mCachedProcessedTexture;
+ LLPointer<LLTexture> mCachedProcessedTexture;
LLPointer<LLImageTGA> mStaticImageTGA;
LLPointer<LLImageRaw> mStaticImageRaw;
BOOL mNeedsCreateTexture;
@@ -140,7 +142,7 @@ public:
};
LLTexLayerParamColor( LLTexLayerInterface* layer );
- LLTexLayerParamColor( LLVOAvatar* avatar );
+ LLTexLayerParamColor( LLAvatarAppearance* appearance );
/* virtual */ ~LLTexLayerParamColor();
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const;
diff --git a/indra/llappearance/lltexturemanagerbridge.cpp b/indra/llappearance/lltexturemanagerbridge.cpp
new file mode 100644
index 0000000000..33f2185e4f
--- /dev/null
+++ b/indra/llappearance/lltexturemanagerbridge.cpp
@@ -0,0 +1,32 @@
+ /**
+ * @file lltexturemanagerbridge.cpp
+ * @brief Defined a null texture manager bridge. Applications must provide their own bridge implementaton.
+ *
+ * $LicenseInfo:firstyear=2012&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "lltexturemanagerbridge.h"
+
+// Define a null texture manager bridge. Applications must provide their own bridge implementaton.
+LLTextureManagerBridge* gTextureManagerBridgep = NULL;
+
+
diff --git a/indra/llappearance/lltexturemanagerbridge.h b/indra/llappearance/lltexturemanagerbridge.h
new file mode 100644
index 0000000000..20f5d0fd3c
--- /dev/null
+++ b/indra/llappearance/lltexturemanagerbridge.h
@@ -0,0 +1,45 @@
+/**
+ * @file lltexturemanagerbridge.h
+ * @brief Bridge to an application-specific texture manager.
+ *
+ * $LicenseInfo:firstyear=2012&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_TEXTUREMANAGERBRIDGE_H
+#define LL_TEXTUREMANAGERBRIDGE_H
+
+#include "llpointer.h"
+#include "lltexture.h"
+
+// Abstract bridge interface
+class LLTextureManagerBridge
+{
+public:
+ virtual LLPointer<LLTexture> getLocalTexture(BOOL usemipmaps = TRUE, BOOL generate_gl_tex = TRUE) = 0;
+ virtual LLPointer<LLTexture> getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex = TRUE) = 0;
+ virtual LLTexture* getFetchedTexture(const LLUUID &image_id) = 0;
+};
+
+extern LLTextureManagerBridge* gTextureManagerBridgep;
+
+#endif // LL_TEXTUREMANAGERBRIDGE_H
+
diff --git a/indra/newview/llviewervisualparam.cpp b/indra/llappearance/llviewervisualparam.cpp
index f0cf9b7692..e1ddeeeff0 100644
--- a/indra/newview/llviewervisualparam.cpp
+++ b/indra/llappearance/llviewervisualparam.cpp
@@ -27,7 +27,8 @@
//-----------------------------------------------------------------------------
// Header Files
//-----------------------------------------------------------------------------
-#include "llviewerprecompiledheaders.h"
+//#include "llviewerprecompiledheaders.h"
+#include "linden_common.h"
#include "llviewervisualparam.h"
#include "llxmltree.h"
diff --git a/indra/newview/llviewervisualparam.h b/indra/llappearance/llviewervisualparam.h
index 3bc95cbfbf..3bc95cbfbf 100644
--- a/indra/newview/llviewervisualparam.h
+++ b/indra/llappearance/llviewervisualparam.h
diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp
new file mode 100644
index 0000000000..ea14c6320f
--- /dev/null
+++ b/indra/llappearance/llwearable.cpp
@@ -0,0 +1,474 @@
+/**
+ * @file llwearable.cpp
+ * @brief LLWearable class implementation
+ *
+ * $LicenseInfo:firstyear=2002&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "linden_common.h"
+
+#include "llavatarappearance.h"
+#include "lllocaltextureobject.h"
+#include "lltexlayer.h"
+#include "lltexturemanagerbridge.h"
+#include "llvisualparam.h"
+#include "llavatarappearancedefines.h"
+#include "llwearable.h"
+
+using namespace LLAvatarAppearanceDefines;
+
+// static
+S32 LLWearable::sCurrentDefinitionVersion = 1;
+
+// Private local functions
+static std::string terse_F32_to_string(F32 f);
+
+// virtual
+LLWearable::~LLWearable()
+{
+}
+
+const std::string& LLWearable::getTypeLabel() const
+{
+ return LLWearableType::getTypeLabel(mType);
+}
+
+const std::string& LLWearable::getTypeName() const
+{
+ return LLWearableType::getTypeName(mType);
+}
+
+LLAssetType::EType LLWearable::getAssetType() const
+{
+ return LLWearableType::getAssetType(mType);
+}
+
+// virtual
+BOOL LLWearable::exportFile(LLFILE* file) const
+{
+ // header and version
+ if( fprintf( file, "LLWearable version %d\n", mDefinitionVersion ) < 0 )
+ {
+ return FALSE;
+ }
+
+ // name
+ if( fprintf( file, "%s\n", mName.c_str() ) < 0 )
+ {
+ return FALSE;
+ }
+
+ // description
+ if( fprintf( file, "%s\n", mDescription.c_str() ) < 0 )
+ {
+ return FALSE;
+ }
+
+ // permissions
+ if( !mPermissions.exportFile( file ) )
+ {
+ return FALSE;
+ }
+
+ // sale info
+ if( !mSaleInfo.exportFile( file ) )
+ {
+ return FALSE;
+ }
+
+ // wearable type
+ S32 type = (S32)mType;
+ if( fprintf( file, "type %d\n", type ) < 0 )
+ {
+ return FALSE;
+ }
+
+ // parameters
+ S32 num_parameters = mVisualParamIndexMap.size();
+ if( fprintf( file, "parameters %d\n", num_parameters ) < 0 )
+ {
+ return FALSE;
+ }
+
+ for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin();
+ iter != mVisualParamIndexMap.end();
+ ++iter)
+ {
+ S32 param_id = iter->first;
+ const LLVisualParam* param = iter->second;
+ F32 param_weight = param->getWeight();
+ if( fprintf( file, "%d %s\n", param_id, terse_F32_to_string( param_weight ).c_str() ) < 0 )
+ {
+ return FALSE;
+ }
+ }
+
+ // texture entries
+ S32 num_textures = mTextureIDMap.size();
+ if( fprintf( file, "textures %d\n", num_textures ) < 0 )
+ {
+ return FALSE;
+ }
+
+ for (texture_id_map_t::const_iterator iter = mTextureIDMap.begin(); iter != mTextureIDMap.end(); ++iter)
+ {
+ S32 te = iter->first;
+ const LLUUID& image_id = iter->second;
+ if( fprintf( file, "%d %s\n", te, image_id.asString().c_str()) < 0 )
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+
+// virtual
+LLWearable::EImportResult LLWearable::importFile( LLFILE* file )
+{
+ // *NOTE: changing the type or size of this buffer will require
+ // changes in the fscanf() code below. You would be better off
+ // rewriting this to use streams and not require an open FILE.
+ char text_buffer[2048]; /* Flawfinder: ignore */
+ S32 fields_read = 0;
+
+ // read header and version
+ fields_read = fscanf( file, "LLWearable version %d\n", &mDefinitionVersion );
+ if( fields_read != 1 )
+ {
+ return LLWearable::BAD_HEADER;
+ }
+
+
+ // Temporary hack to allow wearables with definition version 24 to still load.
+ // This should only affect lindens and NDA'd testers who have saved wearables in 2.0
+ // the extra check for version == 24 can be removed before release, once internal testers
+ // have loaded these wearables again. See hack pt 2 at bottom of function to ensure that
+ // these wearables get re-saved with version definition 22.
+ if( mDefinitionVersion > LLWearable::sCurrentDefinitionVersion && mDefinitionVersion != 24 )
+ {
+ llwarns << "Wearable asset has newer version (" << mDefinitionVersion << ") than XML (" << LLWearable::sCurrentDefinitionVersion << ")" << llendl;
+ return LLWearable::FAILURE;
+ }
+
+ // name
+ int next_char = fgetc( file ); /* Flawfinder: ignore */
+ if( '\n' == next_char )
+ {
+ // no name
+ mName = "";
+ }
+ else
+ {
+ ungetc( next_char, file );
+ fields_read = fscanf( /* Flawfinder: ignore */
+ file,
+ "%2047[^\n]",
+ text_buffer);
+ if( (1 != fields_read) || (fgetc( file ) != '\n') ) /* Flawfinder: ignore */
+ {
+ llwarns << "Bad Wearable asset: early end of file" << llendl;
+ return LLWearable::FAILURE;
+ }
+ mName = text_buffer;
+ }
+
+ // description
+ next_char = fgetc( file ); /* Flawfinder: ignore */
+ if( '\n' == next_char )
+ {
+ // no description
+ mDescription = "";
+ }
+ else
+ {
+ ungetc( next_char, file );
+ fields_read = fscanf( /* Flawfinder: ignore */
+ file,
+ "%2047[^\n]",
+ text_buffer );
+ if( (1 != fields_read) || (fgetc( file ) != '\n') ) /* Flawfinder: ignore */
+ {
+ llwarns << "Bad Wearable asset: early end of file" << llendl;
+ return LLWearable::FAILURE;
+ }
+ mDescription = text_buffer;
+ }
+
+ // permissions
+ S32 perm_version;
+ fields_read = fscanf( file, " permissions %d\n", &perm_version );
+ if( (fields_read != 1) || (perm_version != 0) )
+ {
+ llwarns << "Bad Wearable asset: missing permissions" << llendl;
+ return LLWearable::FAILURE;
+ }
+ if( !mPermissions.importFile( file ) )
+ {
+ return LLWearable::FAILURE;
+ }
+
+ // sale info
+ S32 sale_info_version;
+ fields_read = fscanf( file, " sale_info %d\n", &sale_info_version );
+ if( (fields_read != 1) || (sale_info_version != 0) )
+ {
+ llwarns << "Bad Wearable asset: missing sale_info" << llendl;
+ return LLWearable::FAILURE;
+ }
+ // Sale info used to contain next owner perm. It is now in the
+ // permissions. Thus, we read that out, and fix legacy
+ // objects. It's possible this op would fail, but it should pick
+ // up the vast majority of the tasks.
+ BOOL has_perm_mask = FALSE;
+ U32 perm_mask = 0;
+ if( !mSaleInfo.importFile(file, has_perm_mask, perm_mask) )
+ {
+ return LLWearable::FAILURE;
+ }
+ if(has_perm_mask)
+ {
+ // fair use fix.
+ if(!(perm_mask & PERM_COPY))
+ {
+ perm_mask |= PERM_TRANSFER;
+ }
+ mPermissions.setMaskNext(perm_mask);
+ }
+
+ // wearable type
+ S32 type = -1;
+ fields_read = fscanf( file, "type %d\n", &type );
+ if( fields_read != 1 )
+ {
+ llwarns << "Bad Wearable asset: bad type" << llendl;
+ return LLWearable::FAILURE;
+ }
+ if( 0 <= type && type < LLWearableType::WT_COUNT )
+ {
+ setType((LLWearableType::EType)type);
+ }
+ else
+ {
+ mType = LLWearableType::WT_COUNT;
+ llwarns << "Bad Wearable asset: bad type #" << type << llendl;
+ return LLWearable::FAILURE;
+ }
+
+ // parameters header
+ S32 num_parameters = 0;
+ fields_read = fscanf( file, "parameters %d\n", &num_parameters );
+ if( fields_read != 1 )
+ {
+ llwarns << "Bad Wearable asset: missing parameters block" << llendl;
+ return LLWearable::FAILURE;
+ }
+
+ if( num_parameters != mVisualParamIndexMap.size() )
+ {
+ llwarns << "Wearable parameter mismatch. Reading in " << num_parameters << " from file, but created " << mVisualParamIndexMap.size() << " from avatar parameters. type: " << mType << llendl;
+ }
+
+ // parameters
+ S32 i;
+ for( i = 0; i < num_parameters; i++ )
+ {
+ S32 param_id = 0;
+ F32 param_weight = 0.f;
+ fields_read = fscanf( file, "%d %f\n", &param_id, &param_weight );
+ if( fields_read != 2 )
+ {
+ llwarns << "Bad Wearable asset: bad parameter, #" << i << llendl;
+ return LLWearable::FAILURE;
+ }
+ mSavedVisualParamMap[param_id] = param_weight;
+ }
+
+ // textures header
+ S32 num_textures = 0;
+ fields_read = fscanf( file, "textures %d\n", &num_textures);
+ if( fields_read != 1 )
+ {
+ llwarns << "Bad Wearable asset: missing textures block" << llendl;
+ return LLWearable::FAILURE;
+ }
+
+ // textures
+ mTextureIDMap.clear();
+ for( i = 0; i < num_textures; i++ )
+ {
+ S32 te = 0;
+ fields_read = fscanf( /* Flawfinder: ignore */
+ file,
+ "%d %2047s\n",
+ &te, text_buffer);
+ if( fields_read != 2 )
+ {
+ llwarns << "Bad Wearable asset: bad texture, #" << i << llendl;
+ return LLWearable::FAILURE;
+ }
+
+ if( !LLUUID::validate( text_buffer ) )
+ {
+ llwarns << "Bad Wearable asset: bad texture uuid: " << text_buffer << llendl;
+ return LLWearable::FAILURE;
+ }
+ LLUUID id = LLUUID(text_buffer);
+ mTextureIDMap[te] = id;
+ }
+
+ return LLWearable::SUCCESS;
+}
+
+
+void LLWearable::setType(LLWearableType::EType type)
+{
+ mType = type;
+ createVisualParams();
+}
+
+
+void LLWearable::addVisualParam(LLVisualParam *param)
+{
+ if( mVisualParamIndexMap[param->getID()] )
+ {
+ delete mVisualParamIndexMap[param->getID()];
+ }
+ param->setIsDummy(FALSE);
+ mVisualParamIndexMap[param->getID()] = param;
+ mSavedVisualParamMap[param->getID()] = param->getDefaultWeight();
+}
+
+
+void LLWearable::setVisualParamWeight(S32 param_index, F32 value, BOOL upload_bake)
+{
+ if( is_in_map(mVisualParamIndexMap, param_index ) )
+ {
+ LLVisualParam *wearable_param = mVisualParamIndexMap[param_index];
+ wearable_param->setWeight(value, upload_bake);
+ }
+ else
+ {
+ llerrs << "LLWearable::setVisualParam passed invalid parameter index: " << param_index << " for wearable type: " << this->getName() << llendl;
+ }
+}
+
+F32 LLWearable::getVisualParamWeight(S32 param_index) const
+{
+ if( is_in_map(mVisualParamIndexMap, param_index ) )
+ {
+ const LLVisualParam *wearable_param = mVisualParamIndexMap.find(param_index)->second;
+ return wearable_param->getWeight();
+ }
+ else
+ {
+ llwarns << "LLWerable::getVisualParam passed invalid parameter index: " << param_index << " for wearable type: " << this->getName() << llendl;
+ }
+ return (F32)-1.0;
+}
+
+LLVisualParam* LLWearable::getVisualParam(S32 index) const
+{
+ visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.find(index);
+ return (iter == mVisualParamIndexMap.end()) ? NULL : iter->second;
+}
+
+
+void LLWearable::getVisualParams(visual_param_vec_t &list)
+{
+ visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin();
+ visual_param_index_map_t::iterator end = mVisualParamIndexMap.end();
+
+ // add all visual params to the passed-in vector
+ for( ; iter != end; ++iter )
+ {
+ list.push_back(iter->second);
+ }
+}
+
+void LLWearable::animateParams(F32 delta, BOOL upload_bake)
+{
+ for(visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin();
+ iter != mVisualParamIndexMap.end();
+ ++iter)
+ {
+ LLVisualParam *param = (LLVisualParam*) iter->second;
+ param->animate(delta, upload_bake);
+ }
+}
+
+LLColor4 LLWearable::getClothesColor(S32 te) const
+{
+ LLColor4 color;
+ U32 param_name[3];
+ if( LLAvatarAppearance::teToColorParams( (LLAvatarAppearanceDefines::ETextureIndex)te, param_name ) )
+ {
+ for( U8 index = 0; index < 3; index++ )
+ {
+ color.mV[index] = getVisualParamWeight(param_name[index]);
+ }
+ }
+ return color;
+}
+
+void LLWearable::setClothesColor( S32 te, const LLColor4& new_color, BOOL upload_bake )
+{
+ U32 param_name[3];
+ if( LLAvatarAppearance::teToColorParams( (LLAvatarAppearanceDefines::ETextureIndex)te, param_name ) )
+ {
+ for( U8 index = 0; index < 3; index++ )
+ {
+ setVisualParamWeight(param_name[index], new_color.mV[index], upload_bake);
+ }
+ }
+}
+
+std::string terse_F32_to_string(F32 f)
+{
+ std::string r = llformat("%.2f", f);
+ S32 len = r.length();
+
+ // "1.20" -> "1.2"
+ // "24.00" -> "24."
+ while (len > 0 && ('0' == r[len - 1]))
+ {
+ r.erase(len-1, 1);
+ len--;
+ }
+ if ('.' == r[len - 1])
+ {
+ // "24." -> "24"
+ r.erase(len-1, 1);
+ }
+ else if (('-' == r[0]) && ('0' == r[1]))
+ {
+ // "-0.59" -> "-.59"
+ r.erase(1, 1);
+ }
+ else if ('0' == r[0])
+ {
+ // "0.59" -> ".59"
+ r.erase(0, 1);
+ }
+ return r;
+}
+
diff --git a/indra/newview/llwearable.h b/indra/llappearance/llwearable.h
index 3d8c53a755..8a99debac8 100644
--- a/indra/newview/llwearable.h
+++ b/indra/llappearance/llwearable.h
@@ -27,31 +27,22 @@
#ifndef LL_LLWEARABLE_H
#define LL_LLWEARABLE_H
-#include "lluuid.h"
-#include "llstring.h"
+#include "llextendedstatus.h"
#include "llpermissions.h"
#include "llsaleinfo.h"
-#include "llassetstorage.h"
#include "llwearabletype.h"
-#include "llfile.h"
#include "lllocaltextureobject.h"
-class LLViewerInventoryItem;
class LLVisualParam;
class LLTexGlobalColorInfo;
class LLTexGlobalColor;
+// Abstract class.
class LLWearable
{
- friend class LLWearableList;
-
//--------------------------------------------------------------------
// Constructors and destructors
//--------------------------------------------------------------------
-private:
- // Private constructors used by LLWearableList
- LLWearable(const LLTransactionID& transactionID);
- LLWearable(const LLAssetID& assetID);
public:
virtual ~LLWearable();
@@ -59,10 +50,7 @@ public:
// Accessors
//--------------------------------------------------------------------
public:
- const LLUUID& getItemID() const;
- const LLAssetID& getAssetID() const { return mAssetID; }
- const LLTransactionID& getTransactionID() const { return mTransactionID; }
- LLWearableType::EType getType() const { return mType; }
+ LLWearableType::EType getType() const { return mType; }
void setType(LLWearableType::EType type);
const std::string& getName() const { return mName; }
void setName(const std::string& name) { mName = name; }
@@ -81,36 +69,23 @@ public:
public:
typedef std::vector<LLVisualParam*> visual_param_vec_t;
- BOOL isDirty() const;
- BOOL isOldVersion() const;
-
- void writeToAvatar();
- void removeFromAvatar( BOOL upload_bake ) { LLWearable::removeFromAvatar( mType, upload_bake ); }
- static void removeFromAvatar( LLWearableType::EType type, BOOL upload_bake );
+ virtual void writeToAvatar() = 0;
- BOOL exportFile(LLFILE* file) const;
- BOOL importFile(LLFILE* file);
-
- void setParamsToDefaults();
- void setTexturesToDefaults();
+ enum EImportResult
+ {
+ FAILURE = 0,
+ SUCCESS,
+ BAD_HEADER
+ };
+ virtual BOOL exportFile(LLFILE* file) const;
+ virtual EImportResult importFile(LLFILE* file);
- void saveNewAsset() const;
- static void onSaveNewAssetComplete( const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status );
- void copyDataFrom(const LLWearable* src);
static void setCurrentDefinitionVersion( S32 version ) { LLWearable::sCurrentDefinitionVersion = version; }
- friend std::ostream& operator<<(std::ostream &s, const LLWearable &w);
- void setItemID(const LLUUID& item_id);
-
- LLLocalTextureObject* getLocalTextureObject(S32 index);
- const LLLocalTextureObject* getLocalTextureObject(S32 index) const;
- std::vector<LLLocalTextureObject*> getLocalTextureListSeq();
-
- void setLocalTextureObject(S32 index, LLLocalTextureObject &lto);
+ virtual LLLocalTextureObject* getLocalTextureObject(S32 index) = 0;
void addVisualParam(LLVisualParam *param);
- void setVisualParams();
void setVisualParamWeight(S32 index, F32 value, BOOL upload_bake);
F32 getVisualParamWeight(S32 index) const;
LLVisualParam* getVisualParam(S32 index) const;
@@ -120,27 +95,11 @@ public:
LLColor4 getClothesColor(S32 te) const;
void setClothesColor( S32 te, const LLColor4& new_color, BOOL upload_bake );
- void revertValues();
- void saveValues();
- void pullCrossWearableValues();
-
- BOOL isOnTop() const;
+ typedef std::map<S32, LLUUID> texture_id_map_t;
+ const texture_id_map_t& getTextureIDMap() const { return mTextureIDMap; }
- // Something happened that requires the wearable's label to be updated (e.g. worn/unworn).
- void setLabelUpdated() const;
-
- // the wearable was worn. make sure the name of the wearable object matches the LLViewerInventoryItem,
- // not the wearable asset itself.
- void refreshName();
-
-private:
- typedef std::map<S32, LLLocalTextureObject*> te_map_t;
- typedef std::map<S32, LLVisualParam *> visual_param_index_map_t;
-
- void createLayers(S32 te);
- void createVisualParams();
- void syncImages(te_map_t &src, te_map_t &dst);
- void destroyTextures();
+protected:
+ virtual void createVisualParams() = 0;
static S32 sCurrentDefinitionVersion; // Depends on the current state of the avatar_lad.xml.
S32 mDefinitionVersion; // Depends on the state of the avatar_lad.xml when this asset was created.
@@ -148,18 +107,16 @@ private:
std::string mDescription;
LLPermissions mPermissions;
LLSaleInfo mSaleInfo;
- LLAssetID mAssetID;
- LLTransactionID mTransactionID;
LLWearableType::EType mType;
typedef std::map<S32, F32> param_map_t;
param_map_t mSavedVisualParamMap; // last saved version of visual params
+ typedef std::map<S32, LLVisualParam *> visual_param_index_map_t;
visual_param_index_map_t mVisualParamIndexMap;
- te_map_t mTEMap; // maps TE to LocalTextureObject
- te_map_t mSavedTEMap; // last saved version of TEMap
- LLUUID mItemID; // ID of the inventory item in the agent's inventory
+ // *TODO: Lazy mutable. Find a better way?
+ mutable texture_id_map_t mTextureIDMap;
};
#endif // LL_LLWEARABLE_H
diff --git a/indra/newview/llwearabletype.cpp b/indra/llappearance/llwearabletype.cpp
index c090ab5c3d..009a3b631a 100644
--- a/indra/newview/llwearabletype.cpp
+++ b/indra/llappearance/llwearabletype.cpp
@@ -24,9 +24,10 @@
* $/LicenseInfo$
*/
-#include "llviewerprecompiledheaders.h"
+#include "linden_common.h"
+
#include "llwearabletype.h"
-#include "llinventoryfunctions.h"
+#include "llinventoryicon.h"
#include "lltrans.h"
struct WearableEntry : public LLDictionaryEntry
diff --git a/indra/newview/llwearabletype.h b/indra/llappearance/llwearabletype.h
index d633b4807e..d633b4807e 100644
--- a/indra/newview/llwearabletype.h
+++ b/indra/llappearance/llwearabletype.h
diff --git a/indra/llcharacter/CMakeLists.txt b/indra/llcharacter/CMakeLists.txt
index a1712699eb..e9704d5635 100644
--- a/indra/llcharacter/CMakeLists.txt
+++ b/indra/llcharacter/CMakeLists.txt
@@ -15,6 +15,7 @@ include_directories(
${LLMESSAGE_INCLUDE_DIRS}
${LLVFS_INCLUDE_DIRS}
${LLXML_INCLUDE_DIRS}
+ ${LLAPPEARANCE_INCLUDE_DIRS}
)
set(llcharacter_SOURCE_FILES
diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h
index 5c68cb46eb..cf21101e35 100644
--- a/indra/llrender/llglslshader.h
+++ b/indra/llrender/llglslshader.h
@@ -159,6 +159,8 @@ public:
extern LLGLSLShader gUIProgram;
//output vec4(color.rgb,color.a*tex0[tc0].a)
extern LLGLSLShader gSolidColorProgram;
+//Alpha mask shader (declared here so llappearance can access properly)
+extern LLGLSLShader gAlphaMaskProgram;
#endif
diff --git a/indra/llrender/lltexture.h b/indra/llrender/lltexture.h
index 569a65c2e0..a23aa72520 100644
--- a/indra/llrender/lltexture.h
+++ b/indra/llrender/lltexture.h
@@ -32,10 +32,12 @@
#ifndef LL_TEXTURE_H
#define LL_TEXTURE_H
+#include "llgltypes.h"
#include "llrefcount.h"
-class LLImageGL ;
-class LLTexUnit ;
+#include "llrender.h"
+
class LLFontGL ;
+class LLImageRaw ;
//
//this is an abstract class as the parent for the class LLViewerTexture
@@ -52,6 +54,39 @@ protected:
public:
LLTexture(){}
+ enum EBoostLevel
+ {
+ BOOST_NONE = 0,
+ BOOST_AVATAR_BAKED ,
+ BOOST_AVATAR ,
+ BOOST_CLOUDS ,
+ BOOST_SCULPTED ,
+
+ BOOST_HIGH = 10,
+ BOOST_BUMP ,
+ BOOST_TERRAIN , // has to be high priority for minimap / low detail
+ BOOST_SELECTED ,
+ BOOST_AVATAR_BAKED_SELF ,
+ BOOST_AVATAR_SELF , // needed for baking avatar
+ BOOST_SUPER_HIGH , //textures higher than this need to be downloaded at the required resolution without delay.
+ BOOST_HUD ,
+ BOOST_ICON ,
+ BOOST_UI ,
+ BOOST_PREVIEW ,
+ BOOST_MAP ,
+ BOOST_MAP_VISIBLE ,
+ BOOST_MAX_LEVEL,
+
+ //other texture Categories
+ LOCAL = BOOST_MAX_LEVEL,
+ AVATAR_SCRATCH_TEX,
+ DYNAMIC_TEX,
+ MEDIA,
+ ATLAS,
+ OTHER,
+ MAX_GL_IMAGE_CATEGORY
+ };
+
//
//interfaces to access LLViewerTexture
//
@@ -62,6 +97,13 @@ public:
virtual void setActive() = 0 ;
virtual S32 getWidth(S32 discard_level = -1) const = 0 ;
virtual S32 getHeight(S32 discard_level = -1) const = 0 ;
+ virtual BOOL hasGLTexture() const = 0;
+ virtual BOOL createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0, BOOL to_create = TRUE, S32 category = LLTexture::OTHER) = 0;
+ virtual void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, BOOL swap_bytes = FALSE) = 0;
+ virtual void setAddressMode(LLTexUnit::eTextureAddressMode mode) = 0;
+ virtual LLTexUnit::eTextureAddressMode getAddressMode(void) const = 0;
+ virtual S8 getComponents() const = 0;
+ virtual const LLUUID& getID() const = 0;
private:
//note: do not make this function public.
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 8c4b7b28c4..214071fa67 100755
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -44,6 +44,7 @@ include(LLLogin)
include(VisualLeakDetector)
include(GLOD)
include(CMakeCopyIfDifferent)
+include(LLAppearance)
if (NOT HAVOK_TPV)
# When using HAVOK_TPV, the library is precompiled, so no need for this
@@ -80,6 +81,7 @@ include_directories(
${LIBS_PREBUILD_DIR}/include/hunspell
${OPENAL_LIB_INCLUDE_DIRS}
${LIBS_PREBUILT_DIR}/include/collada/1.4
+ ${LLAPPEARANCE_INCLUDE_DIRS}
)
set(viewer_SOURCE_FILES
@@ -303,7 +305,6 @@ set(viewer_SOURCE_FILES
llinventorybridge.cpp
llinventoryfilter.cpp
llinventoryfunctions.cpp
- llinventoryicon.cpp
llinventoryitemslist.cpp
llinventorylistitem.cpp
llinventorymodel.cpp
@@ -317,7 +318,6 @@ set(viewer_SOURCE_FILES
lllistcontextmenu.cpp
lllistview.cpp
lllocalbitmaps.cpp
- lllocaltextureobject.cpp
lllocationhistory.cpp
lllocationinputctrl.cpp
lllogchat.cpp
@@ -496,9 +496,6 @@ set(viewer_SOURCE_FILES
llsyswellwindow.cpp
llteleporthistory.cpp
llteleporthistorystorage.cpp
- lltexglobalcolor.cpp
- lltexlayer.cpp
- lltexlayerparams.cpp
lltextureatlas.cpp
lltextureatlasmanager.cpp
lltexturecache.cpp
@@ -596,18 +593,18 @@ set(viewer_SOURCE_FILES
llviewershadermgr.cpp
llviewerstats.cpp
llviewerstatsrecorder.cpp
+ llviewertexlayer.cpp
llviewertexteditor.cpp
llviewertexture.cpp
llviewertextureanim.cpp
llviewertexturelist.cpp
llviewerthrottle.cpp
- llviewervisualparam.cpp
+ llviewerwearable.cpp
llviewerwindow.cpp
llviewerwindowlistener.cpp
llvlcomposition.cpp
llvlmanager.cpp
llvoavatar.cpp
- llvoavatardefines.cpp
llvoavatarself.cpp
llvocache.cpp
llvograss.cpp
@@ -628,10 +625,8 @@ set(viewer_SOURCE_FILES
llwatchdog.cpp
llwaterparammanager.cpp
llwaterparamset.cpp
- llwearable.cpp
llwearableitemslist.cpp
llwearablelist.cpp
- llwearabletype.cpp
llweb.cpp
llwebprofile.cpp
llwebsharing.cpp
@@ -879,7 +874,6 @@ set(viewer_HEADER_FILES
llinventorybridge.h
llinventoryfilter.h
llinventoryfunctions.h
- llinventoryicon.h
llinventoryitemslist.h
llinventorylistitem.h
llinventorymodel.h
@@ -894,7 +888,6 @@ set(viewer_HEADER_FILES
lllistcontextmenu.h
lllistview.h
lllocalbitmaps.h
- lllocaltextureobject.h
lllocationhistory.h
lllocationinputctrl.h
lllogchat.h
@@ -1064,9 +1057,6 @@ set(viewer_HEADER_FILES
lltable.h
llteleporthistory.h
llteleporthistorystorage.h
- lltexglobalcolor.h
- lltexlayer.h
- lltexlayerparams.h
lltextureatlas.h
lltextureatlasmanager.h
lltexturecache.h
@@ -1165,18 +1155,18 @@ set(viewer_HEADER_FILES
llviewershadermgr.h
llviewerstats.h
llviewerstatsrecorder.h
+ llviewertexlayer.h
llviewertexteditor.h
llviewertexture.h
llviewertextureanim.h
llviewertexturelist.h
llviewerthrottle.h
- llviewervisualparam.h
+ llviewerwearable.h
llviewerwindow.h
llviewerwindowlistener.h
llvlcomposition.h
llvlmanager.h
llvoavatar.h
- llvoavatardefines.h
llvoavatarself.h
llvocache.h
llvograss.h
@@ -1197,10 +1187,8 @@ set(viewer_HEADER_FILES
llwatchdog.h
llwaterparammanager.h
llwaterparamset.h
- llwearable.h
llwearableitemslist.h
llwearablelist.h
- llwearabletype.h
llweb.h
llwebprofile.h
llwebsharing.h
@@ -1837,6 +1825,7 @@ target_link_libraries(${VIEWER_BINARY_NAME}
${LLPHYSICS_LIBRARIES}
${LLPHYSICSEXTENSIONS_LIBRARIES}
${TCMALLOC_LIBRARIES}
+ ${LLAPPEARANCE_LIBRARIES}
)
if (USE_KDU)
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 2379c23969..4e05836bca 100755
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -92,7 +92,7 @@
#include "llworldmap.h"
#include "stringize.h"
-using namespace LLVOAvatarDefines;
+using namespace LLAvatarAppearanceDefines;
extern LLMenuBarGL* gMenuBarView;
@@ -3654,7 +3654,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
if ((S32)texture_index < TEX_NUM_INDICES )
{
- const LLVOAvatarDictionary::TextureEntry *texture_entry = LLVOAvatarDictionary::instance().getTexture((ETextureIndex)texture_index);
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_entry = LLAvatarAppearanceDictionary::instance().getTexture((ETextureIndex)texture_index);
if (texture_entry)
{
EBakedTextureIndex baked_index = texture_entry->mBakedTextureIndex;
@@ -4303,7 +4303,7 @@ void LLAgent::sendAgentSetAppearance()
for(U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++ )
{
- const ETextureIndex texture_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
+ const ETextureIndex texture_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
// if we're not wearing a skirt, we don't need the texture to be baked
if (texture_index == TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT))
@@ -4326,7 +4326,7 @@ void LLAgent::sendAgentSetAppearance()
for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
{
BOOL generate_valid_hash = TRUE;
- if (isAgentAvatarValid() && !gAgentAvatarp->isBakedTextureFinal((LLVOAvatarDefines::EBakedTextureIndex)baked_index))
+ if (isAgentAvatarValid() && !gAgentAvatarp->isBakedTextureFinal((LLAvatarAppearanceDefines::EBakedTextureIndex)baked_index))
{
generate_valid_hash = FALSE;
LL_DEBUGS("Avatar") << gAgentAvatarp->avString() << "Not caching baked texture upload for " << (U32)baked_index << " due to being uploaded at low resolution." << LL_ENDL;
@@ -4335,7 +4335,7 @@ void LLAgent::sendAgentSetAppearance()
const LLUUID hash = gAgentWearables.computeBakedTextureHash((EBakedTextureIndex) baked_index, generate_valid_hash);
if (hash.notNull())
{
- ETextureIndex texture_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex) baked_index);
+ ETextureIndex texture_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex) baked_index);
msg->nextBlockFast(_PREHASH_WearableData);
msg->addUUIDFast(_PREHASH_CacheID, hash);
msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index);
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 99904e118c..f784262e90 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -33,7 +33,7 @@
#include "llagentdata.h" // gAgentID, gAgentSessionID
#include "llcharacter.h"
#include "llcoordframe.h" // for mFrameAgent
-#include "llvoavatardefines.h"
+#include "llavatarappearancedefines.h"
#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
@@ -901,7 +901,7 @@ private:
S32 mNumPendingQueries;
S32 mWearablesCacheQueryID;
U32 mUpdateSerialNum;
- S32 mActiveCacheQueries[LLVOAvatarDefines::BAKED_NUM_INDICES];
+ S32 mActiveCacheQueries[LLAvatarAppearanceDefines::BAKED_NUM_INDICES];
};
extern LLAgentQueryManager gAgentQueryManager;
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index a544909e66..e1ef0d5399 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -49,7 +49,7 @@
#include "llwindow.h"
#include "llworld.h"
-using namespace LLVOAvatarDefines;
+using namespace LLAvatarAppearanceDefines;
extern LLMenuBarGL* gMenuBarView;
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 53a255fe92..08238e1aea 100755
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -47,7 +47,7 @@
#include "lltooldraganddrop.h"
#include "llviewerregion.h"
#include "llvoavatarself.h"
-#include "llwearable.h"
+#include "llviewerwearable.h"
#include "llwearablelist.h"
#include <boost/scoped_ptr.hpp>
@@ -56,7 +56,7 @@ LLAgentWearables gAgentWearables;
BOOL LLAgentWearables::mInitialWearablesUpdateReceived = FALSE;
-using namespace LLVOAvatarDefines;
+using namespace LLAvatarAppearanceDefines;
///////////////////////////////////////////////////////////////////////////////
@@ -82,7 +82,7 @@ class LLWearAndEditCallback : public LLInventoryCallback
// wearable type stored in asset is some other value.
// Calling this function whenever a wearable is added to increase visibility if this problem
// turns up in other inventories.
-void checkWearableAgainstInventory(LLWearable *wearable)
+void checkWearableAgainstInventory(LLViewerWearable *wearable)
{
if (wearable->getItemID().isNull())
return;
@@ -119,7 +119,7 @@ void LLAgentWearables::dump()
llinfos << "Type: " << i << " count " << count << llendl;
for (U32 j=0; j<count; j++)
{
- LLWearable* wearable = getWearable((LLWearableType::EType)i,j);
+ LLViewerWearable* wearable = getWearable((LLWearableType::EType)i,j);
if (wearable == NULL)
{
llinfos << " " << j << " NULL wearable" << llendl;
@@ -213,7 +213,7 @@ LLAgentWearables::sendAgentWearablesUpdateCallback::~sendAgentWearablesUpdateCal
* @param todo Bitmask of actions to take on completion.
*/
LLAgentWearables::addWearableToAgentInventoryCallback::addWearableToAgentInventoryCallback(
- LLPointer<LLRefCount> cb, LLWearableType::EType type, U32 index, LLWearable* wearable, U32 todo) :
+ LLPointer<LLRefCount> cb, LLWearableType::EType type, U32 index, LLViewerWearable* wearable, U32 todo) :
mType(type),
mIndex(index),
mWearable(wearable),
@@ -265,7 +265,7 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i
void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::EType type,
const U32 index,
const LLUUID& item_id,
- LLWearable* wearable)
+ LLViewerWearable* wearable)
{
llinfos << "type " << type << " index " << index << " item " << item_id.asString() << llendl;
@@ -312,7 +312,7 @@ void LLAgentWearables::sendAgentWearablesUpdate()
{
for (U32 index=0; index < getWearableCount((LLWearableType::EType)type); ++index)
{
- LLWearable* wearable = getWearable((LLWearableType::EType)type,index);
+ LLViewerWearable* wearable = getWearable((LLWearableType::EType)type,index);
if (wearable)
{
if (wearable->getItemID().isNull())
@@ -354,7 +354,7 @@ void LLAgentWearables::sendAgentWearablesUpdate()
U8 type_u8 = (U8)type;
gMessageSystem->addU8Fast(_PREHASH_WearableType, type_u8);
- LLWearable* wearable = getWearable((LLWearableType::EType)type, 0);
+ LLViewerWearable* wearable = getWearable((LLWearableType::EType)type, 0);
if (wearable)
{
//llinfos << "Sending wearable " << wearable->getName() << llendl;
@@ -382,14 +382,14 @@ void LLAgentWearables::sendAgentWearablesUpdate()
void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update,
const std::string new_name)
{
- LLWearable* old_wearable = getWearable(type, index);
+ LLViewerWearable* old_wearable = getWearable(type, index);
if(!old_wearable) return;
bool name_changed = !new_name.empty() && (new_name != old_wearable->getName());
if (name_changed || old_wearable->isDirty() || old_wearable->isOldVersion())
{
LLUUID old_item_id = old_wearable->getItemID();
- LLWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable);
- new_wearable->setItemID(old_item_id); // should this be in LLWearable::copyDataFrom()?
+ LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable);
+ new_wearable->setItemID(old_item_id); // should this be in LLViewerWearable::copyDataFrom()?
setWearable(type,index,new_wearable);
// old_wearable may still be referred to by other inventory items. Revert
@@ -465,7 +465,7 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
llwarns << "LLAgent::saveWearableAs() not copyable." << llendl;
return;
}
- LLWearable* old_wearable = getWearable(type, index);
+ LLViewerWearable* old_wearable = getWearable(type, index);
if (!old_wearable)
{
llwarns << "LLAgent::saveWearableAs() no old wearable." << llendl;
@@ -480,7 +480,7 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
}
std::string trunc_name(new_name);
LLStringUtil::truncate(trunc_name, DB_INV_ITEM_NAME_STR_LEN);
- LLWearable* new_wearable = LLWearableList::instance().createCopy(
+ LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(
old_wearable,
trunc_name);
LLPointer<LLInventoryCallback> cb =
@@ -518,7 +518,7 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
void LLAgentWearables::revertWearable(const LLWearableType::EType type, const U32 index)
{
- LLWearable* wearable = getWearable(type, index);
+ LLViewerWearable* wearable = getWearable(type, index);
llassert(wearable);
if (wearable)
{
@@ -553,13 +553,13 @@ void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string&
LLUUID curr_item_id = getWearableItemID((LLWearableType::EType)i,j);
if (curr_item_id == item_id)
{
- LLWearable* old_wearable = getWearable((LLWearableType::EType)i,j);
+ LLViewerWearable* old_wearable = getWearable((LLWearableType::EType)i,j);
llassert(old_wearable);
if (!old_wearable) continue;
std::string old_name = old_wearable->getName();
old_wearable->setName(new_name);
- LLWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable);
+ LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable);
new_wearable->setItemID(item_id);
LLInventoryItem* item = gInventory.getItem(item_id);
if (item)
@@ -640,14 +640,14 @@ LLInventoryItem* LLAgentWearables::getWearableInventoryItem(LLWearableType::ETyp
return item;
}
-const LLWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id) const
+const LLViewerWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id) const
{
const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
{
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
{
- const LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
+ const LLViewerWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
{
return curr_wearable;
@@ -657,14 +657,14 @@ const LLWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id)
return NULL;
}
-LLWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id)
+LLViewerWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id)
{
const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
{
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
{
- LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
+ LLViewerWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
{
return curr_wearable;
@@ -674,13 +674,13 @@ LLWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id)
return NULL;
}
-LLWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_id)
+LLViewerWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_id)
{
for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
{
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
{
- LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
+ LLViewerWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
if (curr_wearable && (curr_wearable->getAssetID() == asset_id))
{
return curr_wearable;
@@ -705,7 +705,7 @@ BOOL LLAgentWearables::selfHasWearable(LLWearableType::EType type)
return (gAgentWearables.getWearableCount(type) > 0);
}
-LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index)
+LLViewerWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index)
{
wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
if (wearable_iter == mWearableDatas.end())
@@ -723,10 +723,10 @@ LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32
}
}
-void LLAgentWearables::setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable)
+void LLAgentWearables::setWearable(const LLWearableType::EType type, U32 index, LLViewerWearable *wearable)
{
- LLWearable *old_wearable = getWearable(type,index);
+ LLViewerWearable *old_wearable = getWearable(type,index);
if (!old_wearable)
{
pushWearable(type,wearable);
@@ -753,7 +753,7 @@ void LLAgentWearables::setWearable(const LLWearableType::EType type, U32 index,
}
}
-U32 LLAgentWearables::pushWearable(const LLWearableType::EType type, LLWearable *wearable)
+U32 LLAgentWearables::pushWearable(const LLWearableType::EType type, LLViewerWearable *wearable)
{
if (wearable == NULL)
{
@@ -771,7 +771,7 @@ U32 LLAgentWearables::pushWearable(const LLWearableType::EType type, LLWearable
return MAX_CLOTHING_PER_TYPE;
}
-void LLAgentWearables::wearableUpdated(LLWearable *wearable)
+void LLAgentWearables::wearableUpdated(LLViewerWearable *wearable)
{
gAgentAvatarp->wearableUpdated(wearable->getType(), FALSE);
wearable->refreshName();
@@ -794,7 +794,7 @@ void LLAgentWearables::wearableUpdated(LLWearable *wearable)
}
-void LLAgentWearables::popWearable(LLWearable *wearable)
+void LLAgentWearables::popWearable(LLViewerWearable *wearable)
{
if (wearable == NULL)
{
@@ -813,7 +813,7 @@ void LLAgentWearables::popWearable(LLWearable *wearable)
void LLAgentWearables::popWearable(const LLWearableType::EType type, U32 index)
{
- LLWearable *wearable = getWearable(type, index);
+ LLViewerWearable *wearable = getWearable(type, index);
if (wearable)
{
mWearableDatas[type].erase(mWearableDatas[type].begin() + index);
@@ -825,7 +825,7 @@ void LLAgentWearables::popWearable(const LLWearableType::EType type, U32 index)
}
}
-U32 LLAgentWearables::getWearableIndex(const LLWearable *wearable) const
+U32 LLAgentWearables::getWearableIndex(const LLViewerWearable *wearable) const
{
if (wearable == NULL)
{
@@ -851,7 +851,7 @@ U32 LLAgentWearables::getWearableIndex(const LLWearable *wearable) const
return MAX_CLOTHING_PER_TYPE;
}
-const LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index) const
+const LLViewerWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index) const
{
wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
if (wearable_iter == mWearableDatas.end())
@@ -869,7 +869,7 @@ const LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type
}
}
-LLWearable* LLAgentWearables::getTopWearable(const LLWearableType::EType type)
+LLViewerWearable* LLAgentWearables::getTopWearable(const LLWearableType::EType type)
{
U32 count = getWearableCount(type);
if ( count == 0)
@@ -880,7 +880,7 @@ LLWearable* LLAgentWearables::getTopWearable(const LLWearableType::EType type)
return getWearable(type, count-1);
}
-LLWearable* LLAgentWearables::getBottomWearable(const LLWearableType::EType type)
+LLViewerWearable* LLAgentWearables::getBottomWearable(const LLWearableType::EType type)
{
if (getWearableCount(type) == 0)
{
@@ -903,7 +903,7 @@ U32 LLAgentWearables::getWearableCount(const LLWearableType::EType type) const
U32 LLAgentWearables::getWearableCount(const U32 tex_index) const
{
- const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType((LLVOAvatarDefines::ETextureIndex)tex_index);
+ const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType((LLAvatarAppearanceDefines::ETextureIndex)tex_index);
return getWearableCount(wearable_type);
}
@@ -920,7 +920,7 @@ U32 LLAgentWearables::itemUpdatePendingCount() const
const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32 index) const
{
- const LLWearable *wearable = getWearable(type,index);
+ const LLViewerWearable *wearable = getWearable(type,index);
if (wearable)
return wearable->getItemID();
else
@@ -929,7 +929,7 @@ const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32
const LLUUID LLAgentWearables::getWearableAssetID(LLWearableType::EType type, U32 index) const
{
- const LLWearable *wearable = getWearable(type,index);
+ const LLViewerWearable *wearable = getWearable(type,index);
if (wearable)
return wearable->getAssetID();
else
@@ -1012,7 +1012,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
gMessageSystem->getUUIDFast(_PREHASH_WearableData, _PREHASH_AssetID, asset_id, i);
if (asset_id.isNull())
{
- LLWearable::removeFromAvatar(type, FALSE);
+ LLViewerWearable::removeFromAvatar(type, FALSE);
}
else
{
@@ -1058,7 +1058,7 @@ void LLAgentWearables::recoverMissingWearable(const LLWearableType::EType type,
// Try to recover by replacing missing wearable with a new one.
LLNotificationsUtil::add("ReplacedMissingWearable");
lldebugs << "Wearable " << LLWearableType::getTypeLabel(type) << " could not be downloaded. Replaced inventory item with default wearable." << llendl;
- LLWearable* new_wearable = LLWearableList::instance().createNewWearable(type);
+ LLViewerWearable* new_wearable = LLWearableList::instance().createNewWearable(type);
setWearable(type,index,new_wearable);
//new_wearable->writeToAvatar(TRUE);
@@ -1093,9 +1093,9 @@ void LLAgentWearables::recoverMissingWearableDone()
}
}
-void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearable_type, const LLVOAvatarDefines::ETextureIndex texture_type, U32 wearable_index)
+void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index)
{
- LLWearable* wearable = getWearable((LLWearableType::EType)wearable_type, wearable_index);
+ LLViewerWearable* wearable = getWearable((LLWearableType::EType)wearable_type, wearable_index);
if (!wearable)
{
llerrs << "Tried to add local texture object to invalid wearable with type " << wearable_type << " and index " << wearable_index << llendl;
@@ -1128,7 +1128,7 @@ public:
mItemsToLink,
link_waiter);
}
- void addPendingWearable(LLWearable *wearable)
+ void addPendingWearable(LLViewerWearable *wearable)
{
if (!wearable)
{
@@ -1163,7 +1163,7 @@ public:
LLWearableType::EType type = item->getWearableType();
if (type < LLWearableType::WT_COUNT)
{
- LLWearable *wearable = mWearablesAwaitingItems[type];
+ LLViewerWearable *wearable = mWearablesAwaitingItems[type];
if (wearable)
wearable->setItemID(inv_item);
}
@@ -1176,7 +1176,7 @@ public:
private:
LLInventoryModel::item_array_t mItemsToLink;
- std::vector<LLWearable*> mWearablesAwaitingItems;
+ std::vector<LLViewerWearable*> mWearablesAwaitingItems;
};
void LLAgentWearables::createStandardWearables()
@@ -1208,7 +1208,7 @@ void LLAgentWearables::createStandardWearables()
if (create[i])
{
llassert(getWearableCount((LLWearableType::EType)i) == 0);
- LLWearable* wearable = LLWearableList::instance().createNewWearable((LLWearableType::EType)i);
+ LLViewerWearable* wearable = LLWearableList::instance().createNewWearable((LLWearableType::EType)i);
((OnWearableItemCreatedCB*)(&(*cb)))->addPendingWearable(wearable);
// no need to update here...
LLUUID category_id = LLUUID::null;
@@ -1267,7 +1267,7 @@ void LLAgentWearables::makeNewOutfitDone(S32 type, U32 index)
void LLAgentWearables::addWearableToAgentInventory(LLPointer<LLInventoryCallback> cb,
- LLWearable* wearable,
+ LLViewerWearable* wearable,
const LLUUID& category_id,
BOOL notify)
{
@@ -1305,7 +1305,7 @@ void LLAgentWearables::removeWearable(const LLWearableType::EType type, bool do_
}
else
{
- LLWearable* old_wearable = getWearable(type,index);
+ LLViewerWearable* old_wearable = getWearable(type,index);
if (old_wearable)
{
@@ -1363,7 +1363,7 @@ void LLAgentWearables::removeWearableFinal(const LLWearableType::EType type, boo
S32 max_entry = mWearableDatas[type].size()-1;
for (S32 i=max_entry; i>=0; i--)
{
- LLWearable* old_wearable = getWearable(type,i);
+ LLViewerWearable* old_wearable = getWearable(type,i);
//queryWearableCache(); // moved below
if (old_wearable)
{
@@ -1375,7 +1375,7 @@ void LLAgentWearables::removeWearableFinal(const LLWearableType::EType type, boo
}
else
{
- LLWearable* old_wearable = getWearable(type, index);
+ LLViewerWearable* old_wearable = getWearable(type, index);
//queryWearableCache(); // moved below
if (old_wearable)
@@ -1394,7 +1394,7 @@ void LLAgentWearables::removeWearableFinal(const LLWearableType::EType type, boo
// Assumes existing wearables are not dirty.
void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& items,
- const LLDynamicArray< LLWearable* >& wearables,
+ const LLDynamicArray< LLViewerWearable* >& wearables,
BOOL remove)
{
llinfos << "setWearableOutfit() start" << llendl;
@@ -1419,7 +1419,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
S32 i;
for (i = 0; i < count; i++)
{
- LLWearable* new_wearable = wearables[i];
+ LLViewerWearable* new_wearable = wearables[i];
LLPointer<LLInventoryItem> new_item = items[i];
llassert(new_wearable);
@@ -1476,7 +1476,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
// User has picked "wear on avatar" from a menu.
-void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLWearable* new_wearable, bool do_append)
+void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLViewerWearable* new_wearable, bool do_append)
{
//LLAgentDumper dumper("setWearableItem");
if (isWearingItem(new_item->getUUID()))
@@ -1491,7 +1491,7 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLWearable* ne
{
// Remove old wearable, if any
// MULTI_WEARABLE: hardwired to 0
- LLWearable* old_wearable = getWearable(type,0);
+ LLViewerWearable* old_wearable = getWearable(type,0);
if (old_wearable)
{
const LLUUID& old_item_id = old_wearable->getItemID();
@@ -1517,7 +1517,7 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLWearable* ne
}
// static
-bool LLAgentWearables::onSetWearableDialog(const LLSD& notification, const LLSD& response, LLWearable* wearable)
+bool LLAgentWearables::onSetWearableDialog(const LLSD& notification, const LLSD& response, LLViewerWearable* wearable)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
LLInventoryItem* new_item = gInventory.getItem(notification["payload"]["item_id"].asUUID());
@@ -1553,7 +1553,7 @@ bool LLAgentWearables::onSetWearableDialog(const LLSD& notification, const LLSD&
// Called from setWearableItem() and onSetWearableDialog() to actually set the wearable.
// MULTI_WEARABLE: unify code after null objects are gone.
-void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLWearable* new_wearable, bool do_append)
+void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLViewerWearable* new_wearable, bool do_append)
{
const LLWearableType::EType type = new_wearable->getType();
@@ -1570,7 +1570,7 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLWearable* n
// Replace the old wearable with a new one.
llassert(new_item->getAssetUUID() == new_wearable->getAssetID());
- LLWearable *old_wearable = getWearable(type,0);
+ LLViewerWearable *old_wearable = getWearable(type,0);
LLUUID old_item_id;
if (old_wearable)
{
@@ -1626,7 +1626,7 @@ void LLAgentWearables::queryWearableCache()
num_queries++;
// *NOTE: make sure at least one request gets packed
- ETextureIndex te_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
+ ETextureIndex te_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
//llinfos << "Requesting texture for hash " << hash << " in baked texture slot " << baked_index << llendl;
gMessageSystem->nextBlockFast(_PREHASH_WearableData);
@@ -1652,13 +1652,13 @@ void LLAgentWearables::queryWearableCache()
}
}
-LLUUID LLAgentWearables::computeBakedTextureHash(LLVOAvatarDefines::EBakedTextureIndex baked_index,
+LLUUID LLAgentWearables::computeBakedTextureHash(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index,
BOOL generate_valid_hash) // Set to false if you want to upload the baked texture w/o putting it in the cache
{
LLUUID hash_id;
bool hash_computed = false;
LLMD5 hash;
- const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index);
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index);
for (U8 i=0; i < baked_dict->mWearables.size(); i++)
{
@@ -1666,7 +1666,7 @@ LLUUID LLAgentWearables::computeBakedTextureHash(LLVOAvatarDefines::EBakedTextur
const U32 num_wearables = getWearableCount(baked_type);
for (U32 index = 0; index < num_wearables; ++index)
{
- const LLWearable* wearable = getWearable(baked_type,index);
+ const LLViewerWearable* wearable = getWearable(baked_type,index);
if (wearable)
{
LLUUID asset_id = wearable->getAssetID();
@@ -1877,11 +1877,11 @@ void LLAgentWearables::checkWearablesLoaded() const
// (depending on closer_to_body parameter).
bool LLAgentWearables::canMoveWearable(const LLUUID& item_id, bool closer_to_body)
{
- const LLWearable* wearable = getWearableFromItemID(item_id);
+ const LLViewerWearable* wearable = getWearableFromItemID(item_id);
if (!wearable) return false;
LLWearableType::EType wtype = wearable->getType();
- const LLWearable* marginal_wearable = closer_to_body ? getBottomWearable(wtype) : getTopWearable(wtype);
+ const LLViewerWearable* marginal_wearable = closer_to_body ? getBottomWearable(wtype) : getTopWearable(wtype);
if (!marginal_wearable) return false;
return wearable != marginal_wearable;
@@ -1903,7 +1903,7 @@ void LLAgentWearables::updateWearablesLoaded()
}
}
-bool LLAgentWearables::canWearableBeRemoved(const LLWearable* wearable) const
+bool LLAgentWearables::canWearableBeRemoved(const LLViewerWearable* wearable) const
{
if (!wearable) return false;
@@ -1918,7 +1918,7 @@ void LLAgentWearables::animateAllWearableParams(F32 delta, BOOL upload_bake)
{
for (S32 count = 0; count < (S32)getWearableCount((LLWearableType::EType)type); ++count)
{
- LLWearable *wearable = getWearable((LLWearableType::EType)type,count);
+ LLViewerWearable *wearable = getWearable((LLWearableType::EType)type,count);
llassert(wearable);
if (wearable)
{
@@ -1947,7 +1947,7 @@ bool LLAgentWearables::moveWearable(const LLViewerInventoryItem* item, bool clos
for (U32 i = 0; i < wearable_vec.size(); ++i)
{
- LLWearable* wearable = wearable_vec[i];
+ LLViewerWearable* wearable = wearable_vec[i];
if (!wearable) continue;
if (wearable->getAssetID() != asset_id) continue;
@@ -1966,7 +1966,7 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con
{
if (type == LLWearableType::WT_INVALID || type == LLWearableType::WT_NONE) return;
- LLWearable* wearable = LLWearableList::instance().createNewWearable(type);
+ LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type);
LLAssetType::EType asset_type = wearable->getAssetType();
LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE;
LLPointer<LLInventoryCallback> cb = wear ? new LLWearAndEditCallback : NULL;
@@ -1999,7 +1999,7 @@ void LLAgentWearables::editWearable(const LLUUID& item_id)
return;
}
- LLWearable* wearable = gAgentWearables.getWearableFromItemID(item_id);
+ LLViewerWearable* wearable = gAgentWearables.getWearableFromItemID(item_id);
if (!wearable)
{
llwarns << "Cannot get wearable" << llendl;
diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h
index 550560d7bc..41995dd55b 100755
--- a/indra/newview/llagentwearables.h
+++ b/indra/newview/llagentwearables.h
@@ -36,14 +36,13 @@
// newview
#include "llinventorymodel.h"
#include "llviewerinventory.h"
-#include "llvoavatardefines.h"
+#include "llavatarappearancedefines.h"
class LLInventoryItem;
class LLVOAvatarSelf;
-class LLWearable;
+class LLViewerWearable;
class LLInitialWearablesFetch;
class LLViewerObject;
-class LLTexLayerTemplate;
class LLAgentWearables : public LLInitClass<LLAgentWearables>
{
@@ -82,7 +81,7 @@ public:
bool canMoveWearable(const LLUUID& item_id, bool closer_to_body);
// Note: False for shape, skin, eyes, and hair, unless you have MORE than 1.
- bool canWearableBeRemoved(const LLWearable* wearable) const;
+ bool canWearableBeRemoved(const LLViewerWearable* wearable) const;
void animateAllWearableParams(F32 delta, BOOL upload_bake);
@@ -92,15 +91,15 @@ public:
public:
const LLUUID getWearableItemID(LLWearableType::EType type, U32 index /*= 0*/) const;
const LLUUID getWearableAssetID(LLWearableType::EType type, U32 index /*= 0*/) const;
- const LLWearable* getWearableFromItemID(const LLUUID& item_id) const;
- LLWearable* getWearableFromItemID(const LLUUID& item_id);
- LLWearable* getWearableFromAssetID(const LLUUID& asset_id);
+ const LLViewerWearable* getWearableFromItemID(const LLUUID& item_id) const;
+ LLViewerWearable* getWearableFromItemID(const LLUUID& item_id);
+ LLViewerWearable* getWearableFromAssetID(const LLUUID& asset_id);
LLInventoryItem* getWearableInventoryItem(LLWearableType::EType type, U32 index /*= 0*/);
static BOOL selfHasWearable(LLWearableType::EType type);
- LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/);
- const LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const;
- LLWearable* getTopWearable(const LLWearableType::EType type);
- LLWearable* getBottomWearable(const LLWearableType::EType type);
+ LLViewerWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/);
+ const LLViewerWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const;
+ LLViewerWearable* getTopWearable(const LLWearableType::EType type);
+ LLViewerWearable* getBottomWearable(const LLWearableType::EType type);
U32 getWearableCount(const LLWearableType::EType type) const;
U32 getWearableCount(const U32 tex_index) const;
@@ -113,31 +112,31 @@ public:
private:
// Low-level data structure setter - public access is via setWearableItem, etc.
- void setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable);
- U32 pushWearable(const LLWearableType::EType type, LLWearable *wearable);
- void wearableUpdated(LLWearable *wearable);
- void popWearable(LLWearable *wearable);
+ void setWearable(const LLWearableType::EType type, U32 index, LLViewerWearable *wearable);
+ U32 pushWearable(const LLWearableType::EType type, LLViewerWearable *wearable);
+ void wearableUpdated(LLViewerWearable *wearable);
+ void popWearable(LLViewerWearable *wearable);
void popWearable(const LLWearableType::EType type, U32 index);
public:
- void setWearableItem(LLInventoryItem* new_item, LLWearable* wearable, bool do_append = false);
- void setWearableOutfit(const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLWearable* >& wearables, BOOL remove);
+ void setWearableItem(LLInventoryItem* new_item, LLViewerWearable* wearable, bool do_append = false);
+ void setWearableOutfit(const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLViewerWearable* >& wearables, BOOL remove);
void setWearableName(const LLUUID& item_id, const std::string& new_name);
- void addLocalTextureObject(const LLWearableType::EType wearable_type, const LLVOAvatarDefines::ETextureIndex texture_type, U32 wearable_index);
- U32 getWearableIndex(const LLWearable *wearable) const;
+ void addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index);
+ U32 getWearableIndex(const LLViewerWearable *wearable) const;
protected:
- void setWearableFinal(LLInventoryItem* new_item, LLWearable* new_wearable, bool do_append = false);
- static bool onSetWearableDialog(const LLSD& notification, const LLSD& response, LLWearable* wearable);
+ void setWearableFinal(LLInventoryItem* new_item, LLViewerWearable* new_wearable, bool do_append = false);
+ static bool onSetWearableDialog(const LLSD& notification, const LLSD& response, LLViewerWearable* wearable);
void addWearableToAgentInventory(LLPointer<LLInventoryCallback> cb,
- LLWearable* wearable,
+ LLViewerWearable* wearable,
const LLUUID& category_id = LLUUID::null,
BOOL notify = TRUE);
void addWearabletoAgentInventoryDone(const LLWearableType::EType type,
const U32 index,
const LLUUID& item_id,
- LLWearable* wearable);
+ LLViewerWearable* wearable);
void recoverMissingWearable(const LLWearableType::EType type, U32 index /*= 0*/);
void recoverMissingWearableDone();
@@ -172,7 +171,7 @@ protected:
public:
// Processes the initial wearables update message (if necessary, since the outfit folder makes it redundant)
static void processAgentInitialWearablesUpdate(LLMessageSystem* mesgsys, void** user_data);
- LLUUID computeBakedTextureHash(LLVOAvatarDefines::EBakedTextureIndex baked_index,
+ LLUUID computeBakedTextureHash(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index,
BOOL generate_valid_hash = TRUE);
protected:
@@ -180,7 +179,7 @@ protected:
void sendAgentWearablesRequest();
void queryWearableCache();
void updateServer();
- static void onInitialWearableAssetArrived(LLWearable* wearable, void* userdata);
+ static void onInitialWearableAssetArrived(LLViewerWearable* wearable, void* userdata);
//--------------------------------------------------------------------
// Outfits
@@ -244,7 +243,7 @@ private:
// Member variables
//--------------------------------------------------------------------
private:
- typedef std::vector<LLWearable*> wearableentry_vec_t; // all wearables of a certain type (EG all shirts)
+ typedef std::vector<LLViewerWearable*> wearableentry_vec_t; // all wearables of a certain type (EG all shirts)
typedef std::map<LLWearableType::EType, wearableentry_vec_t> wearableentry_map_t; // wearable "categories" arranged by wearable type
wearableentry_map_t mWearableDatas;
@@ -288,13 +287,13 @@ private:
addWearableToAgentInventoryCallback(LLPointer<LLRefCount> cb,
LLWearableType::EType type,
U32 index,
- LLWearable* wearable,
+ LLViewerWearable* wearable,
U32 todo = CALL_NONE);
virtual void fire(const LLUUID& inv_item);
private:
LLWearableType::EType mType;
U32 mIndex;
- LLWearable* mWearable;
+ LLViewerWearable* mWearable;
U32 mTodo;
LLPointer<LLRefCount> mCB;
};
diff --git a/indra/newview/llappearance.h b/indra/newview/llappearance.h
index a28b77b1fc..05dfac4e42 100644
--- a/indra/newview/llappearance.h
+++ b/indra/newview/llappearance.h
@@ -38,14 +38,14 @@ public:
void addParam( S32 id, F32 value ) { mParamMap[id] = value; }
F32 getParam( S32 id, F32 defval ) { return get_if_there(mParamMap, id, defval ); }
- void addTexture( S32 te, const LLUUID& uuid ) { if( te < LLVOAvatarDefines::TEX_NUM_INDICES ) mTextures[te] = uuid; }
- const LLUUID& getTexture( S32 te ) { return ( te < LLVOAvatarDefines::TEX_NUM_INDICES ) ? mTextures[te] : LLUUID::null; }
+ void addTexture( S32 te, const LLUUID& uuid ) { if( te < LLAvatarAppearanceDefines::TEX_NUM_INDICES ) mTextures[te] = uuid; }
+ const LLUUID& getTexture( S32 te ) { return ( te < LLAvatarAppearanceDefines::TEX_NUM_INDICES ) ? mTextures[te] : LLUUID::null; }
- void clear() { mParamMap.clear(); for( S32 i=0; i<LLVOAvatarDefines::TEX_NUM_INDICES; i++ ) mTextures[i].setNull(); }
+ void clear() { mParamMap.clear(); for( S32 i=0; i<LLAvatarAppearanceDefines::TEX_NUM_INDICES; i++ ) mTextures[i].setNull(); }
typedef std::map<S32, F32> param_map_t;
param_map_t mParamMap;
- LLUUID mTextures[LLVOAvatarDefines::TEX_NUM_INDICES];
+ LLUUID mTextures[LLAvatarAppearanceDefines::TEX_NUM_INDICES];
};
#endif // LL_LLAPPEARANCE_H
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index f71d9c7704..5717ebaf02 100755
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -277,7 +277,7 @@ struct LLFoundData
std::string mName;
LLAssetType::EType mAssetType;
LLWearableType::EType mWearableType;
- LLWearable* mWearable;
+ LLViewerWearable* mWearable;
bool mIsReplacement;
};
@@ -301,7 +301,7 @@ public:
void recoverMissingWearable(LLWearableType::EType type);
void clearCOFLinksForMissingWearables();
- void onWearableAssetFetch(LLWearable *wearable);
+ void onWearableAssetFetch(LLViewerWearable *wearable);
void onAllComplete();
typedef std::list<LLFoundData> found_list_t;
@@ -327,7 +327,7 @@ private:
typedef std::set<LLWearableHoldingPattern*> type_set_hp;
static type_set_hp sActiveHoldingPatterns;
bool mIsMostRecent;
- std::set<LLWearable*> mLateArrivals;
+ std::set<LLViewerWearable*> mLateArrivals;
bool mIsAllComplete;
};
@@ -561,7 +561,7 @@ bool LLWearableHoldingPattern::pollFetchCompletion()
class RecoveredItemLinkCB: public LLInventoryCallback
{
public:
- RecoveredItemLinkCB(LLWearableType::EType type, LLWearable *wearable, LLWearableHoldingPattern* holder):
+ RecoveredItemLinkCB(LLWearableType::EType type, LLViewerWearable *wearable, LLWearableHoldingPattern* holder):
mHolder(holder),
mWearable(wearable),
mType(type)
@@ -609,14 +609,14 @@ public:
}
private:
LLWearableHoldingPattern* mHolder;
- LLWearable *mWearable;
+ LLViewerWearable *mWearable;
LLWearableType::EType mType;
};
class RecoveredItemCB: public LLInventoryCallback
{
public:
- RecoveredItemCB(LLWearableType::EType type, LLWearable *wearable, LLWearableHoldingPattern* holder):
+ RecoveredItemCB(LLWearableType::EType type, LLViewerWearable *wearable, LLWearableHoldingPattern* holder):
mHolder(holder),
mWearable(wearable),
mType(type)
@@ -649,7 +649,7 @@ public:
}
private:
LLWearableHoldingPattern* mHolder;
- LLWearable *mWearable;
+ LLViewerWearable *mWearable;
LLWearableType::EType mType;
};
@@ -665,7 +665,7 @@ void LLWearableHoldingPattern::recoverMissingWearable(LLWearableType::EType type
LLNotificationsUtil::add("ReplacedMissingWearable");
lldebugs << "Wearable " << LLWearableType::getTypeLabel(type)
<< " could not be downloaded. Replaced inventory item with default wearable." << llendl;
- LLWearable* wearable = LLWearableList::instance().createNewWearable(type);
+ LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type);
// Add a new one in the lost and found folder.
const LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
@@ -772,11 +772,11 @@ void LLWearableHoldingPattern::handleLateArrivals()
iter != getFoundList().end(); ++iter)
{
LLFoundData& data = *iter;
- for (std::set<LLWearable*>::iterator wear_it = mLateArrivals.begin();
+ for (std::set<LLViewerWearable*>::iterator wear_it = mLateArrivals.begin();
wear_it != mLateArrivals.end();
++wear_it)
{
- LLWearable *wearable = *wear_it;
+ LLViewerWearable *wearable = *wear_it;
if(wearable->getAssetID() == data.mAssetID)
{
@@ -836,7 +836,7 @@ void LLWearableHoldingPattern::resetTime(F32 timeout)
mWaitTime.setTimerExpirySec(timeout);
}
-void LLWearableHoldingPattern::onWearableAssetFetch(LLWearable *wearable)
+void LLWearableHoldingPattern::onWearableAssetFetch(LLViewerWearable *wearable)
{
if (!isMostRecent())
{
@@ -887,7 +887,7 @@ void LLWearableHoldingPattern::onWearableAssetFetch(LLWearable *wearable)
}
}
-static void onWearableAssetFetch(LLWearable* wearable, void* data)
+static void onWearableAssetFetch(LLViewerWearable* wearable, void* data)
{
LLWearableHoldingPattern* holder = (LLWearableHoldingPattern*)data;
holder->onWearableAssetFetch(wearable);
@@ -1590,7 +1590,7 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, boo
{
lldebugs << "updateAgentWearables()" << llendl;
LLInventoryItem::item_array_t items;
- LLDynamicArray< LLWearable* > wearables;
+ LLDynamicArray< LLViewerWearable* > wearables;
// For each wearable type, find the wearables of that type.
for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ )
@@ -1599,7 +1599,7 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, boo
iter != holder->getFoundList().end(); ++iter)
{
LLFoundData& data = *iter;
- LLWearable* wearable = data.mWearable;
+ LLViewerWearable* wearable = data.mWearable;
if( wearable && ((S32)wearable->getType() == i) )
{
LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(data.mItemID);
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index d6187e1cfb..4baee10218 100755
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -35,7 +35,6 @@
#include "llinventoryobserver.h"
#include "llviewerinventory.h"
-class LLWearable;
class LLWearableHoldingPattern;
class LLInventoryCallback;
class LLOutfitUnLockTimer;
diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp
index 65bfc990d1..35e44d73d4 100644
--- a/indra/newview/llassetuploadresponders.cpp
+++ b/indra/newview/llassetuploadresponders.cpp
@@ -48,8 +48,8 @@
#include "llviewercontrol.h"
#include "llviewerobjectlist.h"
#include "llviewermenufile.h"
+#include "llviewertexlayer.h"
#include "llviewerwindow.h"
-#include "lltexlayer.h"
#include "lltrans.h"
// library includes
diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp
index b539ac38ed..76f10e2d56 100755
--- a/indra/newview/llavatariconctrl.cpp
+++ b/indra/newview/llavatariconctrl.cpp
@@ -37,6 +37,8 @@
#include "lluictrlfactory.h"
#include "llagentdata.h"
#include "llimfloater.h"
+#include "llviewertexture.h"
+#include "llavatarappearancedefines.h"
// library includes
#include "llavatarnamecache.h"
diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp
index 885cae1737..0ae9acd1af 100644
--- a/indra/newview/lldriverparam.cpp
+++ b/indra/newview/lldriverparam.cpp
@@ -32,7 +32,7 @@
#include "llvoavatar.h"
#include "llvoavatarself.h"
#include "llagent.h"
-#include "llwearable.h"
+#include "llviewerwearable.h"
#include "llagentwearables.h"
//-----------------------------------------------------------------------------
@@ -623,10 +623,19 @@ F32 LLDriverParam::getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight
void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake)
{
+ bool use_self = false;
if(isAgentAvatarValid() &&
- mWearablep &&
- driven->mParam->getCrossWearable() &&
- mWearablep->isOnTop())
+ mWearablep &&
+ driven->mParam->getCrossWearable())
+ {
+ LLViewerWearable* wearable = dynamic_cast<LLViewerWearable*> (mWearablep);
+ if (!wearable->isOnTop())
+ {
+ use_self = false;
+ }
+ }
+
+ if (use_self)
{
// call setWeight through LLVOAvatarSelf so other wearables can be updated with the correct values
gAgentAvatarp->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake );
diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp
index 2939d31087..3c40e2d4bc 100644
--- a/indra/newview/llfloaterauction.cpp
+++ b/indra/newview/llfloaterauction.cpp
@@ -38,6 +38,7 @@
#include "message.h"
#include "llagent.h"
+#include "llassetstorage.h"
#include "llcombobox.h"
#include "llestateinfomodel.h"
#include "llmimetypes.h"
diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp
index 4e10b4fc2c..68bdf9a8d6 100644
--- a/indra/newview/llfloateravatartextures.cpp
+++ b/indra/newview/llfloateravatartextures.cpp
@@ -32,12 +32,13 @@
#include "llagent.h"
#include "llagentwearables.h"
+#include "llviewerwearable.h"
#include "lltexturectrl.h"
#include "lluictrlfactory.h"
#include "llviewerobjectlist.h"
#include "llvoavatarself.h"
-using namespace LLVOAvatarDefines;
+using namespace LLAvatarAppearanceDefines;
LLFloaterAvatarTextures::LLFloaterAvatarTextures(const LLSD& id)
: LLFloater(id),
@@ -53,7 +54,7 @@ BOOL LLFloaterAvatarTextures::postBuild()
{
for (U32 i=0; i < TEX_NUM_INDICES; i++)
{
- const std::string tex_name = LLVOAvatarDictionary::getInstance()->getTexture(ETextureIndex(i))->mName;
+ const std::string tex_name = LLAvatarAppearanceDictionary::getInstance()->getTexture(ETextureIndex(i))->mName;
mTextures[i] = getChild<LLTextureCtrl>(tex_name);
}
mTitle = getTitle();
@@ -75,13 +76,13 @@ static void update_texture_ctrl(LLVOAvatar* avatarp,
ETextureIndex te)
{
LLUUID id = IMG_DEFAULT_AVATAR;
- const LLVOAvatarDictionary::TextureEntry* tex_entry = LLVOAvatarDictionary::getInstance()->getTexture(te);
+ const LLAvatarAppearanceDictionary::TextureEntry* tex_entry = LLAvatarAppearanceDictionary::getInstance()->getTexture(te);
if (tex_entry->mIsLocalTexture)
{
if (avatarp->isSelf())
{
const LLWearableType::EType wearable_type = tex_entry->mWearableType;
- LLWearable *wearable = gAgentWearables.getWearable(wearable_type, 0);
+ LLViewerWearable *wearable = gAgentWearables.getWearable(wearable_type, 0);
if (wearable)
{
LLLocalTextureObject *lto = wearable->getLocalTextureObject(te);
@@ -163,17 +164,17 @@ void LLFloaterAvatarTextures::onClickDump(void* data)
const LLTextureEntry* te = avatarp->getTE(i);
if (!te) continue;
- const LLVOAvatarDictionary::TextureEntry* tex_entry = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)(i));
+ const LLAvatarAppearanceDictionary::TextureEntry* tex_entry = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)(i));
if (!tex_entry)
continue;
if (LLVOAvatar::isIndexLocalTexture((ETextureIndex)i))
{
LLUUID id = IMG_DEFAULT_AVATAR;
- LLWearableType::EType wearable_type = LLVOAvatarDictionary::getInstance()->getTEWearableType((ETextureIndex)i);
+ LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType((ETextureIndex)i);
if (avatarp->isSelf())
{
- LLWearable *wearable = gAgentWearables.getWearable(wearable_type, 0);
+ LLViewerWearable *wearable = gAgentWearables.getWearable(wearable_type, 0);
if (wearable)
{
LLLocalTextureObject *lto = wearable->getLocalTextureObject(i);
diff --git a/indra/newview/llfloateravatartextures.h b/indra/newview/llfloateravatartextures.h
index 85ff545855..02474a10e1 100644
--- a/indra/newview/llfloateravatartextures.h
+++ b/indra/newview/llfloateravatartextures.h
@@ -30,7 +30,7 @@
#include "llfloater.h"
#include "lluuid.h"
#include "llstring.h"
-#include "llvoavatardefines.h"
+#include "llavatarappearancedefines.h"
class LLTextureCtrl;
@@ -51,7 +51,7 @@ private:
private:
LLUUID mID;
std::string mTitle;
- LLTextureCtrl* mTextures[LLVOAvatarDefines::TEX_NUM_INDICES];
+ LLTextureCtrl* mTextures[LLAvatarAppearanceDefines::TEX_NUM_INDICES];
};
#endif
diff --git a/indra/newview/llgroupiconctrl.cpp b/indra/newview/llgroupiconctrl.cpp
index 2f9810775b..97f72b020c 100644
--- a/indra/newview/llgroupiconctrl.cpp
+++ b/indra/newview/llgroupiconctrl.cpp
@@ -29,6 +29,7 @@
#include "llgroupiconctrl.h"
#include "llagent.h"
+#include "llviewertexture.h"
/*
#include "llavatarconstants.h"
#include "llcallingcard.h" // for LLAvatarTracker
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index ddeb33d0ba..dc6147898a 100755
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -5600,7 +5600,7 @@ void LLWearableBridge::wearAddOnAvatar()
}
// static
-void LLWearableBridge::onWearOnAvatarArrived( LLWearable* wearable, void* userdata )
+void LLWearableBridge::onWearOnAvatarArrived( LLViewerWearable* wearable, void* userdata )
{
LLUUID* item_id = (LLUUID*) userdata;
if(wearable)
@@ -5626,7 +5626,7 @@ void LLWearableBridge::onWearOnAvatarArrived( LLWearable* wearable, void* userda
// static
// BAP remove the "add" code path once everything is fully COF-ified.
-void LLWearableBridge::onWearAddOnAvatarArrived( LLWearable* wearable, void* userdata )
+void LLWearableBridge::onWearAddOnAvatarArrived( LLViewerWearable* wearable, void* userdata )
{
LLUUID* item_id = (LLUUID*) userdata;
if(wearable)
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index 8f36234c39..f439c45dd3 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -33,7 +33,7 @@
#include "llinventorymodel.h"
#include "llinventoryobserver.h"
#include "llviewercontrol.h"
-#include "llwearable.h"
+#include "llviewerwearable.h"
class LLInventoryFilter;
class LLInventoryPanel;
@@ -487,10 +487,10 @@ public:
static void onWearOnAvatar( void* userdata ); // Access to wearOnAvatar() from menu
static BOOL canWearOnAvatar( void* userdata );
- static void onWearOnAvatarArrived( LLWearable* wearable, void* userdata );
+ static void onWearOnAvatarArrived( LLViewerWearable* wearable, void* userdata );
void wearOnAvatar();
- static void onWearAddOnAvatarArrived( LLWearable* wearable, void* userdata );
+ static void onWearAddOnAvatarArrived( LLViewerWearable* wearable, void* userdata );
void wearAddOnAvatar();
static BOOL canEditOnAvatar( void* userdata ); // Access to editOnAvatar() from menu
diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp
index 459e52c4f4..fce4c29870 100644
--- a/indra/newview/lllocalbitmaps.cpp
+++ b/indra/newview/lllocalbitmaps.cpp
@@ -55,7 +55,7 @@
#include "llviewerobject.h"
#include "llface.h"
#include "llvoavatarself.h"
-#include "llwearable.h"
+#include "llviewerwearable.h"
#include "llagentwearables.h"
#include "lltexlayerparams.h"
#include "llvovolume.h"
@@ -483,7 +483,7 @@ void LLLocalBitmap::updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableTyp
U32 count = gAgentWearables.getWearableCount(type);
for(U32 wearable_iter = 0; wearable_iter < count; wearable_iter++)
{
- LLWearable* wearable = gAgentWearables.getWearable(type, wearable_iter);
+ LLViewerWearable* wearable = gAgentWearables.getWearable(type, wearable_iter);
if (wearable)
{
std::vector<LLLocalTextureObject*> texture_list = wearable->getLocalTextureListSeq();
@@ -495,11 +495,11 @@ void LLLocalBitmap::updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableTyp
if (lto && lto->getID() == old_id)
{
U32 local_texlayer_index = 0; /* can't keep that as static const, gives errors, so i'm leaving this var here */
- LLVOAvatarDefines::EBakedTextureIndex baked_texind =
+ LLAvatarAppearanceDefines::EBakedTextureIndex baked_texind =
lto->getTexLayer(local_texlayer_index)->getTexLayerSet()->getBakedTexIndex();
- LLVOAvatarDefines::ETextureIndex reg_texind = getTexIndex(type, baked_texind);
- if (reg_texind != LLVOAvatarDefines::TEX_NUM_INDICES)
+ LLAvatarAppearanceDefines::ETextureIndex reg_texind = getTexIndex(type, baked_texind);
+ if (reg_texind != LLAvatarAppearanceDefines::TEX_NUM_INDICES)
{
U32 index = gAgentWearables.getWearableIndex(wearable);
gAgentAvatarp->setLocalTexture(reg_texind, gTextureList.getImage(new_id), FALSE, index);
@@ -515,10 +515,10 @@ void LLLocalBitmap::updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableTyp
}
}
-LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
- LLWearableType::EType type, LLVOAvatarDefines::EBakedTextureIndex baked_texind)
+LLAvatarAppearanceDefines::ETextureIndex LLLocalBitmap::getTexIndex(
+ LLWearableType::EType type, LLAvatarAppearanceDefines::EBakedTextureIndex baked_texind)
{
- LLVOAvatarDefines::ETextureIndex result = LLVOAvatarDefines::TEX_NUM_INDICES; // using as a default/fail return.
+ LLAvatarAppearanceDefines::ETextureIndex result = LLAvatarAppearanceDefines::TEX_NUM_INDICES; // using as a default/fail return.
switch(type)
{
@@ -526,32 +526,32 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
{
switch(baked_texind)
{
- case LLVOAvatarDefines::BAKED_EYES:
+ case LLAvatarAppearanceDefines::BAKED_EYES:
{
- result = LLVOAvatarDefines::TEX_EYES_ALPHA;
+ result = LLAvatarAppearanceDefines::TEX_EYES_ALPHA;
break;
}
- case LLVOAvatarDefines::BAKED_HAIR:
+ case LLAvatarAppearanceDefines::BAKED_HAIR:
{
- result = LLVOAvatarDefines::TEX_HAIR_ALPHA;
+ result = LLAvatarAppearanceDefines::TEX_HAIR_ALPHA;
break;
}
- case LLVOAvatarDefines::BAKED_HEAD:
+ case LLAvatarAppearanceDefines::BAKED_HEAD:
{
- result = LLVOAvatarDefines::TEX_HEAD_ALPHA;
+ result = LLAvatarAppearanceDefines::TEX_HEAD_ALPHA;
break;
}
- case LLVOAvatarDefines::BAKED_LOWER:
+ case LLAvatarAppearanceDefines::BAKED_LOWER:
{
- result = LLVOAvatarDefines::TEX_LOWER_ALPHA;
+ result = LLAvatarAppearanceDefines::TEX_LOWER_ALPHA;
break;
}
- case LLVOAvatarDefines::BAKED_UPPER:
+ case LLAvatarAppearanceDefines::BAKED_UPPER:
{
- result = LLVOAvatarDefines::TEX_UPPER_ALPHA;
+ result = LLAvatarAppearanceDefines::TEX_UPPER_ALPHA;
break;
}
@@ -567,9 +567,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
case LLWearableType::WT_EYES:
{
- if (baked_texind == LLVOAvatarDefines::BAKED_EYES)
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_EYES)
{
- result = LLVOAvatarDefines::TEX_EYES_IRIS;
+ result = LLAvatarAppearanceDefines::TEX_EYES_IRIS;
}
break;
@@ -577,9 +577,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
case LLWearableType::WT_GLOVES:
{
- if (baked_texind == LLVOAvatarDefines::BAKED_UPPER)
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_UPPER)
{
- result = LLVOAvatarDefines::TEX_UPPER_GLOVES;
+ result = LLAvatarAppearanceDefines::TEX_UPPER_GLOVES;
}
break;
@@ -587,13 +587,13 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
case LLWearableType::WT_JACKET:
{
- if (baked_texind == LLVOAvatarDefines::BAKED_LOWER)
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER)
{
- result = LLVOAvatarDefines::TEX_LOWER_JACKET;
+ result = LLAvatarAppearanceDefines::TEX_LOWER_JACKET;
}
- else if (baked_texind == LLVOAvatarDefines::BAKED_UPPER)
+ else if (baked_texind == LLAvatarAppearanceDefines::BAKED_UPPER)
{
- result = LLVOAvatarDefines::TEX_UPPER_JACKET;
+ result = LLAvatarAppearanceDefines::TEX_UPPER_JACKET;
}
break;
@@ -601,9 +601,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
case LLWearableType::WT_PANTS:
{
- if (baked_texind == LLVOAvatarDefines::BAKED_LOWER)
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER)
{
- result = LLVOAvatarDefines::TEX_LOWER_PANTS;
+ result = LLAvatarAppearanceDefines::TEX_LOWER_PANTS;
}
break;
@@ -611,9 +611,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
case LLWearableType::WT_SHIRT:
{
- if (baked_texind == LLVOAvatarDefines::BAKED_UPPER)
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_UPPER)
{
- result = LLVOAvatarDefines::TEX_UPPER_SHIRT;
+ result = LLAvatarAppearanceDefines::TEX_UPPER_SHIRT;
}
break;
@@ -621,9 +621,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
case LLWearableType::WT_SHOES:
{
- if (baked_texind == LLVOAvatarDefines::BAKED_LOWER)
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER)
{
- result = LLVOAvatarDefines::TEX_LOWER_SHOES;
+ result = LLAvatarAppearanceDefines::TEX_LOWER_SHOES;
}
break;
@@ -633,20 +633,20 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
{
switch(baked_texind)
{
- case LLVOAvatarDefines::BAKED_HEAD:
+ case LLAvatarAppearanceDefines::BAKED_HEAD:
{
- result = LLVOAvatarDefines::TEX_HEAD_BODYPAINT;
+ result = LLAvatarAppearanceDefines::TEX_HEAD_BODYPAINT;
break;
}
- case LLVOAvatarDefines::BAKED_LOWER:
+ case LLAvatarAppearanceDefines::BAKED_LOWER:
{
- result = LLVOAvatarDefines::TEX_LOWER_BODYPAINT;
+ result = LLAvatarAppearanceDefines::TEX_LOWER_BODYPAINT;
break;
}
- case LLVOAvatarDefines::BAKED_UPPER:
+ case LLAvatarAppearanceDefines::BAKED_UPPER:
{
- result = LLVOAvatarDefines::TEX_UPPER_BODYPAINT;
+ result = LLAvatarAppearanceDefines::TEX_UPPER_BODYPAINT;
break;
}
@@ -661,9 +661,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
case LLWearableType::WT_SKIRT:
{
- if (baked_texind == LLVOAvatarDefines::BAKED_SKIRT)
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_SKIRT)
{
- result = LLVOAvatarDefines::TEX_SKIRT;
+ result = LLAvatarAppearanceDefines::TEX_SKIRT;
}
break;
@@ -671,9 +671,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
case LLWearableType::WT_SOCKS:
{
- if (baked_texind == LLVOAvatarDefines::BAKED_LOWER)
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER)
{
- result = LLVOAvatarDefines::TEX_LOWER_SOCKS;
+ result = LLAvatarAppearanceDefines::TEX_LOWER_SOCKS;
}
break;
@@ -683,20 +683,20 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
{
switch(baked_texind)
{
- case LLVOAvatarDefines::BAKED_HEAD:
+ case LLAvatarAppearanceDefines::BAKED_HEAD:
{
- result = LLVOAvatarDefines::TEX_HEAD_TATTOO;
+ result = LLAvatarAppearanceDefines::TEX_HEAD_TATTOO;
break;
}
- case LLVOAvatarDefines::BAKED_LOWER:
+ case LLAvatarAppearanceDefines::BAKED_LOWER:
{
- result = LLVOAvatarDefines::TEX_LOWER_TATTOO;
+ result = LLAvatarAppearanceDefines::TEX_LOWER_TATTOO;
break;
}
- case LLVOAvatarDefines::BAKED_UPPER:
+ case LLAvatarAppearanceDefines::BAKED_UPPER:
{
- result = LLVOAvatarDefines::TEX_UPPER_TATTOO;
+ result = LLAvatarAppearanceDefines::TEX_UPPER_TATTOO;
break;
}
@@ -711,9 +711,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
case LLWearableType::WT_UNDERPANTS:
{
- if (baked_texind == LLVOAvatarDefines::BAKED_LOWER)
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER)
{
- result = LLVOAvatarDefines::TEX_LOWER_UNDERPANTS;
+ result = LLAvatarAppearanceDefines::TEX_LOWER_UNDERPANTS;
}
break;
@@ -721,9 +721,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
case LLWearableType::WT_UNDERSHIRT:
{
- if (baked_texind == LLVOAvatarDefines::BAKED_UPPER)
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_UPPER)
{
- result = LLVOAvatarDefines::TEX_UPPER_UNDERSHIRT;
+ result = LLAvatarAppearanceDefines::TEX_UPPER_UNDERSHIRT;
}
break;
diff --git a/indra/newview/lllocalbitmaps.h b/indra/newview/lllocalbitmaps.h
index 7a23c7ef6e..ca12fe2045 100644
--- a/indra/newview/lllocalbitmaps.h
+++ b/indra/newview/lllocalbitmaps.h
@@ -30,9 +30,10 @@
#include "lleventtimer.h"
#include "llwearabletype.h"
-#include "llvoavatardefines.h"
+#include "llavatarappearancedefines.h"
class LLScrollListCtrl;
+class LLViewerObject;
class LLLocalBitmap
{
@@ -63,7 +64,7 @@ class LLLocalBitmap
void updateUserPrims(LLUUID old_id, LLUUID new_id);
void updateUserSculpts(LLUUID old_id, LLUUID new_id);
void updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableType::EType type);
- LLVOAvatarDefines::ETextureIndex getTexIndex(LLWearableType::EType type, LLVOAvatarDefines::EBakedTextureIndex baked_texind);
+ LLAvatarAppearanceDefines::ETextureIndex getTexIndex(LLWearableType::EType type, LLAvatarAppearanceDefines::EBakedTextureIndex baked_texind);
private: /* private enums */
enum ELinkStatus
diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp
index 6889b98ab1..862e4be203 100644
--- a/indra/newview/llpanelclassified.cpp
+++ b/indra/newview/llpanelclassified.cpp
@@ -55,6 +55,7 @@
#include "lltrans.h"
#include "llscrollcontainer.h"
#include "llstatusbar.h"
+#include "llviewertexture.h"
const S32 MINIMUM_PRICE_FOR_LISTING = 50; // L$
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index d8ba2aa659..9aadca1d80 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -28,7 +28,7 @@
#include "llpaneleditwearable.h"
#include "llpanel.h"
-#include "llwearable.h"
+#include "llviewerwearable.h"
#include "lluictrl.h"
#include "llscrollingpanellist.h"
#include "llvisualparam.h"
@@ -104,7 +104,7 @@ enum ESubpart {
SUBPART_PHYSICS_ADVANCED,
};
-using namespace LLVOAvatarDefines;
+using namespace LLAvatarAppearanceDefines;
typedef std::vector<ESubpart> subpart_vec_t;
@@ -762,11 +762,11 @@ BOOL LLPanelEditWearable::postBuild()
mWearablePtr = NULL;
- configureAlphaCheckbox(LLVOAvatarDefines::TEX_LOWER_ALPHA, "lower alpha texture invisible");
- configureAlphaCheckbox(LLVOAvatarDefines::TEX_UPPER_ALPHA, "upper alpha texture invisible");
- configureAlphaCheckbox(LLVOAvatarDefines::TEX_HEAD_ALPHA, "head alpha texture invisible");
- configureAlphaCheckbox(LLVOAvatarDefines::TEX_EYES_ALPHA, "eye alpha texture invisible");
- configureAlphaCheckbox(LLVOAvatarDefines::TEX_HAIR_ALPHA, "hair alpha texture invisible");
+ configureAlphaCheckbox(LLAvatarAppearanceDefines::TEX_LOWER_ALPHA, "lower alpha texture invisible");
+ configureAlphaCheckbox(LLAvatarAppearanceDefines::TEX_UPPER_ALPHA, "upper alpha texture invisible");
+ configureAlphaCheckbox(LLAvatarAppearanceDefines::TEX_HEAD_ALPHA, "head alpha texture invisible");
+ configureAlphaCheckbox(LLAvatarAppearanceDefines::TEX_EYES_ALPHA, "eye alpha texture invisible");
+ configureAlphaCheckbox(LLAvatarAppearanceDefines::TEX_HAIR_ALPHA, "hair alpha texture invisible");
// configure tab expanded callbacks
for (U32 type_index = 0; type_index < (U32)LLWearableType::WT_COUNT; ++type_index)
@@ -865,7 +865,7 @@ void LLPanelEditWearable::setVisible(BOOL visible)
LLPanel::setVisible(visible);
}
-void LLPanelEditWearable::setWearable(LLWearable *wearable, BOOL disable_camera_switch)
+void LLPanelEditWearable::setWearable(LLViewerWearable *wearable, BOOL disable_camera_switch)
{
showWearable(mWearablePtr, FALSE, disable_camera_switch);
mWearablePtr = wearable;
@@ -922,7 +922,7 @@ void LLPanelEditWearable::onCommitSexChange()
}
bool is_new_sex_male = (gSavedSettings.getU32("AvatarSex") ? SEX_MALE : SEX_FEMALE) == SEX_MALE;
- LLWearable* wearable = gAgentWearables.getWearable(type, index);
+ LLViewerWearable* wearable = gAgentWearables.getWearable(type, index);
if (wearable)
{
wearable->setVisualParamWeight(param->getID(), is_new_sex_male, FALSE);
@@ -1069,7 +1069,7 @@ void LLPanelEditWearable::revertChanges()
gAgentAvatarp->wearableUpdated(mWearablePtr->getType(), FALSE);
}
-void LLPanelEditWearable::showWearable(LLWearable* wearable, BOOL show, BOOL disable_camera_switch)
+void LLPanelEditWearable::showWearable(LLViewerWearable* wearable, BOOL show, BOOL disable_camera_switch)
{
if (!wearable)
{
@@ -1445,7 +1445,7 @@ void LLPanelEditWearable::buildParamList(LLScrollingPanelList *panel_list, value
{
LLPanel::Params p;
p.name("LLScrollingPanelParam");
- LLWearable *wearable = this->getWearable();
+ LLViewerWearable *wearable = this->getWearable();
LLScrollingPanelParamBase *panel_param = NULL;
if (wearable && wearable->getType() == LLWearableType::WT_PHYSICS) // Hack to show a different panel for physics. Should generalize this later.
{
@@ -1505,7 +1505,7 @@ void LLPanelEditWearable::updateVerbs()
}
}
-void LLPanelEditWearable::configureAlphaCheckbox(LLVOAvatarDefines::ETextureIndex te, const std::string& name)
+void LLPanelEditWearable::configureAlphaCheckbox(LLAvatarAppearanceDefines::ETextureIndex te, const std::string& name)
{
LLCheckBoxCtrl* checkbox = mPanelAlpha->getChild<LLCheckBoxCtrl>(name);
checkbox->setCommitCallback(boost::bind(&LLPanelEditWearable::onInvisibilityCommit, this, checkbox, te));
@@ -1513,7 +1513,7 @@ void LLPanelEditWearable::configureAlphaCheckbox(LLVOAvatarDefines::ETextureInde
mAlphaCheckbox2Index[name] = te;
}
-void LLPanelEditWearable::onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLVOAvatarDefines::ETextureIndex te)
+void LLPanelEditWearable::onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLAvatarAppearanceDefines::ETextureIndex te)
{
if (!checkbox_ctrl) return;
if (!getWearable()) return;
@@ -1557,7 +1557,7 @@ void LLPanelEditWearable::updateAlphaCheckboxes()
for(string_texture_index_map_t::iterator iter = mAlphaCheckbox2Index.begin();
iter != mAlphaCheckbox2Index.end(); ++iter )
{
- LLVOAvatarDefines::ETextureIndex te = (LLVOAvatarDefines::ETextureIndex)iter->second;
+ LLAvatarAppearanceDefines::ETextureIndex te = (LLAvatarAppearanceDefines::ETextureIndex)iter->second;
LLCheckBoxCtrl* ctrl = mPanelAlpha->getChild<LLCheckBoxCtrl>(iter->first);
if (ctrl)
{
@@ -1575,7 +1575,7 @@ void LLPanelEditWearable::initPreviousAlphaTextures()
initPreviousAlphaTextureEntry(TEX_LOWER_ALPHA);
}
-void LLPanelEditWearable::initPreviousAlphaTextureEntry(LLVOAvatarDefines::ETextureIndex te)
+void LLPanelEditWearable::initPreviousAlphaTextureEntry(LLAvatarAppearanceDefines::ETextureIndex te)
{
LLLocalTextureObject *lto = getWearable()->getLocalTextureObject(te);
if (lto)
diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h
index 692a7ce90f..309d512e23 100644
--- a/indra/newview/llpaneleditwearable.h
+++ b/indra/newview/llpaneleditwearable.h
@@ -30,12 +30,12 @@
#include "llpanel.h"
#include "llscrollingpanellist.h"
#include "llmodaldialog.h"
-#include "llvoavatardefines.h"
+#include "llavatarappearancedefines.h"
#include "llwearabletype.h"
class LLAccordionCtrl;
class LLCheckBoxCtrl;
-class LLWearable;
+class LLViewerWearable;
class LLTextBox;
class LLViewerInventoryItem;
class LLViewerVisualParam;
@@ -58,8 +58,8 @@ public:
// changes camera angle to default for selected subpart
void changeCamera(U8 subpart);
- LLWearable* getWearable() { return mWearablePtr; }
- void setWearable(LLWearable *wearable, BOOL disable_camera_switch = FALSE);
+ LLViewerWearable* getWearable() { return mWearablePtr; }
+ void setWearable(LLViewerWearable *wearable, BOOL disable_camera_switch = FALSE);
void saveChanges(bool force_save_as = false);
void revertChanges();
@@ -80,7 +80,7 @@ public:
private:
typedef std::map<F32, LLViewerVisualParam*> value_map_t;
- void showWearable(LLWearable* wearable, BOOL show, BOOL disable_camera_switch = FALSE);
+ void showWearable(LLViewerWearable* wearable, BOOL show, BOOL disable_camera_switch = FALSE);
void updateScrollingPanelUI();
LLPanel* getPanel(LLWearableType::EType type);
void getSortedParams(value_map_t &sorted_params, const std::string &edit_group);
@@ -95,11 +95,11 @@ private:
void updateTypeSpecificControls(LLWearableType::EType type);
//alpha mask checkboxes
- void configureAlphaCheckbox(LLVOAvatarDefines::ETextureIndex te, const std::string& name);
- void onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLVOAvatarDefines::ETextureIndex te);
+ void configureAlphaCheckbox(LLAvatarAppearanceDefines::ETextureIndex te, const std::string& name);
+ void onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLAvatarAppearanceDefines::ETextureIndex te);
void updateAlphaCheckboxes();
void initPreviousAlphaTextures();
- void initPreviousAlphaTextureEntry(LLVOAvatarDefines::ETextureIndex te);
+ void initPreviousAlphaTextureEntry(LLAvatarAppearanceDefines::ETextureIndex te);
// callback for HeightUnits parameter.
bool changeHeightUnits(const LLSD& new_value);
@@ -115,7 +115,7 @@ private:
void setWearablePanelVisibilityChangeCallback(LLPanel* bodypart_panel);
// the pointer to the wearable we're editing. NULL means we're not editing a wearable.
- LLWearable *mWearablePtr;
+ LLViewerWearable *mWearablePtr;
LLViewerInventoryItem* mWearableItem;
// these are constant no matter what wearable we're editing
@@ -165,10 +165,10 @@ private:
LLPanel *mPanelTattoo;
LLPanel *mPanelPhysics;
- typedef std::map<std::string, LLVOAvatarDefines::ETextureIndex> string_texture_index_map_t;
+ typedef std::map<std::string, LLAvatarAppearanceDefines::ETextureIndex> string_texture_index_map_t;
string_texture_index_map_t mAlphaCheckbox2Index;
- typedef std::map<LLVOAvatarDefines::ETextureIndex, LLUUID> s32_uuid_map_t;
+ typedef std::map<LLAvatarAppearanceDefines::ETextureIndex, LLUUID> s32_uuid_map_t;
s32_uuid_map_t mPreviousAlphaTexture;
};
diff --git a/indra/newview/llpostcard.cpp b/indra/newview/llpostcard.cpp
index 4f2d6da7e5..aebe636f59 100644
--- a/indra/newview/llpostcard.cpp
+++ b/indra/newview/llpostcard.cpp
@@ -35,6 +35,7 @@
#include "message.h"
#include "llagent.h"
+#include "llassetstorage.h"
#include "llassetuploadresponders.h"
///////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index 9267444534..6a692209e9 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -47,7 +47,7 @@
#include "llviewercontrol.h"
#include "llviewerregion.h"
#include "llvoavatarself.h"
-#include "llwearable.h"
+#include "llviewerwearable.h"
static LLRegisterPanelClassWrapper<LLSidepanelAppearance> t_appearance("sidepanel_appearance");
@@ -198,7 +198,7 @@ void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility)
if (is_outfit_edit_visible || is_wearable_edit_visible)
{
- const LLWearable *wearable_ptr = mEditWearable->getWearable();
+ const LLViewerWearable *wearable_ptr = mEditWearable->getWearable();
if (!wearable_ptr)
{
llwarns << "Visibility change to invalid wearable" << llendl;
@@ -326,7 +326,7 @@ void LLSidepanelAppearance::showOutfitEditPanel()
toggleOutfitEditPanel(TRUE);
}
-void LLSidepanelAppearance::showWearableEditPanel(LLWearable *wearable /* = NULL*/, BOOL disable_camera_switch)
+void LLSidepanelAppearance::showWearableEditPanel(LLViewerWearable *wearable /* = NULL*/, BOOL disable_camera_switch)
{
toggleMyOutfitsPanel(FALSE);
toggleOutfitEditPanel(FALSE, TRUE); // don't switch out of edit appearance mode
@@ -379,7 +379,7 @@ void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible, BOOL disable_cam
}
}
-void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLWearable *wearable, BOOL disable_camera_switch)
+void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLViewerWearable *wearable, BOOL disable_camera_switch)
{
if (!mEditWearable || mEditWearable->getVisible() == visible)
{
@@ -445,7 +445,7 @@ void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name)
}
//static
-void LLSidepanelAppearance::editWearable(LLWearable *wearable, LLView *data, BOOL disable_camera_switch)
+void LLSidepanelAppearance::editWearable(LLViewerWearable *wearable, LLView *data, BOOL disable_camera_switch)
{
LLFloaterSidePanelContainer::showPanel("appearance", LLSD());
diff --git a/indra/newview/llsidepanelappearance.h b/indra/newview/llsidepanelappearance.h
index 6dd3520266..32bbb8a776 100644
--- a/indra/newview/llsidepanelappearance.h
+++ b/indra/newview/llsidepanelappearance.h
@@ -36,7 +36,7 @@
class LLFilterEditor;
class LLCurrentlyWornFetchObserver;
class LLPanelEditWearable;
-class LLWearable;
+class LLViewerWearable;
class LLPanelOutfitsInventory;
class LLSidepanelAppearance : public LLPanel
@@ -51,7 +51,7 @@ public:
void refreshCurrentOutfitName(const std::string& name = "");
- static void editWearable(LLWearable *wearable, LLView *data, BOOL disable_camera_switch = FALSE);
+ static void editWearable(LLViewerWearable *wearable, LLView *data, BOOL disable_camera_switch = FALSE);
void fetchInventory();
void inventoryFetched();
@@ -59,7 +59,7 @@ public:
void showOutfitsInventoryPanel();
void showOutfitEditPanel();
- void showWearableEditPanel(LLWearable *wearable = NULL, BOOL disable_camera_switch = FALSE);
+ void showWearableEditPanel(LLViewerWearable *wearable = NULL, BOOL disable_camera_switch = FALSE);
void setWearablesLoading(bool val);
void showDefaultSubpart();
void updateScrollingPanelList();
@@ -74,7 +74,7 @@ private:
void toggleMyOutfitsPanel(BOOL visible);
void toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch = FALSE);
- void toggleWearableEditPanel(BOOL visible, LLWearable* wearable = NULL, BOOL disable_camera_switch = FALSE);
+ void toggleWearableEditPanel(BOOL visible, LLViewerWearable* wearable = NULL, BOOL disable_camera_switch = FALSE);
LLFilterEditor* mFilterEditor;
LLPanelOutfitsInventory* mPanelOutfitsInventory;
diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp
index c60b4155a0..070009fe9c 100755
--- a/indra/newview/lltextureview.cpp
+++ b/indra/newview/lltextureview.cpp
@@ -40,7 +40,7 @@
#include "lltooltip.h"
#include "llappviewer.h"
#include "llselectmgr.h"
-#include "lltexlayer.h"
+#include "llviewertexlayer.h"
#include "lltexturecache.h"
#include "lltexturefetch.h"
#include "llviewercontrol.h"
@@ -418,12 +418,12 @@ void LLAvatarTexBar::draw()
LLColor4 color;
U32 line_num = 1;
- for (LLVOAvatarDefines::LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDefines::LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
- baked_iter != LLVOAvatarDefines::LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
+ for (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin();
+ baked_iter != LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end();
++baked_iter)
{
- const LLVOAvatarDefines::EBakedTextureIndex baked_index = baked_iter->first;
- const LLTexLayerSet *layerset = avatarp->debugGetLayerSet(baked_index);
+ const LLAvatarAppearanceDefines::EBakedTextureIndex baked_index = baked_iter->first;
+ const LLViewerTexLayerSet *layerset = avatarp->debugGetLayerSet(baked_index);
if (!layerset) continue;
const LLTexLayerSetBuffer *layerset_buffer = layerset->getComposite();
if (!layerset_buffer) continue;
diff --git a/indra/newview/llviewerjoint.h b/indra/newview/llviewerjoint.h
index 76e3833acb..531c0f765c 100644
--- a/indra/newview/llviewerjoint.h
+++ b/indra/newview/llviewerjoint.h
@@ -31,6 +31,7 @@
// Header Files
//-----------------------------------------------------------------------------
#include "lljoint.h"
+#include "lljointpickname.h"
class LLFace;
class LLViewerJointMesh;
@@ -103,21 +104,8 @@ public:
F32 getLOD() { return mMinPixelArea; }
void setLOD( F32 pixelArea ) { mMinPixelArea = pixelArea; }
- // Sets the OpenGL selection stack name that is pushed and popped
- // with this joint state. The default value indicates that no name
- // should be pushed/popped.
- enum PickName
- {
- PN_DEFAULT = -1,
- PN_0 = 0,
- PN_1 = 1,
- PN_2 = 2,
- PN_3 = 3,
- PN_4 = 4,
- PN_5 = 5
- };
- void setPickName(PickName name) { mPickName = name; }
- PickName getPickName() { return mPickName; }
+ void setPickName(LLJointPickName name) { mPickName = name; }
+ LLJointPickName getPickName() { return mPickName; }
virtual void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area);
virtual void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE, bool terse_update = false);
@@ -141,7 +129,7 @@ protected:
BOOL mValid;
U32 mComponents;
F32 mMinPixelArea;
- PickName mPickName;
+ LLJointPickName mPickName;
BOOL mVisible;
S32 mMeshID;
};
diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp
index 5d1aa870a3..79800c1df3 100755
--- a/indra/newview/llviewerjointmesh.cpp
+++ b/indra/newview/llviewerjointmesh.cpp
@@ -42,7 +42,7 @@
#include "llface.h"
#include "llgldbg.h"
#include "llglheaders.h"
-#include "lltexlayer.h"
+#include "llviewertexlayer.h"
#include "llviewercamera.h"
#include "llviewercontrol.h"
#include "llviewertexturelist.h"
@@ -248,7 +248,7 @@ void LLViewerJointMesh::setTexture( LLViewerTexture *texture )
// LLViewerJointMesh::setLayerSet()
// Sets the shape texture (takes precedence over normal texture)
//--------------------------------------------------------------------
-void LLViewerJointMesh::setLayerSet( LLTexLayerSet* layer_set )
+void LLViewerJointMesh::setLayerSet( LLViewerTexLayerSet* layer_set )
{
mLayerSet = layer_set;
diff --git a/indra/newview/llviewerjointmesh.h b/indra/newview/llviewerjointmesh.h
index dd5dae1dc1..ff6bed4f0f 100755
--- a/indra/newview/llviewerjointmesh.h
+++ b/indra/newview/llviewerjointmesh.h
@@ -35,7 +35,7 @@
class LLDrawable;
class LLFace;
class LLCharacter;
-class LLTexLayerSet;
+class LLViewerTexLayerSet;
typedef enum e_avatar_render_pass
{
@@ -67,7 +67,7 @@ protected:
// LLColor4 mSpecular; // specular color (always white for now)
F32 mShiny; // shiny value
LLPointer<LLViewerTexture> mTexture; // ptr to a global texture
- LLTexLayerSet* mLayerSet; // ptr to a layer set owned by the avatar
+ LLViewerTexLayerSet* mLayerSet; // ptr to a layer set owned by the avatar
U32 mTestImageName; // handle to a temporary texture for previewing uploads
LLPolyMesh* mMesh; // ptr to a global polymesh
BOOL mCullBackFaces; // true by default
@@ -109,7 +109,7 @@ public:
void setTestTexture( U32 name ) { mTestImageName = name; }
// Sets layer set responsible for a dynamic shape texture (takes precedence over normal texture)
- void setLayerSet( LLTexLayerSet* layer_set );
+ void setLayerSet( LLViewerTexLayerSet* layer_set );
// Gets the poly mesh
LLPolyMesh *getMesh();
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 3c0136c258..f660d883b3 100755
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -122,7 +122,7 @@
#include "llpathfindingmanager.h"
#include "boost/unordered_map.hpp"
-using namespace LLVOAvatarDefines;
+using namespace LLAvatarAppearanceDefines;
typedef LLPointer<LLViewerObject> LLViewerObjectPtr;
@@ -7376,7 +7376,7 @@ void handle_grab_baked_texture(void* data)
if(folder_id.notNull())
{
std::string name;
- name = "Baked " + LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_tex_index)->mNameCapitalized + " Texture";
+ name = "Baked " + LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_tex_index)->mNameCapitalized + " Texture";
LLUUID item_id;
item_id.generate();
diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h
index d6dd645e8c..e3d28f2f5c 100644
--- a/indra/newview/llviewershadermgr.h
+++ b/indra/newview/llviewershadermgr.h
@@ -229,7 +229,6 @@ extern LLGLSLShader gSplatTextureRectProgram;
extern LLGLSLShader gGlowCombineFXAAProgram;
extern LLGLSLShader gDebugProgram;
extern LLGLSLShader gClipProgram;
-extern LLGLSLShader gAlphaMaskProgram;
//output tex0[tc0] + tex1[tc1]
extern LLGLSLShader gTwoTextureAddProgram;
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index d1c6b7ea79..f049130f3a 100755
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -41,7 +41,6 @@
#include "lltexturefetch.h"
#include "llviewerobjectlist.h"
#include "llviewertexturelist.h"
-#include "lltexlayer.h"
#include "lltexlayerparams.h"
#include "llsurface.h"
#include "llvlmanager.h"
@@ -55,6 +54,7 @@
#include "llviewerregion.h"
#include "llvoavatar.h"
#include "llvoavatarself.h"
+#include "llviewertexlayer.h"
#include "llviewerwindow.h" // *TODO: remove, only used for width/height
#include "llworld.h"
#include "llfeaturemanager.h"
diff --git a/indra/newview/llviewertexlayer.cpp b/indra/newview/llviewertexlayer.cpp
new file mode 100644
index 0000000000..051aa41ed1
--- /dev/null
+++ b/indra/newview/llviewertexlayer.cpp
@@ -0,0 +1,815 @@
+/**
+ * @file llviewertexlayer.cpp
+ * @brief Viewer texture layer. Used for avatars.
+ *
+ * $LicenseInfo:firstyear=2012&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llviewertexlayer.h"
+
+#include "llagent.h"
+#include "llimagej2c.h"
+#include "llnotificationsutil.h"
+#include "llvfile.h"
+#include "llvfs.h"
+#include "llviewerregion.h"
+#include "llglslshader.h"
+#include "llvoavatarself.h"
+#include "pipeline.h"
+#include "llassetuploadresponders.h"
+#include "llviewercontrol.h"
+
+static const S32 BAKE_UPLOAD_ATTEMPTS = 7;
+static const F32 BAKE_UPLOAD_RETRY_DELAY = 2.f; // actual delay grows by power of 2 each attempt
+
+// runway consolidate
+extern std::string self_av_string();
+
+
+//-----------------------------------------------------------------------------
+// LLBakedUploadData()
+//-----------------------------------------------------------------------------
+LLBakedUploadData::LLBakedUploadData(const LLVOAvatarSelf* avatar,
+ LLViewerTexLayerSet* layerset,
+ const LLUUID& id,
+ bool highest_res) :
+ mAvatar(avatar),
+ mTexLayerSet(layerset),
+ mID(id),
+ mStartTime(LLFrameTimer::getTotalTime()), // Record starting time
+ mIsHighestRes(highest_res)
+{
+}
+
+//-----------------------------------------------------------------------------
+// LLTexLayerSetBuffer
+// The composite image that a LLViewerTexLayerSet writes to. Each LLViewerTexLayerSet has one.
+//-----------------------------------------------------------------------------
+
+// static
+S32 LLTexLayerSetBuffer::sGLByteCount = 0;
+
+LLTexLayerSetBuffer::LLTexLayerSetBuffer(LLViewerTexLayerSet* const owner,
+ S32 width, S32 height) :
+ // ORDER_LAST => must render these after the hints are created.
+ LLViewerDynamicTexture( width, height, 4, LLViewerDynamicTexture::ORDER_LAST, TRUE ),
+ mUploadPending(FALSE), // Not used for any logic here, just to sync sending of updates
+ mNeedsUpload(FALSE),
+ mNumLowresUploads(0),
+ mUploadFailCount(0),
+ mNeedsUpdate(TRUE),
+ mNumLowresUpdates(0),
+ mTexLayerSet(owner)
+{
+ LLTexLayerSetBuffer::sGLByteCount += getSize();
+ mNeedsUploadTimer.start();
+ mNeedsUpdateTimer.start();
+}
+
+LLTexLayerSetBuffer::~LLTexLayerSetBuffer()
+{
+ LLTexLayerSetBuffer::sGLByteCount -= getSize();
+ destroyGLTexture();
+ for( S32 order = 0; order < ORDER_COUNT; order++ )
+ {
+ LLViewerDynamicTexture::sInstances[order].erase(this); // will fail in all but one case.
+ }
+}
+
+//virtual
+S8 LLTexLayerSetBuffer::getType() const
+{
+ return LLViewerDynamicTexture::LL_TEX_LAYER_SET_BUFFER ;
+}
+
+//virtual
+void LLTexLayerSetBuffer::restoreGLTexture()
+{
+ LLViewerDynamicTexture::restoreGLTexture() ;
+}
+
+//virtual
+void LLTexLayerSetBuffer::destroyGLTexture()
+{
+ LLViewerDynamicTexture::destroyGLTexture() ;
+}
+
+// static
+void LLTexLayerSetBuffer::dumpTotalByteCount()
+{
+ llinfos << "Composite System GL Buffers: " << (LLTexLayerSetBuffer::sGLByteCount/1024) << "KB" << llendl;
+}
+
+void LLTexLayerSetBuffer::requestUpdate()
+{
+ restartUpdateTimer();
+ mNeedsUpdate = TRUE;
+ mNumLowresUpdates = 0;
+ // If we're in the middle of uploading a baked texture, we don't care about it any more.
+ // When it's downloaded, ignore it.
+ mUploadID.setNull();
+}
+
+void LLTexLayerSetBuffer::requestUpload()
+{
+ conditionalRestartUploadTimer();
+ mNeedsUpload = TRUE;
+ mNumLowresUploads = 0;
+ mUploadPending = TRUE;
+}
+
+void LLTexLayerSetBuffer::conditionalRestartUploadTimer()
+{
+ // If we requested a new upload but haven't even uploaded
+ // a low res version of our last upload request, then
+ // keep the timer ticking instead of resetting it.
+ if (mNeedsUpload && (mNumLowresUploads == 0))
+ {
+ mNeedsUploadTimer.unpause();
+ }
+ else
+ {
+ mNeedsUploadTimer.reset();
+ mNeedsUploadTimer.start();
+ }
+}
+
+void LLTexLayerSetBuffer::restartUpdateTimer()
+{
+ mNeedsUpdateTimer.reset();
+ mNeedsUpdateTimer.start();
+}
+
+void LLTexLayerSetBuffer::cancelUpload()
+{
+ mNeedsUpload = FALSE;
+ mUploadPending = FALSE;
+ mNeedsUploadTimer.pause();
+ mUploadRetryTimer.reset();
+}
+
+void LLTexLayerSetBuffer::pushProjection() const
+{
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+ gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
+ gGL.loadIdentity();
+}
+
+void LLTexLayerSetBuffer::popProjection() const
+{
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
+}
+
+// virtual
+BOOL LLTexLayerSetBuffer::needsRender()
+{
+ llassert(mTexLayerSet->getAvatarAppearance() == gAgentAvatarp);
+ if (!isAgentAvatarValid()) return FALSE;
+
+ const BOOL upload_now = mNeedsUpload && isReadyToUpload();
+ const BOOL update_now = mNeedsUpdate && isReadyToUpdate();
+
+ // Don't render if we don't want to (or aren't ready to) upload or update.
+ if (!(update_now || upload_now))
+ {
+ return FALSE;
+ }
+
+ // Don't render if we're animating our appearance.
+ if (gAgentAvatarp->getIsAppearanceAnimating())
+ {
+ return FALSE;
+ }
+
+ // Don't render if we are trying to create a shirt texture but aren't wearing a skirt.
+ if (gAgentAvatarp->getBakedTE(mTexLayerSet) == LLAvatarAppearanceDefines::TEX_SKIRT_BAKED &&
+ !gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT))
+ {
+ cancelUpload();
+ return FALSE;
+ }
+
+ // Render if we have at least minimal level of detail for each local texture.
+ return mTexLayerSet->isLocalTextureDataAvailable();
+}
+
+void LLTexLayerSetBuffer::preRender(BOOL clear_depth)
+{
+ // Set up an ortho projection
+ pushProjection();
+
+ // keep depth buffer, we don't need to clear it
+ LLViewerDynamicTexture::preRender(FALSE);
+}
+
+void LLTexLayerSetBuffer::postRender(BOOL success)
+{
+ popProjection();
+
+ LLViewerDynamicTexture::postRender(success);
+}
+
+BOOL LLTexLayerSetBuffer::render()
+{
+ // Default color mask for tex layer render
+ gGL.setColorMask(true, true);
+
+ // do we need to upload, and do we have sufficient data to create an uploadable composite?
+ // TODO: When do we upload the texture if gAgent.mNumPendingQueries is non-zero?
+ const BOOL upload_now = mNeedsUpload && isReadyToUpload();
+ const BOOL update_now = mNeedsUpdate && isReadyToUpdate();
+
+ BOOL success = TRUE;
+
+ bool use_shaders = LLGLSLShader::sNoFixedFunction;
+
+ if (use_shaders)
+ {
+ gAlphaMaskProgram.bind();
+ gAlphaMaskProgram.setMinimumAlpha(0.004f);
+ }
+
+ LLVertexBuffer::unbind();
+
+ // Composite the color data
+ LLGLSUIDefault gls_ui;
+ success &= mTexLayerSet->render( mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight );
+ gGL.flush();
+
+ if(upload_now)
+ {
+ if (!success)
+ {
+ llinfos << "Failed attempt to bake " << mTexLayerSet->getBodyRegionName() << llendl;
+ mUploadPending = FALSE;
+ }
+ else
+ {
+ if (mTexLayerSet->isVisible())
+ {
+ mTexLayerSet->getAvatar()->debugBakedTextureUpload(mTexLayerSet->getBakedTexIndex(), FALSE); // FALSE for start of upload, TRUE for finish.
+ doUpload();
+ }
+ else
+ {
+ mUploadPending = FALSE;
+ mNeedsUpload = FALSE;
+ mNeedsUploadTimer.pause();
+ mTexLayerSet->getAvatar()->setNewBakedTexture(mTexLayerSet->getBakedTexIndex(),IMG_INVISIBLE);
+ }
+ }
+ }
+
+ if (update_now)
+ {
+ doUpdate();
+ }
+
+ if (use_shaders)
+ {
+ gAlphaMaskProgram.unbind();
+ }
+
+ LLVertexBuffer::unbind();
+
+ // reset GL state
+ gGL.setColorMask(true, true);
+ gGL.setSceneBlendType(LLRender::BT_ALPHA);
+
+ // we have valid texture data now
+ mGLTexturep->setGLTextureCreated(true);
+
+ return success;
+}
+
+BOOL LLTexLayerSetBuffer::isInitialized(void) const
+{
+ return mGLTexturep.notNull() && mGLTexturep->isGLTextureCreated();
+}
+
+BOOL LLTexLayerSetBuffer::uploadPending() const
+{
+ return mUploadPending;
+}
+
+BOOL LLTexLayerSetBuffer::uploadNeeded() const
+{
+ return mNeedsUpload;
+}
+
+BOOL LLTexLayerSetBuffer::uploadInProgress() const
+{
+ return !mUploadID.isNull();
+}
+
+BOOL LLTexLayerSetBuffer::isReadyToUpload() const
+{
+ if (!gAgentQueryManager.hasNoPendingQueries()) return FALSE; // Can't upload if there are pending queries.
+ if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures()) return FALSE; // Don't upload if avatar is using composites.
+
+ BOOL ready = FALSE;
+ if (mTexLayerSet->isLocalTextureDataFinal())
+ {
+ // If we requested an upload and have the final LOD ready, upload (or wait a while if this is a retry)
+ if (mUploadFailCount == 0)
+ {
+ ready = TRUE;
+ }
+ else
+ {
+ ready = mUploadRetryTimer.getElapsedTimeF32() >= BAKE_UPLOAD_RETRY_DELAY * (1 << (mUploadFailCount - 1));
+ }
+ }
+ else
+ {
+ // Upload if we've hit a timeout. Upload is a pretty expensive process so we need to make sure
+ // we aren't doing uploads too frequently.
+ const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedTextureUploadTimeout");
+ if (texture_timeout != 0)
+ {
+ // The timeout period increases exponentially between every lowres upload in order to prevent
+ // spamming the server with frequent uploads.
+ const U32 texture_timeout_threshold = texture_timeout*(1 << mNumLowresUploads);
+
+ // If we hit our timeout and have textures available at even lower resolution, then upload.
+ const BOOL is_upload_textures_timeout = mNeedsUploadTimer.getElapsedTimeF32() >= texture_timeout_threshold;
+ const BOOL has_lower_lod = mTexLayerSet->isLocalTextureDataAvailable();
+ ready = has_lower_lod && is_upload_textures_timeout;
+ }
+ }
+
+ return ready;
+}
+
+BOOL LLTexLayerSetBuffer::isReadyToUpdate() const
+{
+ // If we requested an update and have the final LOD ready, then update.
+ if (mTexLayerSet->isLocalTextureDataFinal()) return TRUE;
+
+ // If we haven't done an update yet, then just do one now regardless of state of textures.
+ if (mNumLowresUpdates == 0) return TRUE;
+
+ // Update if we've hit a timeout. Unlike for uploads, we can make this timeout fairly small
+ // since render unnecessarily doesn't cost much.
+ const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedLocalTextureUpdateTimeout");
+ if (texture_timeout != 0)
+ {
+ // If we hit our timeout and have textures available at even lower resolution, then update.
+ const BOOL is_update_textures_timeout = mNeedsUpdateTimer.getElapsedTimeF32() >= texture_timeout;
+ const BOOL has_lower_lod = mTexLayerSet->isLocalTextureDataAvailable();
+ if (has_lower_lod && is_update_textures_timeout) return TRUE;
+ }
+
+ return FALSE;
+}
+
+BOOL LLTexLayerSetBuffer::requestUpdateImmediate()
+{
+ mNeedsUpdate = TRUE;
+ BOOL result = FALSE;
+
+ if (needsRender())
+ {
+ preRender(FALSE);
+ result = render();
+ postRender(result);
+ }
+
+ return result;
+}
+
+// Create the baked texture, send it out to the server, then wait for it to come
+// back so we can switch to using it.
+void LLTexLayerSetBuffer::doUpload()
+{
+ llinfos << "Uploading baked " << mTexLayerSet->getBodyRegionName() << llendl;
+ LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_BAKES);
+
+ // Don't need caches since we're baked now. (note: we won't *really* be baked
+ // until this image is sent to the server and the Avatar Appearance message is received.)
+ mTexLayerSet->deleteCaches();
+
+ // Get the COLOR information from our texture
+ U8* baked_color_data = new U8[ mFullWidth * mFullHeight * 4 ];
+ glReadPixels(mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, GL_RGBA, GL_UNSIGNED_BYTE, baked_color_data );
+ stop_glerror();
+
+ // Get the MASK information from our texture
+ LLGLSUIDefault gls_ui;
+ LLPointer<LLImageRaw> baked_mask_image = new LLImageRaw(mFullWidth, mFullHeight, 1 );
+ U8* baked_mask_data = baked_mask_image->getData();
+ mTexLayerSet->gatherMorphMaskAlpha(baked_mask_data, mFullWidth, mFullHeight);
+
+
+ // Create the baked image from our color and mask information
+ const S32 baked_image_components = 5; // red green blue [bump] clothing
+ LLPointer<LLImageRaw> baked_image = new LLImageRaw( mFullWidth, mFullHeight, baked_image_components );
+ U8* baked_image_data = baked_image->getData();
+ S32 i = 0;
+ for (S32 u=0; u < mFullWidth; u++)
+ {
+ for (S32 v=0; v < mFullHeight; v++)
+ {
+ baked_image_data[5*i + 0] = baked_color_data[4*i + 0];
+ baked_image_data[5*i + 1] = baked_color_data[4*i + 1];
+ baked_image_data[5*i + 2] = baked_color_data[4*i + 2];
+ baked_image_data[5*i + 3] = baked_color_data[4*i + 3]; // alpha should be correct for eyelashes.
+ baked_image_data[5*i + 4] = baked_mask_data[i];
+ i++;
+ }
+ }
+
+ LLPointer<LLImageJ2C> compressedImage = new LLImageJ2C;
+ const char* comment_text = LINDEN_J2C_COMMENT_PREFIX "RGBHM"; // writes into baked_color_data. 5 channels (rgb, heightfield/alpha, mask)
+ if (compressedImage->encode(baked_image, comment_text))
+ {
+ LLTransactionID tid;
+ tid.generate();
+ const LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
+ if (LLVFile::writeFile(compressedImage->getData(), compressedImage->getDataSize(),
+ gVFS, asset_id, LLAssetType::AT_TEXTURE))
+ {
+ // Read back the file and validate.
+ BOOL valid = FALSE;
+ LLPointer<LLImageJ2C> integrity_test = new LLImageJ2C;
+ S32 file_size = 0;
+ U8* data = LLVFile::readFile(gVFS, asset_id, LLAssetType::AT_TEXTURE, &file_size);
+ if (data)
+ {
+ valid = integrity_test->validate(data, file_size); // integrity_test will delete 'data'
+ }
+ else
+ {
+ integrity_test->setLastError("Unable to read entire file");
+ }
+
+ if (valid)
+ {
+ const bool highest_lod = mTexLayerSet->isLocalTextureDataFinal();
+ // Baked_upload_data is owned by the responder and deleted after the request completes.
+ LLBakedUploadData* baked_upload_data = new LLBakedUploadData(gAgentAvatarp,
+ this->mTexLayerSet,
+ asset_id,
+ highest_lod);
+ // upload ID is used to avoid overlaps, e.g. when the user rapidly makes two changes outside of Face Edit.
+ mUploadID = asset_id;
+
+ // Upload the image
+ const std::string url = gAgent.getRegion()->getCapability("UploadBakedTexture");
+ if(!url.empty()
+ && !LLPipeline::sForceOldBakedUpload // toggle debug setting UploadBakedTexOld to change between the new caps method and old method
+ && (mUploadFailCount < (BAKE_UPLOAD_ATTEMPTS - 1))) // Try last ditch attempt via asset store if cap upload is failing.
+ {
+ LLSD body = LLSD::emptyMap();
+ // The responder will call LLTexLayerSetBuffer::onTextureUploadComplete()
+ LLHTTPClient::post(url, body, new LLSendTexLayerResponder(body, mUploadID, LLAssetType::AT_TEXTURE, baked_upload_data));
+ llinfos << "Baked texture upload via capability of " << mUploadID << " to " << url << llendl;
+ }
+ else
+ {
+ gAssetStorage->storeAssetData(tid,
+ LLAssetType::AT_TEXTURE,
+ LLTexLayerSetBuffer::onTextureUploadComplete,
+ baked_upload_data,
+ TRUE, // temp_file
+ TRUE, // is_priority
+ TRUE); // store_local
+ llinfos << "Baked texture upload via Asset Store." << llendl;
+ }
+
+ if (highest_lod)
+ {
+ // Sending the final LOD for the baked texture. All done, pause
+ // the upload timer so we know how long it took.
+ mNeedsUpload = FALSE;
+ mNeedsUploadTimer.pause();
+ }
+ else
+ {
+ // Sending a lower level LOD for the baked texture. Restart the upload timer.
+ mNumLowresUploads++;
+ mNeedsUploadTimer.unpause();
+ mNeedsUploadTimer.reset();
+ }
+
+ // Print out notification that we uploaded this texture.
+ if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
+ {
+ const std::string lod_str = highest_lod ? "HighRes" : "LowRes";
+ LLSD args;
+ args["EXISTENCE"] = llformat("%d",(U32)mTexLayerSet->getAvatar()->debugGetExistenceTimeElapsedF32());
+ args["TIME"] = llformat("%d",(U32)mNeedsUploadTimer.getElapsedTimeF32());
+ args["BODYREGION"] = mTexLayerSet->getBodyRegionName();
+ args["RESOLUTION"] = lod_str;
+ LLNotificationsUtil::add("AvatarRezSelfBakedTextureUploadNotification",args);
+ LL_DEBUGS("Avatar") << self_av_string() << "Uploading [ name: " << mTexLayerSet->getBodyRegionName() << " res:" << lod_str << " time:" << (U32)mNeedsUploadTimer.getElapsedTimeF32() << " ]" << LL_ENDL;
+ }
+ }
+ else
+ {
+ // The read back and validate operation failed. Remove the uploaded file.
+ mUploadPending = FALSE;
+ LLVFile file(gVFS, asset_id, LLAssetType::AT_TEXTURE, LLVFile::WRITE);
+ file.remove();
+ llinfos << "Unable to create baked upload file (reason: corrupted)." << llendl;
+ }
+ }
+ }
+ else
+ {
+ // The VFS write file operation failed.
+ mUploadPending = FALSE;
+ llinfos << "Unable to create baked upload file (reason: failed to write file)" << llendl;
+ }
+
+ delete [] baked_color_data;
+}
+
+// Mostly bookkeeping; don't need to actually "do" anything since
+// render() will actually do the update.
+void LLTexLayerSetBuffer::doUpdate()
+{
+ const BOOL highest_lod = mTexLayerSet->isLocalTextureDataFinal();
+ if (highest_lod)
+ {
+ mNeedsUpdate = FALSE;
+ }
+ else
+ {
+ mNumLowresUpdates++;
+ }
+
+ restartUpdateTimer();
+
+ // need to switch to using this layerset if this is the first update
+ // after getting the lowest LOD
+ mTexLayerSet->getAvatar()->updateMeshTextures();
+
+ // Print out notification that we updated this texture.
+ if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
+ {
+ const BOOL highest_lod = mTexLayerSet->isLocalTextureDataFinal();
+ const std::string lod_str = highest_lod ? "HighRes" : "LowRes";
+ LLSD args;
+ args["EXISTENCE"] = llformat("%d",(U32)mTexLayerSet->getAvatar()->debugGetExistenceTimeElapsedF32());
+ args["TIME"] = llformat("%d",(U32)mNeedsUpdateTimer.getElapsedTimeF32());
+ args["BODYREGION"] = mTexLayerSet->getBodyRegionName();
+ args["RESOLUTION"] = lod_str;
+ LLNotificationsUtil::add("AvatarRezSelfBakedTextureUpdateNotification",args);
+ LL_DEBUGS("Avatar") << self_av_string() << "Locally updating [ name: " << mTexLayerSet->getBodyRegionName() << " res:" << lod_str << " time:" << (U32)mNeedsUpdateTimer.getElapsedTimeF32() << " ]" << LL_ENDL;
+ }
+}
+
+// static
+void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid,
+ void* userdata,
+ S32 result,
+ LLExtStat ext_status) // StoreAssetData callback (not fixed)
+{
+ LLBakedUploadData* baked_upload_data = (LLBakedUploadData*)userdata;
+
+ if (isAgentAvatarValid() &&
+ !gAgentAvatarp->isDead() &&
+ (baked_upload_data->mAvatar == gAgentAvatarp) && // Sanity check: only the user's avatar should be uploading textures.
+ (baked_upload_data->mTexLayerSet->hasComposite()))
+ {
+ LLTexLayerSetBuffer* layerset_buffer = baked_upload_data->mTexLayerSet->getComposite();
+ S32 failures = layerset_buffer->mUploadFailCount;
+ layerset_buffer->mUploadFailCount = 0;
+
+ if (layerset_buffer->mUploadID.isNull())
+ {
+ // The upload got canceled, we should be in the
+ // process of baking a new texture so request an
+ // upload with the new data
+
+ // BAP: does this really belong in this callback, as
+ // opposed to where the cancellation takes place?
+ // suspect this does nothing.
+ layerset_buffer->requestUpload();
+ }
+ else if (baked_upload_data->mID == layerset_buffer->mUploadID)
+ {
+ // This is the upload we're currently waiting for.
+ layerset_buffer->mUploadID.setNull();
+ const std::string name(baked_upload_data->mTexLayerSet->getBodyRegionName());
+ const std::string resolution = baked_upload_data->mIsHighestRes ? " full res " : " low res ";
+ if (result >= 0)
+ {
+ layerset_buffer->mUploadPending = FALSE; // Allows sending of AgentSetAppearance later
+ LLAvatarAppearanceDefines::ETextureIndex baked_te = gAgentAvatarp->getBakedTE(layerset_buffer->mTexLayerSet);
+ // Update baked texture info with the new UUID
+ U64 now = LLFrameTimer::getTotalTime(); // Record starting time
+ llinfos << "Baked" << resolution << "texture upload for " << name << " took " << (S32)((now - baked_upload_data->mStartTime) / 1000) << " ms" << llendl;
+ gAgentAvatarp->setNewBakedTexture(baked_te, uuid);
+ }
+ else
+ {
+ ++failures;
+ S32 max_attempts = baked_upload_data->mIsHighestRes ? BAKE_UPLOAD_ATTEMPTS : 1; // only retry final bakes
+ llwarns << "Baked" << resolution << "texture upload for " << name << " failed (attempt " << failures << "/" << max_attempts << ")" << llendl;
+ if (failures < max_attempts)
+ {
+ layerset_buffer->mUploadFailCount = failures;
+ layerset_buffer->mUploadRetryTimer.start();
+ layerset_buffer->requestUpload();
+ }
+ }
+ }
+ else
+ {
+ llinfos << "Received baked texture out of date, ignored." << llendl;
+ }
+
+ gAgentAvatarp->dirtyMesh();
+ }
+ else
+ {
+ // Baked texture failed to upload (in which case since we
+ // didn't set the new baked texture, it means that they'll try
+ // and rebake it at some point in the future (after login?)),
+ // or this response to upload is out of date, in which case a
+ // current response should be on the way or already processed.
+ llwarns << "Baked upload failed" << llendl;
+ }
+
+ delete baked_upload_data;
+}
+
+//-----------------------------------------------------------------------------
+// LLViewerTexLayerSet
+// An ordered set of texture layers that get composited into a single texture.
+//-----------------------------------------------------------------------------
+
+LLViewerTexLayerSet::LLViewerTexLayerSet(LLAvatarAppearance* const appearance) :
+ LLTexLayerSet(appearance),
+ mComposite( NULL ),
+ mUpdatesEnabled( FALSE )
+{
+}
+
+// virtual
+LLViewerTexLayerSet::~LLViewerTexLayerSet()
+{
+}
+
+// Returns TRUE if at least one packet of data has been received for each of the textures that this layerset depends on.
+BOOL LLViewerTexLayerSet::isLocalTextureDataAvailable() const
+{
+ if (!mAvatarAppearance->isSelf()) return FALSE;
+ return getAvatar()->isLocalTextureDataAvailable(this);
+}
+
+
+// Returns TRUE if all of the data for the textures that this layerset depends on have arrived.
+BOOL LLViewerTexLayerSet::isLocalTextureDataFinal() const
+{
+ if (!mAvatarAppearance->isSelf()) return FALSE;
+ return getAvatar()->isLocalTextureDataFinal(this);
+}
+
+// virtual
+void LLViewerTexLayerSet::requestUpdate()
+{
+ if( mUpdatesEnabled )
+ {
+ createComposite();
+ mComposite->requestUpdate();
+ }
+}
+
+void LLViewerTexLayerSet::requestUpload()
+{
+ createComposite();
+ mComposite->requestUpload();
+}
+
+void LLViewerTexLayerSet::cancelUpload()
+{
+ if(mComposite)
+ {
+ mComposite->cancelUpload();
+ }
+}
+
+void LLViewerTexLayerSet::createComposite()
+{
+ if(!mComposite)
+ {
+ S32 width = mInfo->getWidth();
+ S32 height = mInfo->getHeight();
+ // Composite other avatars at reduced resolution
+ if( !mAvatarAppearance->isSelf() )
+ {
+ llerrs << "composites should not be created for non-self avatars!" << llendl;
+ }
+ mComposite = new LLTexLayerSetBuffer( this, width, height );
+ }
+}
+
+void LLViewerTexLayerSet::destroyComposite()
+{
+ if( mComposite )
+ {
+ mComposite = NULL;
+ }
+}
+
+void LLViewerTexLayerSet::setUpdatesEnabled( BOOL b )
+{
+ mUpdatesEnabled = b;
+}
+
+
+void LLViewerTexLayerSet::updateComposite()
+{
+ createComposite();
+ mComposite->requestUpdateImmediate();
+}
+
+LLTexLayerSetBuffer* LLViewerTexLayerSet::getComposite()
+{
+ if (!mComposite)
+ {
+ createComposite();
+ }
+ return mComposite;
+}
+
+const LLTexLayerSetBuffer* LLViewerTexLayerSet::getComposite() const
+{
+ return mComposite;
+}
+
+void LLViewerTexLayerSet::gatherMorphMaskAlpha(U8 *data, S32 width, S32 height)
+{
+ memset(data, 255, width * height);
+
+ for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
+ {
+ LLTexLayerInterface* layer = *iter;
+ layer->gatherAlphaMasks(data, mComposite->getOriginX(),mComposite->getOriginY(), width, height);
+ }
+
+ // Set alpha back to that of our alpha masks.
+ renderAlphaMaskTextures(mComposite->getOriginX(), mComposite->getOriginY(), width, height, true);
+}
+
+
+LLVOAvatarSelf* LLViewerTexLayerSet::getAvatar() const
+{
+ return dynamic_cast<LLVOAvatarSelf*> (mAvatarAppearance);
+}
+
+
+
+const std::string LLTexLayerSetBuffer::dumpTextureInfo() const
+{
+ if (!isAgentAvatarValid()) return "";
+
+ const BOOL is_high_res = !mNeedsUpload;
+ const U32 num_low_res = mNumLowresUploads;
+ const U32 upload_time = (U32)mNeedsUploadTimer.getElapsedTimeF32();
+ const std::string local_texture_info = gAgentAvatarp->debugDumpLocalTextureDataInfo(mTexLayerSet);
+
+ std::string status = "CREATING ";
+ if (!uploadNeeded()) status = "DONE ";
+ if (uploadInProgress()) status = "UPLOADING";
+
+ std::string text = llformat("[%s] [HiRes:%d LoRes:%d] [Elapsed:%d] %s",
+ status.c_str(),
+ is_high_res, num_low_res,
+ upload_time,
+ local_texture_info.c_str());
+ return text;
+}
diff --git a/indra/newview/llviewertexlayer.h b/indra/newview/llviewertexlayer.h
new file mode 100644
index 0000000000..125bf82adf
--- /dev/null
+++ b/indra/newview/llviewertexlayer.h
@@ -0,0 +1,172 @@
+/**
+ * @file llviewertexlayer.h
+ * @brief Viewer Texture layer classes. Used for avatars.
+ *
+ * $LicenseInfo:firstyear=2012&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_VIEWER_TEXLAYER_H
+#define LL_VIEWER_TEXLAYER_H
+
+#include "lldynamictexture.h"
+#include "lltexlayer.h"
+
+class LLVOAvatarSelf;
+class LLTexLayerSetBuffer;
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// LLViewerTexLayerSet
+//
+// An ordered set of texture layers that gets composited into a single texture.
+// Only exists for llavatarappearanceself.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+class LLViewerTexLayerSet : public LLTexLayerSet
+{
+ friend class LLTexLayerSetBuffer;
+public:
+ LLViewerTexLayerSet(LLAvatarAppearance* const appearance);
+ virtual ~LLViewerTexLayerSet();
+
+ LLTexLayerSetBuffer* getComposite();
+ const LLTexLayerSetBuffer* getComposite() const; // Do not create one if it doesn't exist.
+ virtual void requestUpdate();
+ void requestUpload();
+ void cancelUpload();
+ void updateComposite();
+ BOOL isLocalTextureDataAvailable() const;
+ BOOL isLocalTextureDataFinal() const;
+ void createComposite();
+ void destroyComposite();
+ void setUpdatesEnabled(BOOL b);
+ BOOL getUpdatesEnabled() const { return mUpdatesEnabled; }
+ void gatherMorphMaskAlpha(U8 *data, S32 width, S32 height);
+
+ LLVOAvatarSelf* getAvatar() const;
+ BOOL hasComposite() const { return (mComposite.notNull()); }
+
+private:
+ LLPointer<LLTexLayerSetBuffer> mComposite;
+ BOOL mUpdatesEnabled;
+
+};
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// LLTexLayerSetBuffer
+//
+// The composite image that a LLViewerTexLayerSet writes to. Each LLTexLayerSet has one.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+class LLTexLayerSetBuffer : public LLViewerDynamicTexture
+{
+ LOG_CLASS(LLTexLayerSetBuffer);
+
+public:
+ LLTexLayerSetBuffer(LLViewerTexLayerSet* const owner, S32 width, S32 height);
+ virtual ~LLTexLayerSetBuffer();
+
+public:
+ /*virtual*/ S8 getType() const;
+ BOOL isInitialized(void) const;
+ static void dumpTotalByteCount();
+ const std::string dumpTextureInfo() const;
+ virtual void restoreGLTexture();
+ virtual void destroyGLTexture();
+protected:
+ void pushProjection() const;
+ void popProjection() const;
+private:
+ LLViewerTexLayerSet* const mTexLayerSet;
+ static S32 sGLByteCount;
+
+ //--------------------------------------------------------------------
+ // Render
+ //--------------------------------------------------------------------
+public:
+ /*virtual*/ BOOL needsRender();
+protected:
+ BOOL render(S32 x, S32 y, S32 width, S32 height);
+ virtual void preRender(BOOL clear_depth);
+ virtual void postRender(BOOL success);
+ virtual BOOL render();
+
+ //--------------------------------------------------------------------
+ // Uploads
+ //--------------------------------------------------------------------
+public:
+ void requestUpload();
+ void cancelUpload();
+ BOOL uploadNeeded() const; // We need to upload a new texture
+ BOOL uploadInProgress() const; // We have started uploading a new texture and are awaiting the result
+ BOOL uploadPending() const; // We are expecting a new texture to be uploaded at some point
+ static void onTextureUploadComplete(const LLUUID& uuid,
+ void* userdata,
+ S32 result, LLExtStat ext_status);
+protected:
+ BOOL isReadyToUpload() const;
+ void doUpload(); // Does a read back and upload.
+ void conditionalRestartUploadTimer();
+private:
+ BOOL mNeedsUpload; // Whether we need to send our baked textures to the server
+ U32 mNumLowresUploads; // Number of times we've sent a lowres version of our baked textures to the server
+ BOOL mUploadPending; // Whether we have received back the new baked textures
+ LLUUID mUploadID; // The current upload process (null if none).
+ LLFrameTimer mNeedsUploadTimer; // Tracks time since upload was requested and performed.
+ S32 mUploadFailCount; // Number of consecutive upload failures
+ LLFrameTimer mUploadRetryTimer; // Tracks time since last upload failure.
+
+ //--------------------------------------------------------------------
+ // Updates
+ //--------------------------------------------------------------------
+public:
+ void requestUpdate();
+ BOOL requestUpdateImmediate();
+protected:
+ BOOL isReadyToUpdate() const;
+ void doUpdate();
+ void restartUpdateTimer();
+private:
+ BOOL mNeedsUpdate; // Whether we need to locally update our baked textures
+ U32 mNumLowresUpdates; // Number of times we've locally updated with lowres version of our baked textures
+ LLFrameTimer mNeedsUpdateTimer; // Tracks time since update was requested and performed.
+};
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// LLBakedUploadData
+//
+// Used by LLTexLayerSetBuffer for a callback.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+struct LLBakedUploadData
+{
+ LLBakedUploadData(const LLVOAvatarSelf* avatar,
+ LLViewerTexLayerSet* layerset,
+ const LLUUID& id,
+ bool highest_res);
+ ~LLBakedUploadData() {}
+ const LLUUID mID;
+ const LLVOAvatarSelf* mAvatar; // note: backlink only; don't LLPointer
+ LLViewerTexLayerSet* mTexLayerSet;
+ const U64 mStartTime; // for measuring baked texture upload time
+ const bool mIsHighestRes; // whether this is a "final" bake, or intermediate low res
+};
+
+#endif // LL_VIEWER_TEXLAYER_H
+
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 8eb8717de2..c362269b81 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -59,6 +59,7 @@
#include "lltextureatlas.h"
#include "lltextureatlasmanager.h"
#include "lltextureentry.h"
+#include "lltexturemanagerbridge.h"
#include "llmediaentry.h"
#include "llvovolume.h"
#include "llviewermedia.h"
@@ -305,6 +306,26 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromHost(const
return gTextureList.getImageFromHost(image_id, host) ;
}
+// Create a bridge to the viewer texture manager.
+class LLViewerTextureManagerBridge : public LLTextureManagerBridge
+{
+ /*virtual*/ LLPointer<LLTexture> getLocalTexture(BOOL usemipmaps = TRUE, BOOL generate_gl_tex = TRUE)
+ {
+ return LLViewerTextureManager::getLocalTexture(usemipmaps, generate_gl_tex);
+ }
+
+ /*virtual*/ LLPointer<LLTexture> getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex = TRUE)
+ {
+ return LLViewerTextureManager::getLocalTexture(width, height, components, usemipmaps, generate_gl_tex);
+ }
+
+ /*virtual*/ LLTexture* getFetchedTexture(const LLUUID &image_id)
+ {
+ return LLViewerTextureManager::getFetchedTexture(image_id);
+ }
+};
+
+
void LLViewerTextureManager::init()
{
{
@@ -374,6 +395,9 @@ void LLViewerTextureManager::init()
LLViewerTexture::sCheckerBoardImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), TRUE);
LLViewerTexture::initClass() ;
+
+ // Create a texture manager bridge.
+ gTextureManagerBridgep = new LLViewerTextureManagerBridge();
if (LLMetricPerformanceTesterBasic::isMetricLogRequested(sTesterName) && !LLMetricPerformanceTesterBasic::getTester(sTesterName))
{
@@ -390,6 +414,7 @@ void LLViewerTextureManager::cleanup()
{
stop_glerror();
+ delete gTextureManagerBridgep;
LLImageGL::sDefaultGLTexture = NULL ;
LLViewerTexture::sNullImagep = NULL;
LLViewerTexture::sBlackImagep = NULL;
diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h
index 2ea9a07e9a..4b92a2bf8a 100755
--- a/indra/newview/llviewertexture.h
+++ b/indra/newview/llviewertexture.h
@@ -107,39 +107,6 @@ public:
INVALID_TEXTURE_TYPE
};
- enum EBoostLevel
- {
- BOOST_NONE = 0,
- BOOST_AVATAR_BAKED ,
- BOOST_AVATAR ,
- BOOST_CLOUDS ,
- BOOST_SCULPTED ,
-
- BOOST_HIGH = 10,
- BOOST_BUMP ,
- BOOST_TERRAIN , // has to be high priority for minimap / low detail
- BOOST_SELECTED ,
- BOOST_AVATAR_BAKED_SELF ,
- BOOST_AVATAR_SELF , // needed for baking avatar
- BOOST_SUPER_HIGH , //textures higher than this need to be downloaded at the required resolution without delay.
- BOOST_HUD ,
- BOOST_ICON ,
- BOOST_UI ,
- BOOST_PREVIEW ,
- BOOST_MAP ,
- BOOST_MAP_VISIBLE ,
- BOOST_MAX_LEVEL,
-
- //other texture Categories
- LOCAL = BOOST_MAX_LEVEL,
- AVATAR_SCRATCH_TEX,
- DYNAMIC_TEX,
- MEDIA,
- ATLAS,
- OTHER,
- MAX_GL_IMAGE_CATEGORY
- };
-
static S32 getTotalNumOfCategories() ;
static S32 getIndexFromCategory(S32 category) ;
static S32 getCategoryFromIndex(S32 index) ;
@@ -168,7 +135,7 @@ public:
/*virtual*/ bool bindDefaultImage(const S32 stage = 0) ;
/*virtual*/ void forceImmediateUpdate() ;
- const LLUUID& getID() const { return mID; }
+ /*virtual*/ const LLUUID& getID() const { return mID; }
void setBoostLevel(S32 level);
S32 getBoostLevel() { return mBoostLevel; }
@@ -205,24 +172,24 @@ public:
/*virtual*/S32 getWidth(S32 discard_level = -1) const;
/*virtual*/S32 getHeight(S32 discard_level = -1) const;
- BOOL hasGLTexture() const ;
+ /*virtual*/BOOL hasGLTexture() const ;
LLGLuint getTexName() const ;
BOOL createGLTexture() ;
- BOOL createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0, BOOL to_create = TRUE, S32 category = LLViewerTexture::OTHER);
+ /*virtual*/ BOOL createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0, BOOL to_create = TRUE, S32 category = LLTexture::OTHER);
virtual void setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) ;
void setFilteringOption(LLTexUnit::eTextureFilterOptions option);
- void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, BOOL swap_bytes = FALSE);
- void setAddressMode(LLTexUnit::eTextureAddressMode mode);
+ /*virtual*/ void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, BOOL swap_bytes = FALSE);
+ /*virtual*/ void setAddressMode(LLTexUnit::eTextureAddressMode mode);
BOOL setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height);
BOOL setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height);
void setGLTextureCreated (bool initialized);
void setCategory(S32 category) ;
- LLTexUnit::eTextureAddressMode getAddressMode(void) const ;
+ /*virtual*/ LLTexUnit::eTextureAddressMode getAddressMode(void) const ;
S32 getMaxDiscardLevel() const;
S32 getDiscardLevel() const;
- S8 getComponents() const ;
+ /*virtual*/ S8 getComponents() const;
BOOL getBoundRecently() const;
S32 getTextureMemory() const ;
LLGLenum getPrimaryFormat() const;
@@ -761,6 +728,7 @@ public:
static void init() ;
static void cleanup() ;
};
+
//
//this class is used for test/debug only
//it tracks the activities of the texture pipeline
diff --git a/indra/newview/llwearable.cpp b/indra/newview/llviewerwearable.cpp
index 402504933c..0cd3ded371 100644
--- a/indra/newview/llwearable.cpp
+++ b/indra/newview/llviewerwearable.cpp
@@ -1,8 +1,8 @@
/**
- * @file llwearable.cpp
- * @brief LLWearable class implementation
+ * @file llviewerwearable.cpp
+ * @brief LLViewerWearable class implementation
*
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
@@ -29,29 +29,17 @@
#include "llagent.h"
#include "llagentcamera.h"
#include "llagentwearables.h"
-#include "lldictionary.h"
#include "llfloatersidepanelcontainer.h"
-#include "lllocaltextureobject.h"
#include "llnotificationsutil.h"
-#include "llviewertexturelist.h"
-#include "llinventorymodel.h"
-#include "llinventoryobserver.h"
#include "llsidepanelappearance.h"
-#include "lltexlayer.h"
-#include "lltexglobalcolor.h"
-#include "lltrans.h"
-#include "llviewerregion.h"
-#include "llvisualparam.h"
-#include "llvoavatar.h"
+#include "lltextureentry.h"
+#include "llviewertexlayer.h"
#include "llvoavatarself.h"
-#include "llvoavatardefines.h"
-#include "llwearable.h"
+#include "llavatarappearancedefines.h"
+#include "llviewerwearable.h"
#include "llviewercontrol.h"
-using namespace LLVOAvatarDefines;
-
-// static
-S32 LLWearable::sCurrentDefinitionVersion = 1;
+using namespace LLAvatarAppearanceDefines;
// support class - remove for 2.1 (hackity hack hack)
class LLOverrideBakedTextureUpdate
@@ -59,7 +47,7 @@ class LLOverrideBakedTextureUpdate
public:
LLOverrideBakedTextureUpdate(bool temp_state)
{
- U32 num_bakes = (U32) LLVOAvatarDefines::BAKED_NUM_INDICES;
+ U32 num_bakes = (U32) LLAvatarAppearanceDefines::BAKED_NUM_INDICES;
for( U32 index = 0; index < num_bakes; ++index )
{
composite_enabled[index] = gAgentAvatarp->isCompositeUpdateEnabled(index);
@@ -69,135 +57,53 @@ public:
~LLOverrideBakedTextureUpdate()
{
- U32 num_bakes = (U32)LLVOAvatarDefines::BAKED_NUM_INDICES;
+ U32 num_bakes = (U32)LLAvatarAppearanceDefines::BAKED_NUM_INDICES;
for( U32 index = 0; index < num_bakes; ++index )
{
gAgentAvatarp->setCompositeUpdatesEnabled(index, composite_enabled[index]);
}
}
private:
- bool composite_enabled[LLVOAvatarDefines::BAKED_NUM_INDICES];
+ bool composite_enabled[LLAvatarAppearanceDefines::BAKED_NUM_INDICES];
};
// Private local functions
-static std::string terse_F32_to_string(F32 f);
static std::string asset_id_to_filename(const LLUUID &asset_id);
-LLWearable::LLWearable(const LLTransactionID& transaction_id) :
- mDefinitionVersion(LLWearable::sCurrentDefinitionVersion),
- mType(LLWearableType::WT_INVALID)
+LLViewerWearable::LLViewerWearable(const LLTransactionID& transaction_id) :
+ LLWearable()
{
mTransactionID = transaction_id;
mAssetID = mTransactionID.makeAssetID(gAgent.getSecureSessionID());
}
-LLWearable::LLWearable(const LLAssetID& asset_id) :
- mDefinitionVersion( LLWearable::sCurrentDefinitionVersion ),
- mType(LLWearableType::WT_INVALID)
+LLViewerWearable::LLViewerWearable(const LLAssetID& asset_id) :
+ LLWearable()
{
mAssetID = asset_id;
mTransactionID.setNull();
}
-LLWearable::~LLWearable()
-{
-}
-
-const std::string& LLWearable::getTypeLabel() const
-{
- return LLWearableType::getTypeLabel(mType);
-}
-
-const std::string& LLWearable::getTypeName() const
-{
- return LLWearableType::getTypeName(mType);
-}
-
-LLAssetType::EType LLWearable::getAssetType() const
+// virtual
+LLViewerWearable::~LLViewerWearable()
{
- return LLWearableType::getAssetType(mType);
}
-BOOL LLWearable::exportFile(LLFILE* file) const
+// virtual
+BOOL LLViewerWearable::exportFile(LLFILE* file) const
{
- // header and version
- if( fprintf( file, "LLWearable version %d\n", mDefinitionVersion ) < 0 )
- {
- return FALSE;
- }
-
- // name
- if( fprintf( file, "%s\n", mName.c_str() ) < 0 )
- {
- return FALSE;
- }
-
- // description
- if( fprintf( file, "%s\n", mDescription.c_str() ) < 0 )
- {
- return FALSE;
- }
-
- // permissions
- if( !mPermissions.exportFile( file ) )
- {
- return FALSE;
- }
-
- // sale info
- if( !mSaleInfo.exportFile( file ) )
- {
- return FALSE;
- }
-
- // wearable type
- S32 type = (S32)mType;
- if( fprintf( file, "type %d\n", type ) < 0 )
- {
- return FALSE;
- }
-
- // parameters
- S32 num_parameters = mVisualParamIndexMap.size();
- if( fprintf( file, "parameters %d\n", num_parameters ) < 0 )
- {
- return FALSE;
- }
-
- for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin();
- iter != mVisualParamIndexMap.end();
- ++iter)
- {
- S32 param_id = iter->first;
- const LLVisualParam* param = iter->second;
- F32 param_weight = param->getWeight();
- if( fprintf( file, "%d %s\n", param_id, terse_F32_to_string( param_weight ).c_str() ) < 0 )
- {
- return FALSE;
- }
- }
-
- // texture entries
- S32 num_textures = mTEMap.size();
- if( fprintf( file, "textures %d\n", num_textures ) < 0 )
- {
- return FALSE;
- }
-
+ mTextureIDMap.clear();
for (te_map_t::const_iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter)
{
S32 te = iter->first;
const LLUUID& image_id = iter->second->getID();
- if( fprintf( file, "%d %s\n", te, image_id.asString().c_str()) < 0 )
- {
- return FALSE;
- }
+ mTextureIDMap[te] = image_id;
}
- return TRUE;
+ return LLWearable::exportFile(file);
}
-void LLWearable::createVisualParams()
+void LLViewerWearable::createVisualParams()
{
for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam();
param;
@@ -217,11 +123,11 @@ void LLWearable::createVisualParams()
LLVisualParam* param = param_iter->second;
LLVisualParam*(LLWearable::*wearable_function)(S32)const = &LLWearable::getVisualParam;
// need this line to disambiguate between versions of LLCharacter::getVisualParam()
- LLVisualParam*(LLVOAvatarSelf::*avatar_function)(S32)const = &LLVOAvatarSelf::getVisualParam;
+ LLVisualParam*(LLAvatarAppearance::*param_function)(S32)const = &LLAvatarAppearance::getVisualParam;
param->resetDrivenParams();
if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false))
{
- if( !param->linkDrivenParams(boost::bind(avatar_function,gAgentAvatarp.get(),_1 ), true))
+ if( !param->linkDrivenParams(boost::bind(param_function,gAgentAvatarp.get(),_1 ), true))
{
llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl;
continue;
@@ -230,206 +136,33 @@ void LLWearable::createVisualParams()
}
}
-BOOL LLWearable::importFile( LLFILE* file )
+// virtual
+LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file )
{
- // *NOTE: changing the type or size of this buffer will require
- // changes in the fscanf() code below. You would be better off
- // rewriting this to use streams and not require an open FILE.
- char text_buffer[2048]; /* Flawfinder: ignore */
- S32 fields_read = 0;
-
// suppress texlayerset updates while wearables are being imported. Layersets will be updated
// when the wearables are "worn", not loaded. Note state will be restored when this object is destroyed.
LLOverrideBakedTextureUpdate stop_bakes(false);
- // read header and version
- fields_read = fscanf( file, "LLWearable version %d\n", &mDefinitionVersion );
- if( fields_read != 1 )
+ LLWearable::EImportResult result = LLWearable::importFile(file);
+ if (LLWearable::FAILURE == result) return result;
+ if (LLWearable::BAD_HEADER == result)
{
// Shouldn't really log the asset id for security reasons, but
// we need it in this case.
llwarns << "Bad Wearable asset header: " << mAssetID << llendl;
//gVFS->dumpMap();
- return FALSE;
- }
-
-
- // Temoprary hack to allow wearables with definition version 24 to still load.
- // This should only affect lindens and NDA'd testers who have saved wearables in 2.0
- // the extra check for version == 24 can be removed before release, once internal testers
- // have loaded these wearables again. See hack pt 2 at bottom of function to ensure that
- // these wearables get re-saved with version definition 22.
- if( mDefinitionVersion > LLWearable::sCurrentDefinitionVersion && mDefinitionVersion != 24 )
- {
- llwarns << "Wearable asset has newer version (" << mDefinitionVersion << ") than XML (" << LLWearable::sCurrentDefinitionVersion << ")" << llendl;
- return FALSE;
- }
-
- // name
- int next_char = fgetc( file ); /* Flawfinder: ignore */
- if( '\n' == next_char )
- {
- // no name
- mName = "";
- }
- else
- {
- ungetc( next_char, file );
- fields_read = fscanf( /* Flawfinder: ignore */
- file,
- "%2047[^\n]",
- text_buffer);
- if( (1 != fields_read) || (fgetc( file ) != '\n') ) /* Flawfinder: ignore */
- {
- llwarns << "Bad Wearable asset: early end of file" << llendl;
- return FALSE;
- }
- mName = text_buffer;
- LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN );
- }
-
- // description
- next_char = fgetc( file ); /* Flawfinder: ignore */
- if( '\n' == next_char )
- {
- // no description
- mDescription = "";
- }
- else
- {
- ungetc( next_char, file );
- fields_read = fscanf( /* Flawfinder: ignore */
- file,
- "%2047[^\n]",
- text_buffer );
- if( (1 != fields_read) || (fgetc( file ) != '\n') ) /* Flawfinder: ignore */
- {
- llwarns << "Bad Wearable asset: early end of file" << llendl;
- return FALSE;
- }
- mDescription = text_buffer;
- LLStringUtil::truncate(mDescription, DB_INV_ITEM_DESC_STR_LEN );
+ return result;
}
- // permissions
- S32 perm_version;
- fields_read = fscanf( file, " permissions %d\n", &perm_version );
- if( (fields_read != 1) || (perm_version != 0) )
- {
- llwarns << "Bad Wearable asset: missing permissions" << llendl;
- return FALSE;
- }
- if( !mPermissions.importFile( file ) )
- {
- return FALSE;
- }
+ LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN );
+ LLStringUtil::truncate(mDescription, DB_INV_ITEM_DESC_STR_LEN );
- // sale info
- S32 sale_info_version;
- fields_read = fscanf( file, " sale_info %d\n", &sale_info_version );
- if( (fields_read != 1) || (sale_info_version != 0) )
- {
- llwarns << "Bad Wearable asset: missing sale_info" << llendl;
- return FALSE;
- }
- // Sale info used to contain next owner perm. It is now in the
- // permissions. Thus, we read that out, and fix legacy
- // objects. It's possible this op would fail, but it should pick
- // up the vast majority of the tasks.
- BOOL has_perm_mask = FALSE;
- U32 perm_mask = 0;
- if( !mSaleInfo.importFile(file, has_perm_mask, perm_mask) )
+ texture_id_map_t::const_iterator iter = mTextureIDMap.begin();
+ texture_id_map_t::const_iterator end = mTextureIDMap.end();
+ for (; iter != end; ++iter)
{
- return FALSE;
- }
- if(has_perm_mask)
- {
- // fair use fix.
- if(!(perm_mask & PERM_COPY))
- {
- perm_mask |= PERM_TRANSFER;
- }
- mPermissions.setMaskNext(perm_mask);
- }
-
- // wearable type
- S32 type = -1;
- fields_read = fscanf( file, "type %d\n", &type );
- if( fields_read != 1 )
- {
- llwarns << "Bad Wearable asset: bad type" << llendl;
- return FALSE;
- }
- if( 0 <= type && type < LLWearableType::WT_COUNT )
- {
- setType((LLWearableType::EType)type);
- }
- else
- {
- mType = LLWearableType::WT_COUNT;
- llwarns << "Bad Wearable asset: bad type #" << type << llendl;
- return FALSE;
- }
-
- // parameters header
- S32 num_parameters = 0;
- fields_read = fscanf( file, "parameters %d\n", &num_parameters );
- if( fields_read != 1 )
- {
- llwarns << "Bad Wearable asset: missing parameters block" << llendl;
- return FALSE;
- }
-
- if( num_parameters != mVisualParamIndexMap.size() )
- {
- llwarns << "Wearable parameter mismatch. Reading in " << num_parameters << " from file, but created " << mVisualParamIndexMap.size() << " from avatar parameters. type: " << mType << llendl;
- }
-
- // parameters
- S32 i;
- for( i = 0; i < num_parameters; i++ )
- {
- S32 param_id = 0;
- F32 param_weight = 0.f;
- fields_read = fscanf( file, "%d %f\n", &param_id, &param_weight );
- if( fields_read != 2 )
- {
- llwarns << "Bad Wearable asset: bad parameter, #" << i << llendl;
- return FALSE;
- }
- mSavedVisualParamMap[param_id] = param_weight;
- }
-
- // textures header
- S32 num_textures = 0;
- fields_read = fscanf( file, "textures %d\n", &num_textures);
- if( fields_read != 1 )
- {
- llwarns << "Bad Wearable asset: missing textures block" << llendl;
- return FALSE;
- }
-
- // textures
- for( i = 0; i < num_textures; i++ )
- {
- S32 te = 0;
- fields_read = fscanf( /* Flawfinder: ignore */
- file,
- "%d %2047s\n",
- &te, text_buffer);
- if( fields_read != 2 )
- {
- llwarns << "Bad Wearable asset: bad texture, #" << i << llendl;
- return FALSE;
- }
-
- if( !LLUUID::validate( text_buffer ) )
- {
- llwarns << "Bad Wearable asset: bad texture uuid: " << text_buffer << llendl;
- return FALSE;
- }
- LLUUID id = LLUUID(text_buffer);
- LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( id );
+ S32 te = iter->first;
+ const LLUUID& textureid = iter->second;
if( mTEMap.find(te) != mTEMap.end() )
{
delete mTEMap[te];
@@ -439,11 +172,11 @@ BOOL LLWearable::importFile( LLFILE* file )
delete mSavedTEMap[te];
}
+ LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( textureid );
if(gSavedSettings.getBOOL("DebugAvatarLocalTexLoadedTime"))
{
- image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(id, (LLVOAvatarDefines::ETextureIndex)te), NULL);
+ image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(textureid, (LLAvatarAppearanceDefines::ETextureIndex)te), NULL);
}
- LLUUID textureid(text_buffer);
mTEMap[te] = new LLLocalTextureObject(image, textureid);
mSavedTEMap[te] = new LLLocalTextureObject(image, textureid);
createLayers(te);
@@ -452,14 +185,14 @@ BOOL LLWearable::importFile( LLFILE* file )
// copy all saved param values to working params
revertValues();
- return TRUE;
+ return result;
}
// Avatar parameter and texture definitions can change over time.
// This function returns true if parameters or textures have been added or removed
// since this wearable was created.
-BOOL LLWearable::isOldVersion() const
+BOOL LLViewerWearable::isOldVersion() const
{
if (!isAgentAvatarValid()) return FALSE;
@@ -497,7 +230,7 @@ BOOL LLWearable::isOldVersion() const
S32 te_count = 0;
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
{
- if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType)
+ if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType)
{
te_count++;
if( !is_in_map(mTEMap, te ) )
@@ -521,7 +254,7 @@ BOOL LLWearable::isOldVersion() const
// * If parameters or textures have been ADDED since the wearable was created,
// they are taken to have default values, so we consider the wearable clean
// only if those values are the same as the defaults.
-BOOL LLWearable::isDirty() const
+BOOL LLViewerWearable::isDirty() const
{
if (!isAgentAvatarValid()) return FALSE;
@@ -549,7 +282,7 @@ BOOL LLWearable::isDirty() const
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
{
- if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType)
+ if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType)
{
te_map_t::const_iterator current_iter = mTEMap.find(te);
if(current_iter != mTEMap.end())
@@ -578,7 +311,7 @@ BOOL LLWearable::isDirty() const
}
-void LLWearable::setParamsToDefaults()
+void LLViewerWearable::setParamsToDefaults()
{
if (!isAgentAvatarValid()) return;
@@ -591,13 +324,13 @@ void LLWearable::setParamsToDefaults()
}
}
-void LLWearable::setTexturesToDefaults()
+void LLViewerWearable::setTexturesToDefaults()
{
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
{
- if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType)
+ if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType)
{
- LLUUID id = LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te);
+ LLUUID id = getDefaultTextureImageID((ETextureIndex) te);
LLViewerFetchedTexture * image = LLViewerTextureManager::getFetchedTexture( id );
if( mTEMap.find(te) == mTEMap.end() )
{
@@ -615,8 +348,25 @@ void LLWearable::setTexturesToDefaults()
}
}
+
+//static
+const LLUUID LLViewerWearable::getDefaultTextureImageID(ETextureIndex index)
+{
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(index);
+ const std::string &default_image_name = texture_dict->mDefaultImageName;
+ if (default_image_name == "")
+ {
+ return IMG_DEFAULT_AVATAR;
+ }
+ else
+ {
+ return LLUUID(gSavedSettings.getString(default_image_name));
+ }
+}
+
+
// Updates the user's avatar's appearance
-void LLWearable::writeToAvatar()
+void LLViewerWearable::writeToAvatar()
{
if (!isAgentAvatarValid()) return;
@@ -639,7 +389,7 @@ void LLWearable::writeToAvatar()
// Pull texture entries
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
{
- if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType)
+ if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType)
{
te_map_t::const_iterator iter = mTEMap.find(te);
LLUUID image_id;
@@ -649,7 +399,7 @@ void LLWearable::writeToAvatar()
}
else
{
- image_id = LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te);
+ image_id = getDefaultTextureImageID((ETextureIndex) te);
}
LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE );
// MULTI-WEARABLE: assume index 0 will be used when writing to avatar. TODO: eliminate the need for this.
@@ -672,7 +422,7 @@ void LLWearable::writeToAvatar()
// Updates the user's avatar's appearance, replacing this wearables' parameters and textures with default values.
// static
-void LLWearable::removeFromAvatar( LLWearableType::EType type, BOOL upload_bake )
+void LLViewerWearable::removeFromAvatar( LLWearableType::EType type, BOOL upload_bake )
{
if (!isAgentAvatarValid()) return;
@@ -711,7 +461,7 @@ void LLWearable::removeFromAvatar( LLWearableType::EType type, BOOL upload_bake
// Does not copy mAssetID.
// Definition version is current: removes obsolete enties and creates default values for new ones.
-void LLWearable::copyDataFrom(const LLWearable* src)
+void LLViewerWearable::copyDataFrom(const LLViewerWearable* src)
{
if (!isAgentAvatarValid()) return;
@@ -742,14 +492,14 @@ void LLWearable::copyDataFrom(const LLWearable* src)
// Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed)
for (S32 te = 0; te < TEX_NUM_INDICES; te++)
{
- if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType)
+ if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType)
{
te_map_t::const_iterator iter = src->mTEMap.find(te);
LLUUID image_id;
LLViewerFetchedTexture *image = NULL;
if(iter != src->mTEMap.end())
{
- image = src->getLocalTextureObject(te)->getImage();
+ image = dynamic_cast<LLViewerFetchedTexture*> (src->getLocalTextureObject(te)->getImage());
image_id = src->getLocalTextureObject(te)->getID();
mTEMap[te] = new LLLocalTextureObject(image, image_id);
mSavedTEMap[te] = new LLLocalTextureObject(image, image_id);
@@ -758,7 +508,7 @@ void LLWearable::copyDataFrom(const LLWearable* src)
}
else
{
- image_id = LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te);
+ image_id = getDefaultTextureImageID((ETextureIndex) te);
image = LLViewerTextureManager::getFetchedTexture( image_id );
mTEMap[te] = new LLLocalTextureObject(image, image_id);
mSavedTEMap[te] = new LLLocalTextureObject(image, image_id);
@@ -772,23 +522,13 @@ void LLWearable::copyDataFrom(const LLWearable* src)
revertValues();
}
-void LLWearable::setItemID(const LLUUID& item_id)
+void LLViewerWearable::setItemID(const LLUUID& item_id)
{
mItemID = item_id;
}
-const LLUUID& LLWearable::getItemID() const
-{
- return mItemID;
-}
-
-void LLWearable::setType(LLWearableType::EType type)
-{
- mType = type;
- createVisualParams();
-}
-LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index)
+LLLocalTextureObject* LLViewerWearable::getLocalTextureObject(S32 index)
{
te_map_t::iterator iter = mTEMap.find(index);
if( iter != mTEMap.end() )
@@ -799,7 +539,7 @@ LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index)
return NULL;
}
-const LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index) const
+const LLLocalTextureObject* LLViewerWearable::getLocalTextureObject(S32 index) const
{
te_map_t::const_iterator iter = mTEMap.find(index);
if( iter != mTEMap.end() )
@@ -810,7 +550,7 @@ const LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index) const
return NULL;
}
-std::vector<LLLocalTextureObject*> LLWearable::getLocalTextureListSeq()
+std::vector<LLLocalTextureObject*> LLViewerWearable::getLocalTextureListSeq()
{
std::vector<LLLocalTextureObject*> result;
@@ -824,7 +564,7 @@ std::vector<LLLocalTextureObject*> LLWearable::getLocalTextureListSeq()
return result;
}
-void LLWearable::setLocalTextureObject(S32 index, LLLocalTextureObject &lto)
+void LLViewerWearable::setLocalTextureObject(S32 index, LLLocalTextureObject &lto)
{
if( mTEMap.find(index) != mTEMap.end() )
{
@@ -833,19 +573,7 @@ void LLWearable::setLocalTextureObject(S32 index, LLLocalTextureObject &lto)
mTEMap[index] = new LLLocalTextureObject(lto);
}
-
-void LLWearable::addVisualParam(LLVisualParam *param)
-{
- if( mVisualParamIndexMap[param->getID()] )
- {
- delete mVisualParamIndexMap[param->getID()];
- }
- param->setIsDummy(FALSE);
- mVisualParamIndexMap[param->getID()] = param;
- mSavedVisualParamMap[param->getID()] = param->getDefaultWeight();
-}
-
-void LLWearable::setVisualParams()
+void LLViewerWearable::setVisualParams()
{
for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); iter++)
{
@@ -856,91 +584,7 @@ void LLWearable::setVisualParams()
}
}
-
-void LLWearable::setVisualParamWeight(S32 param_index, F32 value, BOOL upload_bake)
-{
- if( is_in_map(mVisualParamIndexMap, param_index ) )
- {
- LLVisualParam *wearable_param = mVisualParamIndexMap[param_index];
- wearable_param->setWeight(value, upload_bake);
- }
- else
- {
- llerrs << "LLWearable::setVisualParam passed invalid parameter index: " << param_index << " for wearable type: " << this->getName() << llendl;
- }
-}
-
-F32 LLWearable::getVisualParamWeight(S32 param_index) const
-{
- if( is_in_map(mVisualParamIndexMap, param_index ) )
- {
- const LLVisualParam *wearable_param = mVisualParamIndexMap.find(param_index)->second;
- return wearable_param->getWeight();
- }
- else
- {
- llwarns << "LLWerable::getVisualParam passed invalid parameter index: " << param_index << " for wearable type: " << this->getName() << llendl;
- }
- return (F32)-1.0;
-}
-
-LLVisualParam* LLWearable::getVisualParam(S32 index) const
-{
- visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.find(index);
- return (iter == mVisualParamIndexMap.end()) ? NULL : iter->second;
-}
-
-
-void LLWearable::getVisualParams(visual_param_vec_t &list)
-{
- visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin();
- visual_param_index_map_t::iterator end = mVisualParamIndexMap.end();
-
- // add all visual params to the passed-in vector
- for( ; iter != end; ++iter )
- {
- list.push_back(iter->second);
- }
-}
-
-void LLWearable::animateParams(F32 delta, BOOL upload_bake)
-{
- for(visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin();
- iter != mVisualParamIndexMap.end();
- ++iter)
- {
- LLVisualParam *param = (LLVisualParam*) iter->second;
- param->animate(delta, upload_bake);
- }
-}
-
-LLColor4 LLWearable::getClothesColor(S32 te) const
-{
- LLColor4 color;
- U32 param_name[3];
- if( LLVOAvatar::teToColorParams( (LLVOAvatarDefines::ETextureIndex)te, param_name ) )
- {
- for( U8 index = 0; index < 3; index++ )
- {
- color.mV[index] = getVisualParamWeight(param_name[index]);
- }
- }
- return color;
-}
-
-void LLWearable::setClothesColor( S32 te, const LLColor4& new_color, BOOL upload_bake )
-{
- U32 param_name[3];
- if( LLVOAvatar::teToColorParams( (LLVOAvatarDefines::ETextureIndex)te, param_name ) )
- {
- for( U8 index = 0; index < 3; index++ )
- {
- setVisualParamWeight(param_name[index], new_color.mV[index], upload_bake);
- }
- }
-}
-
-void LLWearable::revertValues()
+void LLViewerWearable::revertValues()
{
//update saved settings so wearable is no longer dirty
// non-driver params first
@@ -988,14 +632,14 @@ void LLWearable::revertValues()
}
}
-BOOL LLWearable::isOnTop() const
+BOOL LLViewerWearable::isOnTop() const
{
return (this == gAgentWearables.getTopWearable(mType));
}
-void LLWearable::createLayers(S32 te)
+void LLViewerWearable::createLayers(S32 te)
{
- LLTexLayerSet *layer_set = gAgentAvatarp->getLayerSet((ETextureIndex)te);
+ LLViewerTexLayerSet *layer_set = gAgentAvatarp->getLayerSet((ETextureIndex)te);
if (layer_set)
{
layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this);
@@ -1006,7 +650,7 @@ void LLWearable::createLayers(S32 te)
}
}
-void LLWearable::saveValues()
+void LLViewerWearable::saveValues()
{
//update saved settings so wearable is no longer dirty
mSavedVisualParamMap.clear();
@@ -1029,12 +673,12 @@ void LLWearable::saveValues()
}
}
-void LLWearable::syncImages(te_map_t &src, te_map_t &dst)
+void LLViewerWearable::syncImages(te_map_t &src, te_map_t &dst)
{
// Deep copy of src (copies only those tes that are current, filling in defaults where needed)
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
{
- if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType)
+ if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType)
{
te_map_t::const_iterator iter = src.find(te);
LLUUID image_id;
@@ -1044,13 +688,13 @@ void LLWearable::syncImages(te_map_t &src, te_map_t &dst)
{
// there's a Local Texture Object in the source image map. Use this to populate the values to store in the destination image map.
lto = iter->second;
- image = lto->getImage();
+ image = dynamic_cast<LLViewerFetchedTexture*> (lto->getImage());
image_id = lto->getID();
}
else
{
// there is no Local Texture Object in the source image map. Get defaults values for populating the destination image map.
- image_id = LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te);
+ image_id = getDefaultTextureImageID((ETextureIndex) te);
image = LLViewerTextureManager::getFetchedTexture( image_id );
}
@@ -1076,7 +720,7 @@ void LLWearable::syncImages(te_map_t &src, te_map_t &dst)
}
}
-void LLWearable::destroyTextures()
+void LLViewerWearable::destroyTextures()
{
for( te_map_t::iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter )
{
@@ -1092,7 +736,7 @@ void LLWearable::destroyTextures()
mSavedTEMap.clear();
}
-void LLWearable::pullCrossWearableValues()
+void LLViewerWearable::pullCrossWearableValues()
{
// scan through all of the avatar's visual parameters
for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam();
@@ -1112,12 +756,12 @@ void LLWearable::pullCrossWearableValues()
}
-void LLWearable::setLabelUpdated() const
+void LLViewerWearable::setLabelUpdated() const
{
gInventory.addChangedMask(LLInventoryObserver::LABEL, getItemID());
}
-void LLWearable::refreshName()
+void LLViewerWearable::refreshName()
{
LLUUID item_id = getItemID();
LLInventoryItem* item = gInventory.getItem(item_id);
@@ -1132,9 +776,9 @@ struct LLWearableSaveData
LLWearableType::EType mType;
};
-void LLWearable::saveNewAsset() const
+void LLViewerWearable::saveNewAsset() const
{
-// llinfos << "LLWearable::saveNewAsset() type: " << getTypeName() << llendl;
+// llinfos << "LLViewerWearable::saveNewAsset() type: " << getTypeName() << llendl;
//llinfos << *this << llendl;
const std::string filename = asset_id_to_filename(mAssetID);
@@ -1183,13 +827,13 @@ void LLWearable::saveNewAsset() const
LLWearableSaveData* data = new LLWearableSaveData;
data->mType = mType;
gAssetStorage->storeAssetData(filename, mTransactionID, getAssetType(),
- &LLWearable::onSaveNewAssetComplete,
+ &LLViewerWearable::onSaveNewAssetComplete,
(void*)data);
}
}
// static
-void LLWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* userdata, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
+void LLViewerWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* userdata, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
{
LLWearableSaveData* data = (LLWearableSaveData*)userdata;
const std::string& type_name = LLWearableType::getTypeName(data->mType);
@@ -1216,7 +860,7 @@ void LLWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* userda
}
-std::ostream& operator<<(std::ostream &s, const LLWearable &w)
+std::ostream& operator<<(std::ostream &s, const LLViewerWearable &w)
{
s << "wearable " << LLWearableType::getTypeName(w.mType) << "\n";
s << " Name: " << w.mName << "\n";
@@ -1235,7 +879,7 @@ std::ostream& operator<<(std::ostream &s, const LLWearable &w)
}
s << " Textures:" << "\n";
- for (LLWearable::te_map_t::const_iterator iter = w.mTEMap.begin();
+ for (LLViewerWearable::te_map_t::const_iterator iter = w.mTEMap.begin();
iter != w.mTEMap.end(); ++iter)
{
S32 te = iter->first;
@@ -1245,37 +889,6 @@ std::ostream& operator<<(std::ostream &s, const LLWearable &w)
return s;
}
-
-std::string terse_F32_to_string(F32 f)
-{
- std::string r = llformat("%.2f", f);
- S32 len = r.length();
-
- // "1.20" -> "1.2"
- // "24.00" -> "24."
- while (len > 0 && ('0' == r[len - 1]))
- {
- r.erase(len-1, 1);
- len--;
- }
- if ('.' == r[len - 1])
- {
- // "24." -> "24"
- r.erase(len-1, 1);
- }
- else if (('-' == r[0]) && ('0' == r[1]))
- {
- // "-0.59" -> "-.59"
- r.erase(1, 1);
- }
- else if ('0' == r[0])
- {
- // "0.59" -> ".59"
- r.erase(0, 1);
- }
- return r;
-}
-
std::string asset_id_to_filename(const LLUUID &asset_id)
{
std::string asset_id_string;
diff --git a/indra/newview/llviewerwearable.h b/indra/newview/llviewerwearable.h
new file mode 100644
index 0000000000..ccc26000f2
--- /dev/null
+++ b/indra/newview/llviewerwearable.h
@@ -0,0 +1,118 @@
+/**
+ * @file llviewerwearable.h
+ * @brief LLViewerWearable class header file
+ *
+ * $LicenseInfo:firstyear=2012&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_VIEWER_WEARABLE_H
+#define LL_VIEWER_WEARABLE_H
+
+#include "llwearable.h"
+#include "llavatarappearancedefines.h"
+
+class LLViewerWearable : public LLWearable
+{
+ friend class LLWearableList;
+
+ //--------------------------------------------------------------------
+ // Constructors and destructors
+ //--------------------------------------------------------------------
+private:
+ // Private constructors used by LLViewerWearableList
+ LLViewerWearable(const LLTransactionID& transactionID);
+ LLViewerWearable(const LLAssetID& assetID);
+public:
+ virtual ~LLViewerWearable();
+
+ //--------------------------------------------------------------------
+ // Accessors
+ //--------------------------------------------------------------------
+public:
+ const LLUUID& getItemID() const { return mItemID; }
+ const LLAssetID& getAssetID() const { return mAssetID; }
+ const LLTransactionID& getTransactionID() const { return mTransactionID; }
+ void setItemID(const LLUUID& item_id);
+
+public:
+
+ BOOL isDirty() const;
+ BOOL isOldVersion() const;
+
+ /*virtual*/ void writeToAvatar();
+ void removeFromAvatar( BOOL upload_bake ) { LLViewerWearable::removeFromAvatar( mType, upload_bake ); }
+ static void removeFromAvatar( LLWearableType::EType type, BOOL upload_bake );
+
+ /*virtual*/ BOOL exportFile(LLFILE* file) const;
+ /*virtual*/ EImportResult importFile(LLFILE* file);
+
+ void setParamsToDefaults();
+ void setTexturesToDefaults();
+
+ static const LLUUID getDefaultTextureImageID(LLAvatarAppearanceDefines::ETextureIndex index);
+
+
+ void saveNewAsset() const;
+ static void onSaveNewAssetComplete( const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status );
+
+ void copyDataFrom(const LLViewerWearable* src);
+
+ friend std::ostream& operator<<(std::ostream &s, const LLViewerWearable &w);
+
+ /*virtual*/ LLLocalTextureObject* getLocalTextureObject(S32 index);
+ const LLLocalTextureObject* getLocalTextureObject(S32 index) const;
+ std::vector<LLLocalTextureObject*> getLocalTextureListSeq();
+ void setLocalTextureObject(S32 index, LLLocalTextureObject &lto);
+ void setVisualParams();
+
+ void revertValues();
+ void saveValues();
+ void pullCrossWearableValues();
+
+ BOOL isOnTop() const;
+
+ // Something happened that requires the wearable's label to be updated (e.g. worn/unworn).
+ void setLabelUpdated() const;
+
+ // the wearable was worn. make sure the name of the wearable object matches the LLViewerInventoryItem,
+ // not the wearable asset itself.
+ void refreshName();
+
+protected:
+ typedef std::map<S32, LLLocalTextureObject*> te_map_t;
+
+ void createLayers(S32 te);
+ /*virtual*/void createVisualParams();
+
+ void syncImages(te_map_t &src, te_map_t &dst);
+ void destroyTextures();
+ LLAssetID mAssetID;
+ LLTransactionID mTransactionID;
+
+ te_map_t mTEMap; // maps TE to LocalTextureObject
+ te_map_t mSavedTEMap; // last saved version of TEMap
+ LLUUID mItemID; // ID of the inventory item in the agent's inventory
+};
+
+
+#endif // LL_VIEWER_WEARABLE_H
+
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 4894f21e67..56ded53b5d 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -77,15 +77,16 @@
#include "llselectmgr.h"
#include "llsprite.h"
#include "lltargetingmotion.h"
-#include "lltexlayer.h"
#include "lltoolmorph.h"
#include "llviewercamera.h"
+#include "llviewertexlayer.h"
#include "llviewertexturelist.h"
#include "llviewermenu.h"
#include "llviewerobjectlist.h"
#include "llviewerparcelmgr.h"
#include "llviewershadermgr.h"
#include "llviewerstats.h"
+#include "llviewerwearable.h"
#include "llvoavatarself.h"
#include "llvovolume.h"
#include "llworld.h"
@@ -117,7 +118,7 @@ extern F32 ANIM_SPEED_MIN;
// #define OUTPUT_BREAST_DATA
-using namespace LLVOAvatarDefines;
+using namespace LLAvatarAppearanceDefines;
//-----------------------------------------------------------------------------
// Global constants
@@ -192,8 +193,6 @@ const S32 MAX_BUBBLE_CHAT_UTTERANCES = 12;
const F32 CHAT_FADE_TIME = 8.0;
const F32 BUBBLE_CHAT_TIME = CHAT_FADE_TIME * 3.f;
-const LLColor4 DUMMY_COLOR = LLColor4(0.5,0.5,0.5,1.0);
-
enum ERenderName
{
RENDER_NAME_NEVER,
@@ -598,7 +597,7 @@ LLXmlTree LLVOAvatar::sXMLTree;
LLXmlTree LLVOAvatar::sSkeletonXMLTree;
LLVOAvatarSkeletonInfo* LLVOAvatar::sAvatarSkeletonInfo = NULL;
LLVOAvatar::LLVOAvatarXmlInfo* LLVOAvatar::sAvatarXmlInfo = NULL;
-LLVOAvatarDictionary *LLVOAvatar::sAvatarDictionary = NULL;
+LLAvatarAppearanceDictionary *LLVOAvatar::sAvatarDictionary = NULL;
S32 LLVOAvatar::sFreezeCounter = 0;
U32 LLVOAvatar::sMaxVisible = 12;
F32 LLVOAvatar::sRenderDistance = 256.f;
@@ -645,8 +644,8 @@ static F32 calc_bouncy_animation(F32 x);
LLVOAvatar::LLVOAvatar(const LLUUID& id,
const LLPCode pcode,
LLViewerRegion* regionp) :
+ LLAvatarAppearance(),
LLViewerObject(id, pcode, regionp),
- mIsDummy(FALSE),
mSpecialRenderMode(0),
mAttachmentGeometryBytes(0),
mAttachmentSurfaceArea(0.f),
@@ -678,9 +677,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
mFirstAppearanceMessageReceived( FALSE ),
mCulled( FALSE ),
mVisibilityRank(0),
- mTexSkinColor( NULL ),
- mTexHairColor( NULL ),
- mTexEyeColor( NULL ),
mNeedsSkin(FALSE),
mLastSkinTime(0.f),
mUpdatePeriod(1),
@@ -715,7 +711,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
mBakedTextureDatas[i].mIsLoaded = false;
mBakedTextureDatas[i].mIsUsed = false;
mBakedTextureDatas[i].mMaskTexName = 0;
- mBakedTextureDatas[i].mTextureIndex = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)i);
+ mBakedTextureDatas[i].mTextureIndex = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)i);
}
mDirtyMesh = 2; // Dirty geometry, need to regenerate.
@@ -1077,15 +1073,15 @@ void LLVOAvatar::dumpBakedStatus()
{
llcont << " Unbaked (";
- for (LLVOAvatarDictionary::BakedTextures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
- iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
+ for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin();
+ iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end();
++iter)
{
- const LLVOAvatarDictionary::BakedEntry *baked_dict = iter->second;
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = iter->second;
const ETextureIndex index = baked_dict->mTextureIndex;
if (!inst->isTextureDefined(index))
{
- llcont << " " << LLVOAvatarDictionary::getInstance()->getTexture(index)->mName;
+ llcont << " " << LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mName;
}
}
llcont << " ) " << inst->getUnbakedPixelAreaRank();
@@ -1133,7 +1129,7 @@ void LLVOAvatar::resetImpostors()
// static
void LLVOAvatar::deleteCachedImages(bool clearAll)
{
- if (LLTexLayerSet::sHasCaches)
+ if (LLViewerTexLayerSet::sHasCaches)
{
lldebugs << "Deleting layer set caches" << llendl;
for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
@@ -1142,7 +1138,7 @@ void LLVOAvatar::deleteCachedImages(bool clearAll)
LLVOAvatar* inst = (LLVOAvatar*) *iter;
inst->deleteLayerSetCaches(clearAll);
}
- LLTexLayerSet::sHasCaches = FALSE;
+ LLViewerTexLayerSet::sHasCaches = FALSE;
}
LLVOAvatarSelf::deleteScratchTextures();
LLTexLayerStaticImageList::getInstance()->deleteCachedImages();
@@ -1286,12 +1282,12 @@ void LLVOAvatar::initInstance(void)
//-------------------------------------------------------------------------
mRoot.setName( "mRoot" );
- for (LLVOAvatarDictionary::Meshes::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin();
- iter != LLVOAvatarDictionary::getInstance()->getMeshes().end();
+ for (LLAvatarAppearanceDictionary::Meshes::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getMeshes().begin();
+ iter != LLAvatarAppearanceDictionary::getInstance()->getMeshes().end();
++iter)
{
const EMeshIndex mesh_index = iter->first;
- const LLVOAvatarDictionary::MeshEntry *mesh_dict = iter->second;
+ const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = iter->second;
LLViewerJoint* joint = new LLViewerJoint();
joint->setName(mesh_dict->mName);
joint->setMeshID(mesh_index);
@@ -1332,12 +1328,12 @@ void LLVOAvatar::initInstance(void)
//-------------------------------------------------------------------------
// associate baked textures with meshes
//-------------------------------------------------------------------------
- for (LLVOAvatarDictionary::Meshes::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin();
- iter != LLVOAvatarDictionary::getInstance()->getMeshes().end();
+ for (LLAvatarAppearanceDictionary::Meshes::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getMeshes().begin();
+ iter != LLAvatarAppearanceDictionary::getInstance()->getMeshes().end();
++iter)
{
const EMeshIndex mesh_index = iter->first;
- const LLVOAvatarDictionary::MeshEntry *mesh_dict = iter->second;
+ const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = iter->second;
const EBakedTextureIndex baked_texture_index = mesh_dict->mBakedID;
// Skip it if there's no associated baked texture.
if (baked_texture_index == BAKED_NUM_INDICES) continue;
@@ -4569,7 +4565,7 @@ void LLVOAvatar::updateTextures()
mHasGrey = FALSE; // debug
for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++)
{
- LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType((ETextureIndex)texture_index);
+ LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)texture_index);
U32 num_wearables = gAgentWearables.getWearableCount(wearable_type);
const LLTextureEntry *te = getTE(texture_index);
const F32 texel_area_ratio = fabs(te->mScaleS * te->mScaleT);
@@ -4579,7 +4575,7 @@ void LLVOAvatar::updateTextures()
imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index, wearable_index), TRUE);
if (imagep)
{
- const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)texture_index);
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)texture_index);
const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
if (texture_dict->mIsLocalTexture)
{
@@ -4740,7 +4736,7 @@ const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid)
std::string url = "";
if (mUseServerBakes && !gSavedSettings.getString("AgentAppearanceServiceURL").empty())
{
- const LLVOAvatarDictionary::TextureEntry* texture_entry = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)te);
+ const LLAvatarAppearanceDictionary::TextureEntry* texture_entry = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)te);
if (texture_entry != NULL)
{
url = gSavedSettings.getString("AgentAppearanceServiceURL") + "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString();
@@ -5519,7 +5515,7 @@ BOOL LLVOAvatar::loadAvatar()
{
LLVOAvatarXmlInfo::LLVOAvatarMorphInfo *info = *iter;
- EBakedTextureIndex baked = LLVOAvatarDictionary::findBakedByRegionName(info->mRegion);
+ EBakedTextureIndex baked = LLAvatarAppearanceDictionary::findBakedByRegionName(info->mRegion);
if (baked != BAKED_NUM_INDICES)
{
LLPolyMorphTarget *morph_param;
@@ -5727,12 +5723,12 @@ BOOL LLVOAvatar::loadMeshNodes()
switch(lod)
case 0:
mesh = &mHairMesh0; */
- for (LLVOAvatarDictionary::Meshes::const_iterator mesh_iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin();
- mesh_iter != LLVOAvatarDictionary::getInstance()->getMeshes().end();
+ for (LLAvatarAppearanceDictionary::Meshes::const_iterator mesh_iter = LLAvatarAppearanceDictionary::getInstance()->getMeshes().begin();
+ mesh_iter != LLAvatarAppearanceDictionary::getInstance()->getMeshes().end();
++mesh_iter)
{
const EMeshIndex mesh_index = mesh_iter->first;
- const LLVOAvatarDictionary::MeshEntry *mesh_dict = mesh_iter->second;
+ const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_iter->second;
if (type.compare(mesh_dict->mName) == 0)
{
mesh_id = mesh_index;
@@ -5864,6 +5860,30 @@ void LLVOAvatar::updateVisualParams()
updateHeadOffset();
}
+// virtual
+U32 LLVOAvatar::getWearableCount(const LLWearableType::EType type) const
+{
+ return gAgentWearables.getWearableCount(type);
+}
+
+// virtual
+U32 LLVOAvatar::getWearableCount(const U32 tex_index) const
+{
+ return gAgentWearables.getWearableCount(tex_index);
+}
+
+// virtual
+LLWearable* LLVOAvatar::getWearable(const LLWearableType::EType type, U32 index /*= 0*/)
+{
+ return gAgentWearables.getWearable(type, index);
+}
+
+// virtual
+const LLWearable* LLVOAvatar::getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const
+{
+ return gAgentWearables.getWearable(type, index);
+}
+
//-----------------------------------------------------------------------------
// isActive()
//-----------------------------------------------------------------------------
@@ -6453,26 +6473,6 @@ S32 LLVOAvatar::getAttachmentCount()
return count;
}
-LLColor4 LLVOAvatar::getGlobalColor( const std::string& color_name ) const
-{
- if (color_name=="skin_color" && mTexSkinColor)
- {
- return mTexSkinColor->getColor();
- }
- else if(color_name=="hair_color" && mTexHairColor)
- {
- return mTexHairColor->getColor();
- }
- if(color_name=="eye_color" && mTexEyeColor)
- {
- return mTexEyeColor->getColor();
- }
- else
- {
-// return LLColor4( .5f, .5f, .5f, .5f );
- return LLColor4( 0.f, 1.f, 1.f, 1.f ); // good debugging color
- }
-}
// virtual
void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_result )
@@ -6483,6 +6483,7 @@ void LLVOAvatar::invalidateAll()
{
}
+// virtual
void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake )
{
if (global_color == mTexSkinColor)
@@ -6682,6 +6683,7 @@ LLMotion* LLVOAvatar::findMotion(const LLUUID& id) const
// updateMeshTextures()
// Uses the current TE values to set the meshes' and layersets' textures.
//-----------------------------------------------------------------------------
+// virtual
void LLVOAvatar::updateMeshTextures()
{
// llinfos << "updateMeshTextures" << llendl;
@@ -6813,12 +6815,12 @@ void LLVOAvatar::updateMeshTextures()
}
- for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
- baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
+ for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin();
+ baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end();
++baked_iter)
{
const EBakedTextureIndex baked_index = baked_iter->first;
- const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second;
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
local_tex_iter != baked_dict->mLocalTextures.end();
@@ -6846,7 +6848,7 @@ void LLVOAvatar::setLocalTexture( ETextureIndex type, LLViewerTexture* in_tex, B
}
//virtual
-void LLVOAvatar::setBakedReady(LLVOAvatarDefines::ETextureIndex type, BOOL baked_version_exists, U32 index)
+void LLVOAvatar::setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index)
{
// invalid for anyone but self
llassert(0);
@@ -6892,7 +6894,7 @@ void LLVOAvatar::addMaskedMorph(EBakedTextureIndex index, LLPolyMorphTarget* mor
}
// returns TRUE if morph masks are present and not valid for a given baked texture, FALSE otherwise
-BOOL LLVOAvatar::morphMaskNeedsUpdate(LLVOAvatarDefines::EBakedTextureIndex index)
+BOOL LLVOAvatar::morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIndex index)
{
if (index >= BAKED_NUM_INDICES)
{
@@ -6903,7 +6905,7 @@ BOOL LLVOAvatar::morphMaskNeedsUpdate(LLVOAvatarDefines::EBakedTextureIndex inde
{
if (isSelf())
{
- LLTexLayerSet *layer_set = mBakedTextureDatas[index].mTexLayerSet;
+ LLViewerTexLayerSet *layer_set = mBakedTextureDatas[index].mTexLayerSet;
if (layer_set)
{
return !layer_set->isMorphValid();
@@ -6918,7 +6920,7 @@ BOOL LLVOAvatar::morphMaskNeedsUpdate(LLVOAvatarDefines::EBakedTextureIndex inde
return FALSE;
}
-void LLVOAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLVOAvatarDefines::EBakedTextureIndex index)
+void LLVOAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index)
{
if (index >= BAKED_NUM_INDICES)
{
@@ -6957,7 +6959,7 @@ void LLVOAvatar::releaseComponentTextures()
for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
{
- const LLVOAvatarDictionary::BakedEntry * bakedDicEntry = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index);
+ const LLAvatarAppearanceDictionary::BakedEntry * bakedDicEntry = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index);
// skip if this is a skirt and av is not wearing one, or if we don't have a baked texture UUID
if (!isTextureDefined(bakedDicEntry->mTextureIndex)
&& ( (baked_index != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT) ))
@@ -6973,120 +6975,14 @@ void LLVOAvatar::releaseComponentTextures()
}
}
-//static
-BOOL LLVOAvatar::teToColorParams( ETextureIndex te, U32 *param_name )
-{
- switch( te )
- {
- case TEX_UPPER_SHIRT:
- param_name[0] = 803; //"shirt_red";
- param_name[1] = 804; //"shirt_green";
- param_name[2] = 805; //"shirt_blue";
- break;
-
- case TEX_LOWER_PANTS:
- param_name[0] = 806; //"pants_red";
- param_name[1] = 807; //"pants_green";
- param_name[2] = 808; //"pants_blue";
- break;
-
- case TEX_LOWER_SHOES:
- param_name[0] = 812; //"shoes_red";
- param_name[1] = 813; //"shoes_green";
- param_name[2] = 817; //"shoes_blue";
- break;
-
- case TEX_LOWER_SOCKS:
- param_name[0] = 818; //"socks_red";
- param_name[1] = 819; //"socks_green";
- param_name[2] = 820; //"socks_blue";
- break;
-
- case TEX_UPPER_JACKET:
- case TEX_LOWER_JACKET:
- param_name[0] = 834; //"jacket_red";
- param_name[1] = 835; //"jacket_green";
- param_name[2] = 836; //"jacket_blue";
- break;
-
- case TEX_UPPER_GLOVES:
- param_name[0] = 827; //"gloves_red";
- param_name[1] = 829; //"gloves_green";
- param_name[2] = 830; //"gloves_blue";
- break;
-
- case TEX_UPPER_UNDERSHIRT:
- param_name[0] = 821; //"undershirt_red";
- param_name[1] = 822; //"undershirt_green";
- param_name[2] = 823; //"undershirt_blue";
- break;
-
- case TEX_LOWER_UNDERPANTS:
- param_name[0] = 824; //"underpants_red";
- param_name[1] = 825; //"underpants_green";
- param_name[2] = 826; //"underpants_blue";
- break;
-
- case TEX_SKIRT:
- param_name[0] = 921; //"skirt_red";
- param_name[1] = 922; //"skirt_green";
- param_name[2] = 923; //"skirt_blue";
- break;
-
- case TEX_HEAD_TATTOO:
- case TEX_LOWER_TATTOO:
- case TEX_UPPER_TATTOO:
- param_name[0] = 1071; //"tattoo_red";
- param_name[1] = 1072; //"tattoo_green";
- param_name[2] = 1073; //"tattoo_blue";
- break;
-
- default:
- llassert(0);
- return FALSE;
- }
-
- return TRUE;
-}
-
-void LLVOAvatar::setClothesColor( ETextureIndex te, const LLColor4& new_color, BOOL upload_bake )
-{
- U32 param_name[3];
- if( teToColorParams( te, param_name ) )
- {
- setVisualParamWeight( param_name[0], new_color.mV[VX], upload_bake );
- setVisualParamWeight( param_name[1], new_color.mV[VY], upload_bake );
- setVisualParamWeight( param_name[2], new_color.mV[VZ], upload_bake );
- }
-}
-
-LLColor4 LLVOAvatar::getClothesColor( ETextureIndex te )
-{
- LLColor4 color;
- U32 param_name[3];
- if( teToColorParams( te, param_name ) )
- {
- color.mV[VX] = getVisualParamWeight( param_name[0] );
- color.mV[VY] = getVisualParamWeight( param_name[1] );
- color.mV[VZ] = getVisualParamWeight( param_name[2] );
- }
- return color;
-}
-
-// static
-LLColor4 LLVOAvatar::getDummyColor()
-{
- return DUMMY_COLOR;
-}
-
void LLVOAvatar::dumpAvatarTEs( const std::string& context ) const
{
LL_DEBUGS("Avatar") << avString() << (isSelf() ? "Self: " : "Other: ") << context << LL_ENDL;
- for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
- iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
+ iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
++iter)
{
- const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second;
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
// TODO: MULTI-WEARABLE: handle multiple textures for self
const LLViewerTexture* te_image = getImage(iter->first,0);
if( !te_image )
@@ -7131,11 +7027,11 @@ BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const
/* switch(type)
case LLWearableType::WT_SHIRT:
indicator_te = TEX_UPPER_SHIRT; */
- for (LLVOAvatarDictionary::Textures::const_iterator tex_iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
- tex_iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator tex_iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
+ tex_iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
++tex_iter)
{
- const LLVOAvatarDictionary::TextureEntry *texture_dict = tex_iter->second;
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = tex_iter->second;
if (texture_dict->mWearableType == type)
{
// If you're checking another avatar's clothing, you don't have component textures.
@@ -7146,7 +7042,7 @@ BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const
if (texture_dict->mIsUsedByBakedTexture)
{
const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
- return isTextureDefined(LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex);
+ return isTextureDefined(LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex);
}
return FALSE;
}
@@ -7599,12 +7495,12 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture
self->mBakedTextureDatas[BAKED_HEAD].mTexLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1);
maskData->mLastDiscardLevel = discard_level; */
BOOL found_texture_id = false;
- for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
- iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
+ iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
++iter)
{
- const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second;
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
if (texture_dict->mIsUsedByBakedTexture)
{
const ETextureIndex texture_index = iter->first;
@@ -7726,7 +7622,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id )
{
//mBakedTextureDatas[i].mTexLayerSet->destroyComposite();
}
- const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i);
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i);
for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
local_tex_iter != baked_dict->mLocalTextures.end();
++local_tex_iter)
@@ -7788,7 +7684,7 @@ void LLVOAvatar::dumpArchetypeXML( void* )
for (U8 te = 0; te < TEX_NUM_INDICES; te++)
{
- if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te) == type)
+ if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)te) == type)
{
// MULTIPLE_WEARABLES: extend to multiple wearables?
LLViewerTexture* te_image = ((LLVOAvatar *)(gAgentAvatarp))->getImage((ETextureIndex)te, 0);
@@ -8595,7 +8491,7 @@ void LLVOAvatar::idleUpdateRenderCost()
for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
{
- const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index);
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index);
ETextureIndex tex_index = baked_dict->mTextureIndex;
if ((tex_index != TEX_SKIRT_BAKED) || (isWearingWearableType(LLWearableType::WT_SKIRT)))
{
@@ -8675,11 +8571,11 @@ void LLVOAvatar::idleUpdateRenderCost()
}
// print any avatar textures we didn't already know about
- for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
- iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
+ iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
++iter)
{
- const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second;
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
// TODO: MULTI-WEARABLE: handle multiple textures for self
const LLViewerTexture* te_image = getImage(iter->first,0);
if (!te_image)
@@ -8708,26 +8604,26 @@ void LLVOAvatar::idleUpdateRenderCost()
BOOL LLVOAvatar::isIndexLocalTexture(ETextureIndex index)
{
if (index < 0 || index >= TEX_NUM_INDICES) return false;
- return LLVOAvatarDictionary::getInstance()->getTexture(index)->mIsLocalTexture;
+ return LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mIsLocalTexture;
}
// static
BOOL LLVOAvatar::isIndexBakedTexture(ETextureIndex index)
{
if (index < 0 || index >= TEX_NUM_INDICES) return false;
- return LLVOAvatarDictionary::getInstance()->getTexture(index)->mIsBakedTexture;
+ return LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mIsBakedTexture;
}
const std::string LLVOAvatar::getBakedStatusForPrintout() const
{
std::string line;
- for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
- iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
+ iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
++iter)
{
const ETextureIndex index = iter->first;
- const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second;
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
if (texture_dict->mIsBakedTexture)
{
line += texture_dict->mName;
@@ -8759,7 +8655,7 @@ F32 calc_bouncy_animation(F32 x)
}
//virtual
-BOOL LLVOAvatar::isTextureDefined(LLVOAvatarDefines::ETextureIndex te, U32 index ) const
+BOOL LLVOAvatar::isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex te, U32 index ) const
{
if (isIndexLocalTexture(te))
{
@@ -8771,7 +8667,7 @@ BOOL LLVOAvatar::isTextureDefined(LLVOAvatarDefines::ETextureIndex te, U32 index
}
//virtual
-BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index) const
+BOOL LLVOAvatar::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const
{
if (isIndexLocalTexture(type))
{
@@ -8787,7 +8683,7 @@ BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 ind
}
//virtual
-BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const
+BOOL LLVOAvatar::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const
{
// non-self avatars don't have wearables
return FALSE;
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 3f65dec11c..644ea22b53 100755
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -25,8 +25,8 @@
* $/LicenseInfo$
*/
-#ifndef LL_LLVOAVATAR_H
-#define LL_LLVOAVATAR_H
+#ifndef LL_VOAVATAR_H
+#define LL_VOAVATAR_H
#include <map>
#include <deque>
@@ -36,6 +36,7 @@
#include <boost/signals2.hpp>
#include "imageids.h" // IMG_INVISIBLE
+#include "llavatarappearance.h"
#include "llchat.h"
#include "lldrawpoolalpha.h"
#include "llviewerobject.h"
@@ -44,7 +45,7 @@
#include "llviewerjointmesh.h"
#include "llviewerjointattachment.h"
#include "llrendertarget.h"
-#include "llvoavatardefines.h"
+#include "llavatarappearancedefines.h"
#include "lltexglobalcolor.h"
#include "lldriverparam.h"
#include "material_codes.h" // LL_MCODE_END
@@ -62,7 +63,8 @@ extern const LLUUID ANIM_AGENT_PELVIS_FIX;
extern const LLUUID ANIM_AGENT_TARGET;
extern const LLUUID ANIM_AGENT_WALK_ADJUST;
-class LLTexLayerSet;
+class LLViewerTexLayerSet;
+class LLViewerWearable;
class LLVoiceVisualizer;
class LLHUDNameTag;
class LLHUDEffectSpiral;
@@ -75,8 +77,8 @@ class LLVOAvatarSkeletonInfo;
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLVOAvatar :
+ public LLAvatarAppearance,
public LLViewerObject,
- public LLCharacter,
public boost::signals2::trackable
{
LOG_CLASS(LLVOAvatar);
@@ -222,8 +224,20 @@ public:
public:
virtual bool isSelf() const { return false; } // True if this avatar is for this viewer's agent
+ /*virtual*/BOOL isUsingBakedTextures() const { return mUseServerBakes; } // e.g. false if in appearance edit mode
bool isBuilt() const { return mIsBuilt; }
+/********************************************************************************
+ ** **
+ ** WEARABLES
+ **/
+public:
+ /*virtual*/ U32 getWearableCount(const LLWearableType::EType type) const;
+ /*virtual*/ U32 getWearableCount(const U32 tex_index) const;
+
+ /*virtual*/ LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/);
+ /*virtual*/ const LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const;
+
private: //aligned members
LL_ALIGN_16(LLVector4a mImpostorExtents[2]);
@@ -440,7 +454,7 @@ public:
static void deleteCachedImages(bool clearAll=true);
static void destroyGL();
static void restoreGL();
- BOOL mIsDummy; // for special views
+ BOOL mIsDummy; // for special views
S32 mSpecialRenderMode; // special lighting
U32 mAttachmentGeometryBytes; //number of bytes in attached geometry
F32 mAttachmentSurfaceArea; //estimated surface area of attachments
@@ -458,9 +472,16 @@ private:
// Morph masks
//--------------------------------------------------------------------
public:
- BOOL morphMaskNeedsUpdate(LLVOAvatarDefines::EBakedTextureIndex index = LLVOAvatarDefines::BAKED_NUM_INDICES);
- void addMaskedMorph(LLVOAvatarDefines::EBakedTextureIndex index, LLPolyMorphTarget* morph_target, BOOL invert, std::string layer);
- void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLVOAvatarDefines::EBakedTextureIndex index = LLVOAvatarDefines::BAKED_NUM_INDICES);
+ BOOL morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES);
+ void addMaskedMorph(LLAvatarAppearanceDefines::EBakedTextureIndex index, LLPolyMorphTarget* morph_target, BOOL invert, std::string layer);
+ virtual void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES);
+
+
+ //--------------------------------------------------------------------
+ // Global colors
+ //--------------------------------------------------------------------
+public:
+ virtual void onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake);
//--------------------------------------------------------------------
// Visibility
@@ -561,9 +582,9 @@ public:
// Loading status
//--------------------------------------------------------------------
public:
- virtual BOOL isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const;
- virtual BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const;
- virtual BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const;
+ virtual BOOL isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex type, U32 index = 0) const;
+ virtual BOOL isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index = 0) const;
+ virtual BOOL isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const;
BOOL isFullyBaked();
static BOOL areAllNearbyInstancesBaked(S32& grey_avatars);
@@ -586,10 +607,10 @@ protected:
struct BakedTextureData
{
LLUUID mLastTextureIndex;
- LLTexLayerSet* mTexLayerSet; // Only exists for self
+ LLViewerTexLayerSet* mTexLayerSet; // Only exists for self
bool mIsLoaded;
bool mIsUsed;
- LLVOAvatarDefines::ETextureIndex mTextureIndex;
+ LLAvatarAppearanceDefines::ETextureIndex mTextureIndex;
U32 mMaskTexName;
// Stores pointers to the joint meshes that this baked texture deals with
std::vector< LLViewerJointMesh * > mMeshes; // std::vector<LLViewerJointMesh> mJoints[i]->mMeshParts
@@ -603,10 +624,10 @@ protected:
// Local Textures
//--------------------------------------------------------------------
protected:
- virtual void setLocalTexture(LLVOAvatarDefines::ETextureIndex type, LLViewerTexture* tex, BOOL baked_version_exits, U32 index = 0);
- virtual void addLocalTextureStats(LLVOAvatarDefines::ETextureIndex type, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked, U32 index = 0);
+ virtual void setLocalTexture(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerTexture* tex, BOOL baked_version_exits, U32 index = 0);
+ virtual void addLocalTextureStats(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked, U32 index = 0);
// MULTI-WEARABLE: make self-only?
- virtual void setBakedReady(LLVOAvatarDefines::ETextureIndex type, BOOL baked_version_exists, U32 index = 0);
+ virtual void setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index = 0);
//--------------------------------------------------------------------
// Texture accessors
@@ -641,11 +662,11 @@ public:
// Static texture/mesh/baked dictionary
//--------------------------------------------------------------------
public:
- static BOOL isIndexLocalTexture(LLVOAvatarDefines::ETextureIndex i);
- static BOOL isIndexBakedTexture(LLVOAvatarDefines::ETextureIndex i);
+ static BOOL isIndexLocalTexture(LLAvatarAppearanceDefines::ETextureIndex i);
+ static BOOL isIndexBakedTexture(LLAvatarAppearanceDefines::ETextureIndex i);
private:
- static const LLVOAvatarDefines::LLVOAvatarDictionary *getDictionary() { return sAvatarDictionary; }
- static LLVOAvatarDefines::LLVOAvatarDictionary* sAvatarDictionary;
+ static const LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary *getDictionary() { return sAvatarDictionary; }
+ static LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary* sAvatarDictionary;
static LLVOAvatarSkeletonInfo* sAvatarSkeletonInfo;
static LLVOAvatarXmlInfo* sAvatarXmlInfo;
@@ -668,15 +689,15 @@ private:
**/
public:
- void updateMeshTextures();
+ virtual void updateMeshTextures();
void updateSexDependentLayerSets(BOOL upload_bake);
- void dirtyMesh(); // Dirty the avatar mesh
+ virtual void dirtyMesh(); // Dirty the avatar mesh
void updateMeshData();
protected:
void releaseMeshData();
virtual void restoreMeshData();
private:
- void dirtyMesh(S32 priority); // Dirty the avatar mesh, with priority
+ virtual void dirtyMesh(S32 priority); // Dirty the avatar mesh, with priority
S32 mDirtyMesh; // 0 -- not dirty, 1 -- morphed, 2 -- LOD
BOOL mMeshTexturesDirty;
@@ -710,7 +731,6 @@ public:
//--------------------------------------------------------------------
public:
BOOL getIsAppearanceAnimating() const { return mAppearanceAnimating; }
- BOOL isUsingBakedTextures() const { return mUseServerBakes; } // e.g. false if in appearance edit mode
private:
BOOL mAppearanceAnimating;
LLFrameTimer mAppearanceMorphTimer;
@@ -720,25 +740,6 @@ private:
BOOL mUseServerBakes; // flag for if baked textures should be fetched from baking service (false if they're temporary uploads)
//--------------------------------------------------------------------
- // Clothing colors (convenience functions to access visual parameters)
- //--------------------------------------------------------------------
-public:
- void setClothesColor(LLVOAvatarDefines::ETextureIndex te, const LLColor4& new_color, BOOL upload_bake);
- LLColor4 getClothesColor(LLVOAvatarDefines::ETextureIndex te);
- static BOOL teToColorParams(LLVOAvatarDefines::ETextureIndex te, U32 *param_name);
-
- //--------------------------------------------------------------------
- // Global colors
- //--------------------------------------------------------------------
-public:
- LLColor4 getGlobalColor(const std::string& color_name ) const;
- void onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake);
-private:
- LLTexGlobalColor* mTexSkinColor;
- LLTexGlobalColor* mTexHairColor;
- LLTexGlobalColor* mTexEyeColor;
-
- //--------------------------------------------------------------------
// Visibility
//--------------------------------------------------------------------
public:
@@ -746,7 +747,6 @@ public:
void setVisibilityRank(U32 rank);
U32 getVisibilityRank() const { return mVisibilityRank; } // unused
static S32 sNumVisibleAvatars; // Number of instances of this class
- static LLColor4 getDummyColor();
/** Appearance
** **
*******************************************************************************/
@@ -1040,6 +1040,7 @@ public:
void debugAvatarRezTime(std::string notification_name, std::string comment = "");
F32 debugGetExistenceTimeElapsedF32() const { return mDebugExistenceTimer.getElapsedTimeF32(); }
+
protected:
LLFrameTimer mRuthDebugTimer; // For tracking how long it takes for av to rez
LLFrameTimer mDebugExistenceTimer; // Debugging for how long the avatar has been in memory.
@@ -1163,4 +1164,5 @@ protected: // Shared with LLVOAvatarSelf
extern const F32 SELF_ADDITIONAL_PRI;
extern const S32 MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL;
-#endif // LL_VO_AVATAR_H
+#endif // LL_VOAVATAR_H
+
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 6c8cbc37f7..ec37e6f301 100755
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -55,6 +55,8 @@
#include "llviewerobjectlist.h"
#include "llviewerstats.h"
#include "llviewerregion.h"
+#include "llviewertexlayer.h"
+#include "llviewerwearable.h"
#include "llappearancemgr.h"
#include "llmeshrepository.h"
#include "llvovolume.h"
@@ -110,7 +112,7 @@ void selfStopAllPhases()
}
}
-using namespace LLVOAvatarDefines;
+using namespace LLAvatarAppearanceDefines;
/*********************************************************************************
** **
@@ -188,7 +190,7 @@ void LLVOAvatarSelf::initInstance()
llinfos << "Self avatar object created. Starting timer." << llendl;
mDebugSelfLoadTimer.reset();
// clear all times to -1 for debugging
- for (U32 i =0; i < LLVOAvatarDefines::TEX_NUM_INDICES; ++i)
+ for (U32 i =0; i < LLAvatarAppearanceDefines::TEX_NUM_INDICES; ++i)
{
for (U32 j = 0; j <= MAX_DISCARD_LEVEL; ++j)
{
@@ -196,7 +198,7 @@ void LLVOAvatarSelf::initInstance()
}
}
- for (U32 i =0; i < LLVOAvatarDefines::BAKED_NUM_INDICES; ++i)
+ for (U32 i =0; i < LLAvatarAppearanceDefines::BAKED_NUM_INDICES; ++i)
{
mDebugBakedTextureTimes[i][0] = -1.0f;
mDebugBakedTextureTimes[i][1] = -1.0f;
@@ -595,7 +597,7 @@ BOOL LLVOAvatarSelf::loadLayersets()
{
// Construct a layerset for each one specified in avatar_lad.xml and initialize it as such.
const LLTexLayerSetInfo *info = *iter;
- LLTexLayerSet* layer_set = new LLTexLayerSet( this );
+ LLViewerTexLayerSet* layer_set = new LLViewerTexLayerSet( this );
if (!layer_set->setInfo(info))
{
@@ -607,11 +609,11 @@ BOOL LLVOAvatarSelf::loadLayersets()
// scan baked textures and associate the layerset with the appropriate one
EBakedTextureIndex baked_index = BAKED_NUM_INDICES;
- for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
- baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
+ for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin();
+ baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end();
++baked_iter)
{
- const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second;
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
if (layer_set->isBodyRegion(baked_dict->mName))
{
baked_index = baked_iter->first;
@@ -734,7 +736,7 @@ BOOL LLVOAvatarSelf::setParamWeight(LLViewerVisualParam *param, F32 weight, BOOL
U32 size = gAgentWearables.getWearableCount(type);
for (U32 count = 0; count < size; ++count)
{
- LLWearable *wearable = gAgentWearables.getWearable(type,count);
+ LLViewerWearable *wearable = gAgentWearables.getWearable(type,count);
if (wearable)
{
wearable->setVisualParamWeight(param->getID(), weight, upload_bake);
@@ -760,7 +762,7 @@ void LLVOAvatarSelf::idleUpdateAppearanceAnimation()
// apply wearable visual params to avatar
for (U32 type = 0; type < LLWearableType::WT_COUNT; type++)
{
- LLWearable *wearable = gAgentWearables.getTopWearable((LLWearableType::EType)type);
+ LLViewerWearable *wearable = gAgentWearables.getTopWearable((LLWearableType::EType)type);
if (wearable)
{
wearable->writeToAvatar();
@@ -817,7 +819,7 @@ U32 LLVOAvatarSelf::processUpdateMessage(LLMessageSystem *mesgsys,
// need to trigger a few operations to get the avatar to use the new bakes
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
- const LLVOAvatarDefines::ETextureIndex te = mBakedTextureDatas[i].mTextureIndex;
+ const LLAvatarAppearanceDefines::ETextureIndex te = mBakedTextureDatas[i].mTextureIndex;
LLUUID texture_id = getTEImage(te)->getID();
setNewBakedTexture(te, texture_id);
mInitialBakeIDs[i] = texture_id;
@@ -1072,16 +1074,16 @@ void LLVOAvatarSelf::updateAttachmentVisibility(U32 camera_mode)
//-----------------------------------------------------------------------------
void LLVOAvatarSelf::wearableUpdated( LLWearableType::EType type, BOOL upload_result )
{
- for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
- baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
+ for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin();
+ baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end();
++baked_iter)
{
- const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second;
- const LLVOAvatarDefines::EBakedTextureIndex index = baked_iter->first;
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
+ const LLAvatarAppearanceDefines::EBakedTextureIndex index = baked_iter->first;
if (baked_dict)
{
- for (LLVOAvatarDefines::wearables_vec_t::const_iterator type_iter = baked_dict->mWearables.begin();
+ for (LLAvatarAppearanceDefines::wearables_vec_t::const_iterator type_iter = baked_dict->mWearables.begin();
type_iter != baked_dict->mWearables.end();
++type_iter)
{
@@ -1304,9 +1306,9 @@ BOOL LLVOAvatarSelf::detachAttachmentIntoInventory(const LLUUID &item_id)
return FALSE;
}
-U32 LLVOAvatarSelf::getNumWearables(LLVOAvatarDefines::ETextureIndex i) const
+U32 LLVOAvatarSelf::getNumWearables(LLAvatarAppearanceDefines::ETextureIndex i) const
{
- LLWearableType::EType type = LLVOAvatarDictionary::getInstance()->getTEWearableType(i);
+ LLWearableType::EType type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType(i);
return gAgentWearables.getWearableCount(type);
}
@@ -1375,11 +1377,11 @@ BOOL LLVOAvatarSelf::getLocalTextureGL(ETextureIndex type, LLViewerTexture** tex
{
return FALSE;
}
- *tex_pp = local_tex_obj->getImage();
+ *tex_pp = dynamic_cast<LLViewerTexture*> (local_tex_obj->getImage());
return TRUE;
}
-LLViewerFetchedTexture* LLVOAvatarSelf::getLocalTextureGL(LLVOAvatarDefines::ETextureIndex type, U32 index) const
+LLViewerFetchedTexture* LLVOAvatarSelf::getLocalTextureGL(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const
{
if (!isIndexLocalTexture(type))
{
@@ -1395,7 +1397,7 @@ LLViewerFetchedTexture* LLVOAvatarSelf::getLocalTextureGL(LLVOAvatarDefines::ETe
{
return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR);
}
- return local_tex_obj->getImage();
+ return dynamic_cast<LLViewerFetchedTexture*> (local_tex_obj->getImage());
}
const LLUUID& LLVOAvatarSelf::getLocalTextureID(ETextureIndex type, U32 index) const
@@ -1416,25 +1418,25 @@ const LLUUID& LLVOAvatarSelf::getLocalTextureID(ETextureIndex type, U32 index) c
// Returns true if at least the lowest quality discard level exists for every texture
// in the layerset.
//-----------------------------------------------------------------------------
-BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLTexLayerSet* layerset) const
+BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLViewerTexLayerSet* layerset) const
{
/* if (layerset == mBakedTextureDatas[BAKED_HEAD].mTexLayerSet)
return getLocalDiscardLevel(TEX_HEAD_BODYPAINT) >= 0; */
- for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
- baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
+ for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin();
+ baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end();
++baked_iter)
{
const EBakedTextureIndex baked_index = baked_iter->first;
if (layerset == mBakedTextureDatas[baked_index].mTexLayerSet)
{
BOOL ret = true;
- const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second;
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
local_tex_iter != baked_dict->mLocalTextures.end();
++local_tex_iter)
{
const ETextureIndex tex_index = *local_tex_iter;
- const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
+ const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(tex_index);
const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
{
@@ -1454,7 +1456,7 @@ BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLTexLayerSet* layerset)
// Returns true if the highest quality discard level exists for every texture
// in the layerset.
//-----------------------------------------------------------------------------
-BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLTexLayerSet* layerset) const
+BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset) const
{
const U32 desired_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
// const U32 desired_tex_discard_level = 0; // hack to not bake textures on lower discard levels.
@@ -1463,13 +1465,13 @@ BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLTexLayerSet* layerset) cons
{
if (layerset == mBakedTextureDatas[i].mTexLayerSet)
{
- const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i);
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i);
for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
local_tex_iter != baked_dict->mLocalTextures.end();
++local_tex_iter)
{
const ETextureIndex tex_index = *local_tex_iter;
- const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
+ const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(tex_index);
const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
{
@@ -1493,13 +1495,13 @@ BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
- const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i);
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i);
for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
local_tex_iter != baked_dict->mLocalTextures.end();
++local_tex_iter)
{
const ETextureIndex tex_index = *local_tex_iter;
- const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
+ const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(tex_index);
const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
{
@@ -1513,22 +1515,22 @@ BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const
return TRUE;
}
-BOOL LLVOAvatarSelf::isBakedTextureFinal(const LLVOAvatarDefines::EBakedTextureIndex index) const
+BOOL LLVOAvatarSelf::isBakedTextureFinal(const LLAvatarAppearanceDefines::EBakedTextureIndex index) const
{
- const LLTexLayerSet *layerset = mBakedTextureDatas[index].mTexLayerSet;
+ const LLViewerTexLayerSet *layerset = mBakedTextureDatas[index].mTexLayerSet;
if (!layerset) return FALSE;
const LLTexLayerSetBuffer *layerset_buffer = layerset->getComposite();
if (!layerset_buffer) return FALSE;
return !layerset_buffer->uploadNeeded();
}
-BOOL LLVOAvatarSelf::isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index) const
+BOOL LLVOAvatarSelf::isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const
{
LLUUID id;
BOOL isDefined = TRUE;
if (isIndexLocalTexture(type))
{
- const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(type);
+ const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(type);
const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
if (index >= wearable_count)
{
@@ -1555,7 +1557,7 @@ BOOL LLVOAvatarSelf::isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32
}
//virtual
-BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index) const
+BOOL LLVOAvatarSelf::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const
{
if (isIndexBakedTexture(type))
{
@@ -1568,7 +1570,7 @@ BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32
}
//virtual
-BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const
+BOOL LLVOAvatarSelf::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const
{
if (isIndexBakedTexture(type))
{
@@ -1591,7 +1593,7 @@ void LLVOAvatarSelf::requestLayerSetUploads()
}
}
-void LLVOAvatarSelf::requestLayerSetUpload(LLVOAvatarDefines::EBakedTextureIndex i)
+void LLVOAvatarSelf::requestLayerSetUpload(LLAvatarAppearanceDefines::EBakedTextureIndex i)
{
ETextureIndex tex_index = mBakedTextureDatas[i].mTextureIndex;
const BOOL layer_baked = isTextureDefined(tex_index, gAgentWearables.getWearableCount(tex_index));
@@ -1611,7 +1613,7 @@ bool LLVOAvatarSelf::hasPendingBakedUploads() const
{
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
- LLTexLayerSet* layerset = mBakedTextureDatas[i].mTexLayerSet;
+ LLViewerTexLayerSet* layerset = mBakedTextureDatas[i].mTexLayerSet;
if (layerset && layerset->getComposite() && layerset->getComposite()->uploadPending())
{
return true;
@@ -1620,7 +1622,7 @@ bool LLVOAvatarSelf::hasPendingBakedUploads() const
return false;
}
-void LLVOAvatarSelf::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_result )
+void LLVOAvatarSelf::invalidateComposite( LLViewerTexLayerSet* layerset, BOOL upload_result )
{
if( !layerset || !layerset->getUpdatesEnabled() )
{
@@ -1712,11 +1714,12 @@ S32 LLVOAvatarSelf::getLocalDiscardLevel(ETextureIndex type, U32 wearable_index)
const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type, wearable_index);
if (local_tex_obj)
{
+ const LLViewerFetchedTexture* image = dynamic_cast<LLViewerFetchedTexture*>( local_tex_obj->getImage() );
if (type >= 0
&& local_tex_obj->getID() != IMG_DEFAULT_AVATAR
- && !local_tex_obj->getImage()->isMissingAsset())
+ && !image->isMissingAsset())
{
- return local_tex_obj->getImage()->getDiscardLevel();
+ return image->getDiscardLevel();
}
else
{
@@ -1741,7 +1744,7 @@ void LLVOAvatarSelf::getLocalTextureByteCount(S32* gl_bytes) const
const LLLocalTextureObject *local_tex_obj = getLocalTextureObject((ETextureIndex) type, num);
if (local_tex_obj)
{
- const LLViewerFetchedTexture* image_gl = local_tex_obj->getImage();
+ const LLViewerFetchedTexture* image_gl = dynamic_cast<LLViewerFetchedTexture*>( local_tex_obj->getImage() );
if (image_gl)
{
S32 bytes = (S32)image_gl->getWidth() * image_gl->getHeight() * image_gl->getComponents();
@@ -1776,7 +1779,7 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te
llerrs << "Tried to set local texture with invalid type: (" << (U32) type << ", " << index << ")" << llendl;
return;
}
- LLWearableType::EType wearable_type = LLVOAvatarDictionary::getInstance()->getTEWearableType(type);
+ LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType(type);
if (!gAgentWearables.getWearable(wearable_type,index))
{
// no wearable is loaded, cannot set the texture.
@@ -1790,7 +1793,7 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te
return;
}
- LLTexLayerSet *layer_set = getLayerSet(type);
+ LLViewerTexLayerSet *layer_set = getLayerSet(type);
if (layer_set)
{
layer_set->cloneTemplates(local_tex_obj, type, gAgentWearables.getWearable(wearable_type,index));
@@ -1814,15 +1817,15 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te
if (isSelf())
{
if (gAgentAvatarp->isUsingBakedTextures())
- {
- requestLayerSetUpdate(type);
- }
+ {
+ requestLayerSetUpdate(type);
+ }
else
- {
- LLVisualParamHint::requestHintUpdates();
+ {
+ LLVisualParamHint::requestHintUpdates();
+ }
}
}
- }
else
{
tex->setLoadedCallback(onLocalTextureLoaded, desired_discard, TRUE, FALSE, new LLAvatarTexData(getID(), type), NULL);
@@ -1836,7 +1839,7 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te
setBakedReady(type,baked_version_ready,index);
}
//virtual
-void LLVOAvatarSelf::setBakedReady(LLVOAvatarDefines::ETextureIndex type, BOOL baked_version_exists, U32 index)
+void LLVOAvatarSelf::setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index)
{
if (!isIndexLocalTexture(type)) return;
LLLocalTextureObject *local_tex_obj = getLocalTextureObject(type,index);
@@ -1855,16 +1858,16 @@ void LLVOAvatarSelf::dumpLocalTextures() const
/* ETextureIndex baked_equiv[] = {
TEX_UPPER_BAKED,
if (isTextureDefined(baked_equiv[i])) */
- for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
- iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
+ iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
++iter)
{
- const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second;
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
if (!texture_dict->mIsLocalTexture || !texture_dict->mIsUsedByBakedTexture)
continue;
const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
- const ETextureIndex baked_equiv = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex;
+ const ETextureIndex baked_equiv = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex;
const std::string &name = texture_dict->mName;
const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(iter->first, 0);
@@ -1887,7 +1890,7 @@ void LLVOAvatarSelf::dumpLocalTextures() const
}
else
{
- const LLViewerFetchedTexture* image = local_tex_obj->getImage();
+ const LLViewerFetchedTexture* image = dynamic_cast<LLViewerFetchedTexture*>( local_tex_obj->getImage() );
llinfos << "LocTex " << name << ": "
<< "Discard " << image->getDiscardLevel() << ", "
@@ -2060,7 +2063,7 @@ void LLVOAvatarSelf::debugBakedTextureUpload(EBakedTextureIndex index, BOOL fini
mDebugBakedTextureTimes[index][done] = mDebugSelfLoadTimer.getElapsedTimeF32();
}
-const std::string LLVOAvatarSelf::debugDumpLocalTextureDataInfo(const LLTexLayerSet* layerset) const
+const std::string LLVOAvatarSelf::debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const
{
std::string text="";
@@ -2068,21 +2071,21 @@ const std::string LLVOAvatarSelf::debugDumpLocalTextureDataInfo(const LLTexLayer
/* if (layerset == mBakedTextureDatas[BAKED_HEAD].mTexLayerSet)
return getLocalDiscardLevel(TEX_HEAD_BODYPAINT) >= 0; */
- for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
- baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
+ for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin();
+ baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end();
++baked_iter)
{
const EBakedTextureIndex baked_index = baked_iter->first;
if (layerset == mBakedTextureDatas[baked_index].mTexLayerSet)
{
- const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second;
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
text += llformat("%d-%s ( ",baked_index, baked_dict->mName.c_str());
for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
local_tex_iter != baked_dict->mLocalTextures.end();
++local_tex_iter)
{
const ETextureIndex tex_index = *local_tex_iter;
- const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
+ const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(tex_index);
const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
if (wearable_count > 0)
{
@@ -2109,14 +2112,14 @@ const std::string LLVOAvatarSelf::debugDumpAllLocalTextureDataInfo() const
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
- const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i);
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i);
BOOL is_texture_final = TRUE;
for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
local_tex_iter != baked_dict->mLocalTextures.end();
++local_tex_iter)
{
const ETextureIndex tex_index = *local_tex_iter;
- const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(tex_index);
+ const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(tex_index);
const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
{
@@ -2240,7 +2243,7 @@ const LLUUID& LLVOAvatarSelf::grabBakedTexture(EBakedTextureIndex baked_index) c
{
if (canGrabBakedTexture(baked_index))
{
- ETextureIndex tex_index = LLVOAvatarDictionary::bakedToLocalTextureIndex(baked_index);
+ ETextureIndex tex_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(baked_index);
if (tex_index == TEX_NUM_INDICES)
{
return LLUUID::null;
@@ -2252,7 +2255,7 @@ const LLUUID& LLVOAvatarSelf::grabBakedTexture(EBakedTextureIndex baked_index) c
BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const
{
- ETextureIndex tex_index = LLVOAvatarDictionary::bakedToLocalTextureIndex(baked_index);
+ ETextureIndex tex_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(baked_index);
if (tex_index == TEX_NUM_INDICES)
{
return FALSE;
@@ -2271,19 +2274,19 @@ BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const
// baked texture. We don't want people copying people's
// work via baked textures.
- const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index);
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index);
for (texture_vec_t::const_iterator iter = baked_dict->mLocalTextures.begin();
iter != baked_dict->mLocalTextures.end();
++iter)
{
const ETextureIndex t_index = (*iter);
- LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType(t_index);
+ LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(t_index);
U32 count = gAgentWearables.getWearableCount(wearable_type);
lldebugs << "Checking index " << (U32) t_index << " count: " << count << llendl;
for (U32 wearable_index = 0; wearable_index < count; ++wearable_index)
{
- LLWearable *wearable = gAgentWearables.getWearable(wearable_type, wearable_index);
+ LLViewerWearable *wearable = gAgentWearables.getWearable(wearable_type, wearable_index);
if (wearable)
{
const LLLocalTextureObject *texture = wearable->getLocalTextureObject((S32)t_index);
@@ -2355,10 +2358,10 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe
}
}
-LLLocalTextureObject* LLVOAvatarSelf::getLocalTextureObject(LLVOAvatarDefines::ETextureIndex i, U32 wearable_index) const
+LLLocalTextureObject* LLVOAvatarSelf::getLocalTextureObject(LLAvatarAppearanceDefines::ETextureIndex i, U32 wearable_index) const
{
- LLWearableType::EType type = LLVOAvatarDictionary::getInstance()->getTEWearableType(i);
- LLWearable* wearable = gAgentWearables.getWearable(type, wearable_index);
+ LLWearableType::EType type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType(i);
+ LLViewerWearable* wearable = gAgentWearables.getWearable(type, wearable_index);
if (wearable)
{
return wearable->getLocalTextureObject(i);
@@ -2371,7 +2374,7 @@ LLLocalTextureObject* LLVOAvatarSelf::getLocalTextureObject(LLVOAvatarDefines::E
// getBakedTE()
// Used by the LayerSet. (Layer sets don't in general know what textures depend on them.)
//-----------------------------------------------------------------------------
-ETextureIndex LLVOAvatarSelf::getBakedTE( const LLTexLayerSet* layerset ) const
+ETextureIndex LLVOAvatarSelf::getBakedTE( const LLViewerTexLayerSet* layerset ) const
{
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
@@ -2385,9 +2388,9 @@ ETextureIndex LLVOAvatarSelf::getBakedTE( const LLTexLayerSet* layerset ) const
}
-void LLVOAvatarSelf::setNewBakedTexture(LLVOAvatarDefines::EBakedTextureIndex i, const LLUUID &uuid)
+void LLVOAvatarSelf::setNewBakedTexture(LLAvatarAppearanceDefines::EBakedTextureIndex i, const LLUUID &uuid)
{
- ETextureIndex index = LLVOAvatarDictionary::bakedToLocalTextureIndex(i);
+ ETextureIndex index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(i);
setNewBakedTexture(index, uuid);
}
@@ -2409,7 +2412,7 @@ void LLVOAvatarSelf::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid )
/* switch(te)
case TEX_HEAD_BAKED:
llinfos << "New baked texture: HEAD" << llendl; */
- const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(te);
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(te);
if (texture_dict->mIsBakedTexture)
{
debugBakedTextureUpload(texture_dict->mBakedTextureIndex, TRUE); // FALSE for start of upload, TRUE for finish.
@@ -2474,7 +2477,7 @@ void LLVOAvatarSelf::outputRezDiagnostics() const
LL_DEBUGS("Avatar") << "\t Time from avatar creation to de-cloud: " << (S32)mDebugTimeAvatarVisible << llendl;
LL_DEBUGS("Avatar") << "\t Time from avatar creation to de-cloud for others: " << (S32)final_time << llendl;
LL_DEBUGS("Avatar") << "\t Load time for each texture: " << llendl;
- for (U32 i = 0; i < LLVOAvatarDefines::TEX_NUM_INDICES; ++i)
+ for (U32 i = 0; i < LLAvatarAppearanceDefines::TEX_NUM_INDICES; ++i)
{
std::stringstream out;
out << "\t\t (" << i << ") ";
@@ -2502,17 +2505,17 @@ void LLVOAvatarSelf::outputRezDiagnostics() const
}
}
LL_DEBUGS("Avatar") << "\t Time points for each upload (start / finish)" << llendl;
- for (U32 i = 0; i < LLVOAvatarDefines::BAKED_NUM_INDICES; ++i)
+ for (U32 i = 0; i < LLAvatarAppearanceDefines::BAKED_NUM_INDICES; ++i)
{
LL_DEBUGS("Avatar") << "\t\t (" << i << ") \t" << (S32)mDebugBakedTextureTimes[i][0] << " / " << (S32)mDebugBakedTextureTimes[i][1] << llendl;
}
- for (LLVOAvatarDefines::LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDefines::LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
- baked_iter != LLVOAvatarDefines::LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
+ for (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin();
+ baked_iter != LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end();
++baked_iter)
{
- const LLVOAvatarDefines::EBakedTextureIndex baked_index = baked_iter->first;
- const LLTexLayerSet *layerset = debugGetLayerSet(baked_index);
+ const LLAvatarAppearanceDefines::EBakedTextureIndex baked_index = baked_iter->first;
+ const LLViewerTexLayerSet *layerset = debugGetLayerSet(baked_index);
if (!layerset) continue;
const LLTexLayerSetBuffer *layerset_buffer = layerset->getComposite();
if (!layerset_buffer) continue;
@@ -2580,17 +2583,17 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**)
/* ETextureIndex baked_texture_indices[BAKED_NUM_INDICES] =
TEX_HEAD_BAKED,
TEX_UPPER_BAKED, */
- for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
- iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
+ iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
++iter)
{
const ETextureIndex index = iter->first;
- const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second;
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
if (texture_dict->mIsBakedTexture)
{
if (texture_id == gAgentAvatarp->getTEImage(index)->getID())
{
- LLTexLayerSet* layer_set = gAgentAvatarp->getLayerSet(index);
+ LLViewerTexLayerSet* layer_set = gAgentAvatarp->getLayerSet(index);
if (layer_set)
{
llinfos << "TAT: rebake - matched entry " << (S32)index << llendl;
@@ -2622,7 +2625,7 @@ void LLVOAvatarSelf::forceBakeAllTextures(bool slam_for_debug)
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
ETextureIndex baked_index = mBakedTextureDatas[i].mTextureIndex;
- LLTexLayerSet* layer_set = getLayerSet(baked_index);
+ LLViewerTexLayerSet* layer_set = getLayerSet(baked_index);
if (layer_set)
{
if (slam_for_debug)
@@ -2654,7 +2657,7 @@ void LLVOAvatarSelf::requestLayerSetUpdate(ETextureIndex index )
case LOCTEX_UPPER_SHIRT:
if( mUpperBodyLayerSet )
mUpperBodyLayerSet->requestUpdate(); */
- const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(index);
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(index);
if (!texture_dict->mIsLocalTexture || !texture_dict->mIsUsedByBakedTexture)
return;
const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
@@ -2664,13 +2667,13 @@ void LLVOAvatarSelf::requestLayerSetUpdate(ETextureIndex index )
}
}
-LLTexLayerSet* LLVOAvatarSelf::getLayerSet(ETextureIndex index) const
+LLViewerTexLayerSet* LLVOAvatarSelf::getLayerSet(ETextureIndex index) const
{
/* switch(index)
case TEX_HEAD_BAKED:
case TEX_HEAD_BODYPAINT:
return mHeadLayerSet; */
- const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(index);
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(index);
if (texture_dict->mIsUsedByBakedTexture)
{
const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
@@ -2679,7 +2682,7 @@ LLTexLayerSet* LLVOAvatarSelf::getLayerSet(ETextureIndex index) const
return NULL;
}
-LLTexLayerSet* LLVOAvatarSelf::getLayerSet(EBakedTextureIndex baked_index) const
+LLViewerTexLayerSet* LLVOAvatarSelf::getLayerSet(EBakedTextureIndex baked_index) const
{
/* switch(index)
case TEX_HEAD_BAKED:
@@ -2744,12 +2747,12 @@ bool LLVOAvatarSelf::sendAppearanceMessage(LLMessageSystem *mesgsys) const
{
LLUUID texture_id[TEX_NUM_INDICES];
// pack away current TEs to make sure we don't send them out
- for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
- iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
+ iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
++iter)
{
const ETextureIndex index = iter->first;
- const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second;
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
if (!texture_dict->mIsBakedTexture)
{
LLTextureEntry* entry = getTE((U8) index);
@@ -2761,12 +2764,12 @@ bool LLVOAvatarSelf::sendAppearanceMessage(LLMessageSystem *mesgsys) const
bool success = packTEMessage(mesgsys);
// unpack TEs to make sure we don't re-trigger a bake
- for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
- iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
+ for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
+ iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
++iter)
{
const ETextureIndex index = iter->first;
- const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second;
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
if (!texture_dict->mIsBakedTexture)
{
LLTextureEntry* entry = getTE((U8) index);
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index 92d59dc9e1..d4bde1f61f 100755
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -195,32 +195,32 @@ public:
//--------------------------------------------------------------------
public:
/*virtual*/ bool hasPendingBakedUploads() const;
- S32 getLocalDiscardLevel(LLVOAvatarDefines::ETextureIndex type, U32 index) const;
+ S32 getLocalDiscardLevel(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const;
bool areTexturesCurrent() const;
- BOOL isLocalTextureDataAvailable(const LLTexLayerSet* layerset) const;
- BOOL isLocalTextureDataFinal(const LLTexLayerSet* layerset) const;
- BOOL isBakedTextureFinal(const LLVOAvatarDefines::EBakedTextureIndex index) const;
+ BOOL isLocalTextureDataAvailable(const LLViewerTexLayerSet* layerset) const;
+ BOOL isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset) const;
+ BOOL isBakedTextureFinal(const LLAvatarAppearanceDefines::EBakedTextureIndex index) const;
// If you want to check all textures of a given type, pass gAgentWearables.getWearableCount() for index
- /*virtual*/ BOOL isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index) const;
- /*virtual*/ BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const;
- /*virtual*/ BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const;
+ /*virtual*/ BOOL isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const;
+ /*virtual*/ BOOL isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index = 0) const;
+ /*virtual*/ BOOL isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const;
//--------------------------------------------------------------------
// Local Textures
//--------------------------------------------------------------------
public:
- BOOL getLocalTextureGL(LLVOAvatarDefines::ETextureIndex type, LLViewerTexture** image_gl_pp, U32 index) const;
- LLViewerFetchedTexture* getLocalTextureGL(LLVOAvatarDefines::ETextureIndex type, U32 index) const;
- const LLUUID& getLocalTextureID(LLVOAvatarDefines::ETextureIndex type, U32 index) const;
+ BOOL getLocalTextureGL(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerTexture** image_gl_pp, U32 index) const;
+ LLViewerFetchedTexture* getLocalTextureGL(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const;
+ const LLUUID& getLocalTextureID(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const;
void setLocalTextureTE(U8 te, LLViewerTexture* image, U32 index);
- /*virtual*/ void setLocalTexture(LLVOAvatarDefines::ETextureIndex type, LLViewerTexture* tex, BOOL baked_version_exits, U32 index);
+ /*virtual*/ void setLocalTexture(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerTexture* tex, BOOL baked_version_exits, U32 index);
protected:
- /*virtual*/ void setBakedReady(LLVOAvatarDefines::ETextureIndex type, BOOL baked_version_exists, U32 index);
+ /*virtual*/ void setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index);
void localTextureLoaded(BOOL succcess, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
void getLocalTextureByteCount(S32* gl_byte_count) const;
- /*virtual*/ void addLocalTextureStats(LLVOAvatarDefines::ETextureIndex i, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked, U32 index);
- LLLocalTextureObject* getLocalTextureObject(LLVOAvatarDefines::ETextureIndex i, U32 index) const;
+ /*virtual*/ void addLocalTextureStats(LLAvatarAppearanceDefines::ETextureIndex i, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked, U32 index);
+ LLLocalTextureObject* getLocalTextureObject(LLAvatarAppearanceDefines::ETextureIndex i, U32 index) const;
private:
static void onLocalTextureLoaded(BOOL succcess, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
@@ -233,10 +233,10 @@ private:
// Baked textures
//--------------------------------------------------------------------
public:
- LLVOAvatarDefines::ETextureIndex getBakedTE(const LLTexLayerSet* layerset ) const;
- void setNewBakedTexture(LLVOAvatarDefines::EBakedTextureIndex i, const LLUUID &uuid);
- void setNewBakedTexture(LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid);
- void setCachedBakedTexture(LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid);
+ LLAvatarAppearanceDefines::ETextureIndex getBakedTE(const LLViewerTexLayerSet* layerset ) const;
+ void setNewBakedTexture(LLAvatarAppearanceDefines::EBakedTextureIndex i, const LLUUID &uuid);
+ void setNewBakedTexture(LLAvatarAppearanceDefines::ETextureIndex i, const LLUUID& uuid);
+ void setCachedBakedTexture(LLAvatarAppearanceDefines::ETextureIndex i, const LLUUID& uuid);
void forceBakeAllTextures(bool slam_for_debug = false);
static void processRebakeAvatarTextures(LLMessageSystem* msg, void**);
protected:
@@ -247,16 +247,16 @@ protected:
//--------------------------------------------------------------------
public:
void requestLayerSetUploads();
- void requestLayerSetUpload(LLVOAvatarDefines::EBakedTextureIndex i);
- void requestLayerSetUpdate(LLVOAvatarDefines::ETextureIndex i);
- LLTexLayerSet* getLayerSet(LLVOAvatarDefines::ETextureIndex index) const;
- LLTexLayerSet* getLayerSet(LLVOAvatarDefines::EBakedTextureIndex baked_index) const;
+ void requestLayerSetUpload(LLAvatarAppearanceDefines::EBakedTextureIndex i);
+ void requestLayerSetUpdate(LLAvatarAppearanceDefines::ETextureIndex i);
+ LLViewerTexLayerSet* getLayerSet(LLAvatarAppearanceDefines::ETextureIndex index) const;
+ LLViewerTexLayerSet* getLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const;
//--------------------------------------------------------------------
// Composites
//--------------------------------------------------------------------
public:
- /* virtual */ void invalidateComposite(LLTexLayerSet* layerset, BOOL upload_result);
+ /* virtual */ void invalidateComposite(LLViewerTexLayerSet* layerset, BOOL upload_result);
/* virtual */ void invalidateAll();
/* virtual */ void setCompositeUpdatesEnabled(bool b); // only works for self
/* virtual */ void setCompositeUpdatesEnabled(U32 index, bool b);
@@ -264,8 +264,8 @@ public:
void setupComposites();
void updateComposites();
- const LLUUID& grabBakedTexture(LLVOAvatarDefines::EBakedTextureIndex baked_index) const;
- BOOL canGrabBakedTexture(LLVOAvatarDefines::EBakedTextureIndex baked_index) const;
+ const LLUUID& grabBakedTexture(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const;
+ BOOL canGrabBakedTexture(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const;
//--------------------------------------------------------------------
@@ -302,7 +302,7 @@ public:
/*virtual*/ BOOL isWearingWearableType(LLWearableType::EType type) const;
void wearableUpdated(LLWearableType::EType type, BOOL upload_result);
protected:
- U32 getNumWearables(LLVOAvatarDefines::ETextureIndex i) const;
+ U32 getNumWearables(LLAvatarAppearanceDefines::ETextureIndex i) const;
//--------------------------------------------------------------------
// Attachments
@@ -371,25 +371,25 @@ public:
public:
struct LLAvatarTexData
{
- LLAvatarTexData(const LLUUID& id, LLVOAvatarDefines::ETextureIndex index) :
+ LLAvatarTexData(const LLUUID& id, LLAvatarAppearanceDefines::ETextureIndex index) :
mAvatarID(id),
mIndex(index)
{}
LLUUID mAvatarID;
- LLVOAvatarDefines::ETextureIndex mIndex;
+ LLAvatarAppearanceDefines::ETextureIndex mIndex;
};
void debugWearablesLoaded() { mDebugTimeWearablesLoaded = mDebugSelfLoadTimer.getElapsedTimeF32(); }
void debugAvatarVisible() { mDebugTimeAvatarVisible = mDebugSelfLoadTimer.getElapsedTimeF32(); }
void outputRezDiagnostics() const;
void outputRezTiming(const std::string& msg) const;
void reportAvatarRezTime() const;
- void debugBakedTextureUpload(LLVOAvatarDefines::EBakedTextureIndex index, BOOL finished);
+ void debugBakedTextureUpload(LLAvatarAppearanceDefines::EBakedTextureIndex index, BOOL finished);
static void debugOnTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
BOOL isAllLocalTextureDataFinal() const;
- const LLTexLayerSet* debugGetLayerSet(LLVOAvatarDefines::EBakedTextureIndex index) const { return mBakedTextureDatas[index].mTexLayerSet; }
- const std::string debugDumpLocalTextureDataInfo(const LLTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer
+ const LLViewerTexLayerSet* debugGetLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex index) const { return mBakedTextureDatas[index].mTexLayerSet; }
+ const std::string debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer
const std::string debugDumpAllLocalTextureDataInfo() const; // Lists out which baked textures are at highest LOD
LLSD metricsData();
void sendAppearanceChangeMetrics(); // send data associated with completing a change.
@@ -397,8 +397,8 @@ private:
LLFrameTimer mDebugSelfLoadTimer;
F32 mDebugTimeWearablesLoaded;
F32 mDebugTimeAvatarVisible;
- F32 mDebugTextureLoadTimes[LLVOAvatarDefines::TEX_NUM_INDICES][MAX_DISCARD_LEVEL+1]; // load time for each texture at each discard level
- F32 mDebugBakedTextureTimes[LLVOAvatarDefines::BAKED_NUM_INDICES][2]; // time to start upload and finish upload of each baked texture
+ F32 mDebugTextureLoadTimes[LLAvatarAppearanceDefines::TEX_NUM_INDICES][MAX_DISCARD_LEVEL+1]; // load time for each texture at each discard level
+ F32 mDebugBakedTextureTimes[LLAvatarAppearanceDefines::BAKED_NUM_INDICES][2]; // time to start upload and finish upload of each baked texture
void debugTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
/** Diagnostics
diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp
index 6f6411ce3c..9f04fbecf0 100644
--- a/indra/newview/llwearablelist.cpp
+++ b/indra/newview/llwearablelist.cpp
@@ -42,7 +42,7 @@ struct LLWearableArrivedData
{
LLWearableArrivedData(LLAssetType::EType asset_type,
const std::string& wearable_name,
- void(*asset_arrived_callback)(LLWearable*, void* userdata),
+ void(*asset_arrived_callback)(LLViewerWearable*, void* userdata),
void* userdata) :
mAssetType( asset_type ),
mCallback( asset_arrived_callback ),
@@ -52,7 +52,7 @@ struct LLWearableArrivedData
{}
LLAssetType::EType mAssetType;
- void (*mCallback)(LLWearable*, void* userdata);
+ void (*mCallback)(LLViewerWearable*, void* userdata);
void* mUserdata;
std::string mName;
S32 mRetries;
@@ -72,10 +72,10 @@ void LLWearableList::cleanup()
mList.clear();
}
-void LLWearableList::getAsset(const LLAssetID& assetID, const std::string& wearable_name, LLAssetType::EType asset_type, void(*asset_arrived_callback)(LLWearable*, void* userdata), void* userdata)
+void LLWearableList::getAsset(const LLAssetID& assetID, const std::string& wearable_name, LLAssetType::EType asset_type, void(*asset_arrived_callback)(LLViewerWearable*, void* userdata), void* userdata)
{
llassert( (asset_type == LLAssetType::AT_CLOTHING) || (asset_type == LLAssetType::AT_BODYPART) );
- LLWearable* instance = get_if_there(mList, assetID, (LLWearable*)NULL );
+ LLViewerWearable* instance = get_if_there(mList, assetID, (LLViewerWearable*)NULL );
if( instance )
{
asset_arrived_callback( instance, userdata );
@@ -95,7 +95,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID
{
BOOL isNewWearable = FALSE;
LLWearableArrivedData* data = (LLWearableArrivedData*) userdata;
- LLWearable* wearable = NULL; // NULL indicates failure
+ LLViewerWearable* wearable = NULL; // NULL indicates failure
if( !filename )
{
@@ -111,7 +111,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID
}
else
{
- wearable = new LLWearable(uuid);
+ wearable = new LLViewerWearable(uuid);
bool res = wearable->importFile( fp );
if (!res)
{
@@ -203,11 +203,11 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID
}
-LLWearable* LLWearableList::createCopy(const LLWearable* old_wearable, const std::string& new_name)
+LLViewerWearable* LLWearableList::createCopy(const LLViewerWearable* old_wearable, const std::string& new_name)
{
lldebugs << "LLWearableList::createCopy()" << llendl;
- LLWearable *wearable = generateNewWearable();
+ LLViewerWearable *wearable = generateNewWearable();
wearable->copyDataFrom(old_wearable);
LLPermissions perm(old_wearable->getPermissions());
@@ -222,11 +222,11 @@ LLWearable* LLWearableList::createCopy(const LLWearable* old_wearable, const std
return wearable;
}
-LLWearable* LLWearableList::createNewWearable( LLWearableType::EType type )
+LLViewerWearable* LLWearableList::createNewWearable( LLWearableType::EType type )
{
lldebugs << "LLWearableList::createNewWearable()" << llendl;
- LLWearable *wearable = generateNewWearable();
+ LLViewerWearable *wearable = generateNewWearable();
wearable->setType( type );
std::string name = LLTrans::getString( LLWearableType::getTypeDefaultNewName(wearable->getType()) );
@@ -251,13 +251,13 @@ LLWearable* LLWearableList::createNewWearable( LLWearableType::EType type )
return wearable;
}
-LLWearable *LLWearableList::generateNewWearable()
+LLViewerWearable *LLWearableList::generateNewWearable()
{
LLTransactionID tid;
tid.generate();
LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
- LLWearable* wearable = new LLWearable(tid);
+ LLViewerWearable* wearable = new LLViewerWearable(tid);
mList[new_asset_id] = wearable;
return wearable;
}
diff --git a/indra/newview/llwearablelist.h b/indra/newview/llwearablelist.h
index 12d0037aee..0f3078facf 100644
--- a/indra/newview/llwearablelist.h
+++ b/indra/newview/llwearablelist.h
@@ -28,7 +28,7 @@
#define LL_LLWEARABLELIST_H
#include "llmemory.h"
-#include "llwearable.h"
+#include "llviewerwearable.h"
#include "lluuid.h"
#include "llassetstorage.h"
@@ -51,19 +51,19 @@ public:
void getAsset(const LLAssetID& assetID,
const std::string& wearable_name,
LLAssetType::EType asset_type,
- void(*asset_arrived_callback)(LLWearable*, void* userdata),
+ void(*asset_arrived_callback)(LLViewerWearable*, void* userdata),
void* userdata);
- LLWearable* createCopy(const LLWearable* old_wearable, const std::string& new_name = std::string());
- LLWearable* createNewWearable(LLWearableType::EType type);
+ LLViewerWearable* createCopy(const LLViewerWearable* old_wearable, const std::string& new_name = std::string());
+ LLViewerWearable* createNewWearable(LLWearableType::EType type);
// Callback
static void processGetAssetReply(const char* filename, const LLAssetID& assetID, void* user_data, S32 status, LLExtStat ext_status);
protected:
- LLWearable* generateNewWearable(); // used for the create... functions
+ LLViewerWearable* generateNewWearable(); // used for the create... functions
private:
- std::map<LLUUID, LLWearable*> mList;
+ std::map<LLUUID, LLViewerWearable*> mList;
};
#endif // LL_LLWEARABLELIST_H