Extracted texture baking system into llappearance library.

master
Don Kjer 2012-09-03 06:12:50 +00:00
parent 51fabc3850
commit c355fb98d3
66 changed files with 3037 additions and 2377 deletions

View File

@ -28,34 +28,48 @@ include(LLLogin)
include_directories(
${LLCOMMON_INCLUDE_DIRS}
${VIEWER_INCLUDE_DIRS}
${LLAUDIO_INCLUDE_DIRS}
${LLCHARACTER_INCLUDE_DIRS}
${LLCOMMON_INCLUDE_DIRS}
${LLPHYSICS_INCLUDE_DIRS}
${LLIMAGE_INCLUDE_DIRS}
${LLKDU_INCLUDE_DIRS}
${LLINVENTORY_INCLUDE_DIRS}
${LLMATH_INCLUDE_DIRS}
${LLMESSAGE_INCLUDE_DIRS}
${LLPHYSICSEXTENSIONS_INCLUDE_DIRS}
${LLPLUGIN_INCLUDE_DIRS}
${LLPRIMITIVE_INCLUDE_DIRS}
${LLRENDER_INCLUDE_DIRS}
${LLUI_INCLUDE_DIRS}
${LLVFS_INCLUDE_DIRS}
${LLWINDOW_INCLUDE_DIRS}
${LLXML_INCLUDE_DIRS}
${LLLOGIN_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
llvoavatardefines.cpp
)
set(llappearance_HEADER_FILES
llwearable.h
CMakeLists.txt
llavatarappearance.h
llinventoryicon.cpp
lljointpickname.h
lllocaltextureobject.h
lltexglobalcolor.h
lltexlayer.h
lltexlayerparams.h
lltexturemanagerbridge.h
llwearable.h
llwearabletype.h
llviewervisualparam.h
llvoavatardefines.h
)
set_source_files_properties(${llappearance_HEADER_FILES}

View File

@ -0,0 +1,174 @@
/**
* @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)
{
mDebugExistenceTimer.reset();
}
using namespace LLVOAvatarDefines;
//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
}
}

View File

@ -0,0 +1,128 @@
/**
* @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 "llvoavatardefines.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(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;
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, LLVOAvatarDefines::EBakedTextureIndex index = LLVOAvatarDefines::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;
//--------------------------------------------------------------------
// Avatar Rez Metrics
//--------------------------------------------------------------------
public:
F32 debugGetExistenceTimeElapsedF32() const { return mDebugExistenceTimer.getElapsedTimeF32(); }
protected:
LLFrameTimer mDebugExistenceTimer; // Debugging for how long the avatar has been in memory.
public:
static LLColor4 getDummyColor();
virtual void updateMeshTextures() = 0;
};
#endif // LL_AVATAR_APPEARANCE_H

View File

@ -24,7 +24,8 @@
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
//#include "llviewerprecompiledheaders.h"
#include "linden_common.h"
#include "llinventoryicon.h"
#include "lldictionary.h"

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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);
}
//-----------------------------------------------------------------------------

View File

@ -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;

View File

@ -28,19 +28,18 @@
#define LL_LLTEXLAYER_H
#include <deque>
#include "lldynamictexture.h"
#include "lltexture.h"
#include "llframetimer.h"
#include "llvoavatardefines.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,42 +189,27 @@ 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);
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; }
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;
@ -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;
@ -254,85 +241,6 @@ private:
layer_info_list_t mLayerInfoList;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// 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

View File

@ -24,14 +24,16 @@
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "linden_common.h"
#include "lltexlayerparams.h"
#include "llagentcamera.h"
#include "llavatarappearance.h"
//#include "llagentcamera.h"
#include "llimagetga.h"
#include "llquantize.h"
#include "lltexlayer.h"
#include "llvoavatarself.h"
#include "lltexturemanagerbridge.h"
#include "llwearable.h"
#include "llui.h"
@ -40,11 +42,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 +54,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 +98,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 +122,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 +175,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 +220,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 +232,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 +250,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 +297,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 +335,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 +405,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 +428,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 +473,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);
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -27,7 +27,8 @@
//-----------------------------------------------------------------------------
// Header Files
//-----------------------------------------------------------------------------
#include "llviewerprecompiledheaders.h"
//#include "llviewerprecompiledheaders.h"
#include "linden_common.h"
#include "llviewervisualparam.h"
#include "llxmltree.h"

View File

@ -1,6 +1,6 @@
/**
* @file llvoavatar.cpp
* @brief Implementation of LLVOAvatar class which is a derivation fo LLViewerObject
* @file llvoavatardefines.cpp
* @brief Implementation of LLVOAvatarDefines::LLVOAvatarDictionary
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
@ -24,9 +24,11 @@
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
//#include "llviewerprecompiledheaders.h"
#include "linden_common.h"
#include "llvoavatardefines.h"
#include "llviewercontrol.h" // gSavedSettings
//#include "llviewercontrol.h" // gSavedSettings
const S32 LLVOAvatarDefines::SCRATCH_TEX_WIDTH = 512;
const S32 LLVOAvatarDefines::SCRATCH_TEX_HEIGHT = 512;
@ -113,14 +115,14 @@ LLVOAvatarDictionary::BakedTextures::BakedTextures()
LLVOAvatarDictionary::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));
}
/*
@ -178,7 +180,7 @@ LLVOAvatarDictionary::TextureEntry::TextureEntry(const std::string &name,
LLVOAvatarDictionary::MeshEntry::MeshEntry(EBakedTextureIndex baked_index,
const std::string &name,
U8 level,
LLViewerJoint::PickName pick) :
LLJointPickName pick) :
LLDictionaryEntry(name),
mBakedID(baked_index),
mLOD(level),
@ -239,21 +241,6 @@ 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 )
{

View File

@ -1,6 +1,6 @@
/**
* @file llvoavatar.h
* @brief Declaration of LLVOAvatar class which is a derivation fo
* @file llvoavatardefines.h
* @brief Various LLAvatarAppearance related definitions
* LLViewerObject
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
@ -29,8 +29,8 @@
#define LLVOAVATAR_DEFINES_H
#include <vector>
#include "lljointpickname.h"
#include "llwearable.h"
#include "llviewerjoint.h"
#include "lldictionary.h"
namespace LLVOAvatarDefines
@ -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,8 +216,6 @@ 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);

File diff suppressed because it is too large Load Diff

View File

@ -27,31 +27,25 @@
#ifndef LL_LLWEARABLE_H
#define LL_LLWEARABLE_H
#include "llextendedstatus.h"
//#include "lluuid.h"
//#include "llstring.h"
//#include "llpermissions.h"
//#include "llsaleinfo.h"
#include "llpermissions.h"
#include "llsaleinfo.h"
//#include "llassetstorage.h"
//#include "llwearabletype.h"
#include "llwearabletype.h"
//#include "llfile.h"
//#include "lllocaltextureobject.h"
#include "lllocaltextureobject.h"
class LLViewerInventoryItem;
class LLVisualParam;
class LLTexGlobalColorInfo;
class LLTexGlobalColor;
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 +53,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 +72,22 @@ public:
public:
typedef std::vector<LLVisualParam*> visual_param_vec_t;
BOOL isDirty() const;
BOOL isOldVersion() const;
enum EImportResult
{
FAILURE = 0,
SUCCESS,
BAD_HEADER
};
virtual BOOL exportFile(LLFILE* file) const;
virtual EImportResult importFile(LLFILE* file);
void writeToAvatar();
void removeFromAvatar( BOOL upload_bake ) { LLWearable::removeFromAvatar( mType, upload_bake ); }
static void removeFromAvatar( LLWearableType::EType type, BOOL upload_bake );
virtual LLLocalTextureObject* getLocalTextureObject(S32 index) = 0;
virtual void writeToAvatar() = 0;
BOOL exportFile(LLFILE* file) const;
BOOL importFile(LLFILE* file);
void setParamsToDefaults();
void setTexturesToDefaults();
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);
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 +97,11 @@ public:
LLColor4 getClothesColor(S32 te) const;
void setClothesColor( S32 te, const LLColor4& new_color, BOOL upload_bake );
void revertValues();
void saveValues();
void pullCrossWearableValues();
typedef std::map<S32, LLUUID> texture_id_map_t;
const texture_id_map_t& getTextureIDMap() const { return mTextureIDMap; }
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();
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 +109,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

View File

@ -24,9 +24,12 @@
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
//#include "llviewerprecompiledheaders.h"
#include "linden_common.h"
#include "llwearabletype.h"
#include "llinventoryfunctions.h"
//#include "llinventoryfunctions.h"
#include "llinventoryicon.h"
#include "lltrans.h"
struct WearableEntry : public LLDictionaryEntry

View File

@ -15,6 +15,7 @@ include_directories(
${LLMESSAGE_INCLUDE_DIRS}
${LLVFS_INCLUDE_DIRS}
${LLXML_INCLUDE_DIRS}
${LLAPPEARANCE_INCLUDE_DIRS}
)
set(llcharacter_SOURCE_FILES

View File

@ -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

View File

@ -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.

View File

@ -302,7 +302,6 @@ set(viewer_SOURCE_FILES
llinventorybridge.cpp
llinventoryfilter.cpp
llinventoryfunctions.cpp
llinventoryicon.cpp
llinventoryitemslist.cpp
llinventorylistitem.cpp
llinventorymodel.cpp
@ -316,7 +315,6 @@ set(viewer_SOURCE_FILES
lllistcontextmenu.cpp
lllistview.cpp
lllocalbitmaps.cpp
lllocaltextureobject.cpp
lllocationhistory.cpp
lllocationinputctrl.cpp
lllogchat.cpp
@ -495,9 +493,6 @@ set(viewer_SOURCE_FILES
llsyswellwindow.cpp
llteleporthistory.cpp
llteleporthistorystorage.cpp
lltexglobalcolor.cpp
lltexlayer.cpp
lltexlayerparams.cpp
lltextureatlas.cpp
lltextureatlasmanager.cpp
lltexturecache.cpp
@ -595,18 +590,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
@ -629,7 +624,6 @@ set(viewer_SOURCE_FILES
llwaterparamset.cpp
llwearableitemslist.cpp
llwearablelist.cpp
llwearabletype.cpp
llweb.cpp
llwebprofile.cpp
llwebsharing.cpp
@ -877,7 +871,6 @@ set(viewer_HEADER_FILES
llinventorybridge.h
llinventoryfilter.h
llinventoryfunctions.h
llinventoryicon.h
llinventoryitemslist.h
llinventorylistitem.h
llinventorymodel.h
@ -892,7 +885,6 @@ set(viewer_HEADER_FILES
lllistcontextmenu.h
lllistview.h
lllocalbitmaps.h
lllocaltextureobject.h
lllocationhistory.h
lllocationinputctrl.h
lllogchat.h
@ -1062,9 +1054,6 @@ set(viewer_HEADER_FILES
lltable.h
llteleporthistory.h
llteleporthistorystorage.h
lltexglobalcolor.h
lltexlayer.h
lltexlayerparams.h
lltextureatlas.h
lltextureatlasmanager.h
lltexturecache.h
@ -1163,18 +1152,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,7 +1186,6 @@ set(viewer_HEADER_FILES
llwaterparamset.h
llwearableitemslist.h
llwearablelist.h
llwearabletype.h
llweb.h
llwebprofile.h
llwebsharing.h
@ -1834,6 +1822,7 @@ target_link_libraries(${VIEWER_BINARY_NAME}
${LLPHYSICS_LIBRARIES}
${LLPHYSICSEXTENSIONS_LIBRARIES}
${TCMALLOC_LIBRARIES}
${LLAPPEARANCE_LIBRARIES}
)
if (USE_KDU)

View File

@ -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>
@ -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)
{
@ -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);
@ -1095,7 +1095,7 @@ void LLAgentWearables::recoverMissingWearableDone()
void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearable_type, const LLVOAvatarDefines::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)
{
@ -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();
@ -1902,11 +1902,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;
@ -1928,7 +1928,7 @@ void LLAgentWearables::updateWearablesLoaded()
}
}
bool LLAgentWearables::canWearableBeRemoved(const LLWearable* wearable) const
bool LLAgentWearables::canWearableBeRemoved(const LLViewerWearable* wearable) const
{
if (!wearable) return false;
@ -1943,7 +1943,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)
{
@ -1972,7 +1972,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;
@ -1991,7 +1991,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;
@ -2024,7 +2024,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;

View File

@ -40,10 +40,9 @@
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;
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();
@ -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
@ -245,7 +244,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;
@ -289,13 +288,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;
};

View File

@ -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);
@ -1588,7 +1588,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++ )
@ -1597,7 +1597,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);

View File

@ -35,7 +35,6 @@
#include "llinventoryobserver.h"
#include "llviewerinventory.h"
class LLWearable;
class LLWearableHoldingPattern;
class LLInventoryCallback;
class LLOutfitUnLockTimer;

View File

@ -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

View File

@ -37,6 +37,8 @@
#include "lluictrlfactory.h"
#include "llagentdata.h"
#include "llimfloater.h"
#include "llviewertexture.h"
#include "llvoavatardefines.h"
// library includes
#include "llavatarnamecache.h"

View File

@ -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 );

View File

@ -38,6 +38,7 @@
#include "message.h"
#include "llagent.h"
#include "llassetstorage.h"
#include "llcombobox.h"
#include "llestateinfomodel.h"
#include "llmimetypes.h"

View File

@ -32,6 +32,7 @@
#include "llagent.h"
#include "llagentwearables.h"
#include "llviewerwearable.h"
#include "lltexturectrl.h"
#include "lluictrlfactory.h"
#include "llviewerobjectlist.h"
@ -81,7 +82,7 @@ static void update_texture_ctrl(LLVOAvatar* avatarp,
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);
@ -173,7 +174,7 @@ void LLFloaterAvatarTextures::onClickDump(void* data)
LLWearableType::EType wearable_type = LLVOAvatarDictionary::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);

View File

@ -29,6 +29,7 @@
#include "llgroupiconctrl.h"
#include "llagent.h"
#include "llviewertexture.h"
/*
#include "llavatarconstants.h"
#include "llcallingcard.h" // for LLAvatarTracker

View File

@ -5692,7 +5692,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)
@ -5718,7 +5718,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)
@ -5799,7 +5799,7 @@ void LLWearableBridge::onRemoveFromAvatar(void* user_data)
}
// static
void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
void LLWearableBridge::onRemoveFromAvatarArrived(LLViewerWearable* wearable,
void* userdata)
{
OnRemoveStruct *on_remove_struct = (OnRemoveStruct*) userdata;

View File

@ -33,7 +33,7 @@
#include "llinventorymodel.h"
#include "llinventoryobserver.h"
#include "llviewercontrol.h"
#include "llwearable.h"
#include "llviewerwearable.h"
class LLInventoryFilter;
class LLInventoryPanel;
@ -486,10 +486,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
@ -498,7 +498,7 @@ public:
static BOOL canRemoveFromAvatar( void* userdata );
static void onRemoveFromAvatar( void* userdata );
static void onRemoveFromAvatarArrived( LLWearable* wearable, void* userdata );
static void onRemoveFromAvatarArrived( LLViewerWearable* wearable, void* userdata );
static void removeItemFromAvatar(LLViewerInventoryItem *item);
static void removeAllClothesFromAvatar();
void removeFromAvatar();

View File

@ -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();

View File

@ -33,6 +33,7 @@
#include "llvoavatardefines.h"
class LLScrollListCtrl;
class LLViewerObject;
class LLLocalBitmap
{

View File

@ -55,6 +55,7 @@
#include "lltrans.h"
#include "llscrollcontainer.h"
#include "llstatusbar.h"
#include "llviewertexture.h"
const S32 MINIMUM_PRICE_FOR_LISTING = 50; // L$

View File

@ -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"
@ -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.
{

View File

@ -35,7 +35,7 @@
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);
@ -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

View File

@ -35,6 +35,7 @@
#include "message.h"
#include "llagent.h"
#include "llassetstorage.h"
#include "llassetuploadresponders.h"
///////////////////////////////////////////////////////////////////////////////

View File

@ -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());

View File

@ -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;

View File

@ -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"
@ -423,7 +423,7 @@ void LLAvatarTexBar::draw()
++baked_iter)
{
const LLVOAvatarDefines::EBakedTextureIndex baked_index = baked_iter->first;
const LLTexLayerSet *layerset = avatarp->debugGetLayerSet(baked_index);
const LLViewerTexLayerSet *layerset = avatarp->debugGetLayerSet(baked_index);
if (!layerset) continue;
const LLTexLayerSetBuffer *layerset_buffer = layerset->getComposite();
if (!layerset_buffer) continue;

View File

@ -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;
};

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -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"

View File

@ -0,0 +1,791 @@
/**
* @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 "llagent.h"
#include "llassetuploadresponders.h"
#include "llavatarappearance.h"
#include "llglslshader.h"
#include "llimagej2c.h"
#include "llnotificationsutil.h"
#include "llviewercontrol.h"
#include "llviewerregion.h"
#include "llviewertexlayer.h"
#include "llvfile.h"
#include "llvfs.h"
#include "llvoavatarself.h"
#include "pipeline.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();
LLViewerTexLayerSet::LLViewerTexLayerSet(LLAvatarAppearance* const appearance) :
LLTexLayerSet(appearance),
mComposite( NULL ),
mUpdatesEnabled( FALSE )
{
}
// virtual
LLViewerTexLayerSet::~LLViewerTexLayerSet()
{
}
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);
}
LLTexLayerSetBuffer* LLViewerTexLayerSet::getComposite()
{
if (!mComposite)
{
createComposite();
}
return mComposite;
}
const LLTexLayerSetBuffer* LLViewerTexLayerSet::getComposite() const
{
return mComposite;
}
// 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::updateComposite()
{
createComposite();
mComposite->requestUpdateImmediate();
}
// 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;
LLVOAvatarSelf* self = dynamic_cast<LLVOAvatarSelf *>(mAvatarAppearance);
return self->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;
LLVOAvatarSelf* self = dynamic_cast<LLVOAvatarSelf *>(mAvatarAppearance);
return self->isLocalTextureDataFinal(this);
}
void LLViewerTexLayerSet::destroyComposite()
{
if( mComposite )
{
mComposite = NULL;
}
}
void LLViewerTexLayerSet::setUpdatesEnabled( BOOL b )
{
mUpdatesEnabled = b;
}
LLVOAvatarSelf* LLViewerTexLayerSet::getAvatar() const
{
return dynamic_cast<LLVOAvatarSelf*> (mAvatarAppearance);
}
//-----------------------------------------------------------------------------
// 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) == 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 switch to using this layerset if this is the first update
// after getting the lowest LOD
mTexLayerSet->getAvatarAppearance()->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->getAvatarAppearance()->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;
}

View File

@ -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 LLTexLayerSetBuffer;
class LLVOAvatarSelf;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// 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

View File

@ -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;

View File

@ -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

View File

@ -0,0 +1,900 @@
/**
* @file llviewerwearable.cpp
* @brief LLViewerWearable class implementation
*
* $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 "llagent.h"
#include "llagentcamera.h"
#include "llagentwearables.h"
#include "llfloatersidepanelcontainer.h"
#include "llnotificationsutil.h"
#include "llsidepanelappearance.h"
#include "lltextureentry.h"
#include "llviewercontrol.h"
#include "llviewertexlayer.h"
#include "llviewerwearable.h"
#include "llvoavatarself.h"
#include "llvoavatardefines.h"
using namespace LLVOAvatarDefines;
// support class - remove for 2.1 (hackity hack hack)
class LLOverrideBakedTextureUpdate
{
public:
LLOverrideBakedTextureUpdate(bool temp_state)
{
U32 num_bakes = (U32) LLVOAvatarDefines::BAKED_NUM_INDICES;
for( U32 index = 0; index < num_bakes; ++index )
{
composite_enabled[index] = gAgentAvatarp->isCompositeUpdateEnabled(index);
}
gAgentAvatarp->setCompositeUpdatesEnabled(temp_state);
}
~LLOverrideBakedTextureUpdate()
{
U32 num_bakes = (U32)LLVOAvatarDefines::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];
};
// Private local functions
static std::string asset_id_to_filename(const LLUUID &asset_id);
LLViewerWearable::LLViewerWearable(const LLTransactionID& transaction_id) :
LLWearable()
{
mTransactionID = transaction_id;
mAssetID = mTransactionID.makeAssetID(gAgent.getSecureSessionID());
}
LLViewerWearable::LLViewerWearable(const LLAssetID& asset_id) :
LLWearable()
{
mAssetID = asset_id;
mTransactionID.setNull();
}
// virtual
LLViewerWearable::~LLViewerWearable()
{
}
void LLViewerWearable::setItemID(const LLUUID& item_id)
{
mItemID = item_id;
}
// virtual
BOOL LLViewerWearable::exportFile(LLFILE* file) const
{
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();
mTextureIDMap[te] = image_id;
}
return LLWearable::exportFile(file);
}
// virtual
LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file )
{
// 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);
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 result;
}
LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN );
LLStringUtil::truncate(mDescription, DB_INV_ITEM_DESC_STR_LEN );
texture_id_map_t::const_iterator iter = mTextureIDMap.begin();
texture_id_map_t::const_iterator end = mTextureIDMap.end();
for (; iter != end; ++iter)
{
S32 te = iter->first;
const LLUUID& textureid = iter->second;
if( mTEMap.find(te) != mTEMap.end() )
{
delete mTEMap[te];
}
if( mSavedTEMap.find(te) != mSavedTEMap.end() )
{
delete mSavedTEMap[te];
}
LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( textureid );
if(gSavedSettings.getBOOL("DebugAvatarLocalTexLoadedTime"))
{
image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(textureid, (LLVOAvatarDefines::ETextureIndex)te), NULL);
}
mTEMap[te] = new LLLocalTextureObject(image, textureid);
mSavedTEMap[te] = new LLLocalTextureObject(image, textureid);
createLayers(te);
}
// copy all saved param values to working params
revertValues();
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 LLViewerWearable::isOldVersion() const
{
if (!isAgentAvatarValid()) return FALSE;
if( LLWearable::sCurrentDefinitionVersion < mDefinitionVersion )
{
llwarns << "Wearable asset has newer version (" << mDefinitionVersion << ") than XML (" << LLWearable::sCurrentDefinitionVersion << ")" << llendl;
llassert(0);
}
if( LLWearable::sCurrentDefinitionVersion != mDefinitionVersion )
{
return TRUE;
}
S32 param_count = 0;
for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam();
param;
param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() )
{
if( (param->getWearableType() == mType) && (param->isTweakable() ) )
{
param_count++;
if( !is_in_map(mVisualParamIndexMap, param->getID() ) )
{
return TRUE;
}
}
}
if( param_count != mVisualParamIndexMap.size() )
{
return TRUE;
}
S32 te_count = 0;
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
{
if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType)
{
te_count++;
if( !is_in_map(mTEMap, te ) )
{
return TRUE;
}
}
}
if( te_count != mTEMap.size() )
{
return TRUE;
}
return FALSE;
}
// Avatar parameter and texture definitions can change over time.
// * If parameters or textures have been REMOVED since the wearable was created,
// they're just ignored, so we consider the wearable clean even though isOldVersion()
// will return true.
// * 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 LLViewerWearable::isDirty() const
{
if (!isAgentAvatarValid()) return FALSE;
for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam();
param;
param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() )
{
if( (param->getWearableType() == mType)
&& (param->isTweakable() )
&& !param->getCrossWearable())
{
F32 current_weight = getVisualParamWeight(param->getID());
current_weight = llclamp( current_weight, param->getMinWeight(), param->getMaxWeight() );
F32 saved_weight = get_if_there(mSavedVisualParamMap, param->getID(), param->getDefaultWeight());
saved_weight = llclamp( saved_weight, param->getMinWeight(), param->getMaxWeight() );
U8 a = F32_to_U8( saved_weight, param->getMinWeight(), param->getMaxWeight() );
U8 b = F32_to_U8( current_weight, param->getMinWeight(), param->getMaxWeight() );
if( a != b )
{
return TRUE;
}
}
}
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
{
if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType)
{
te_map_t::const_iterator current_iter = mTEMap.find(te);
if(current_iter != mTEMap.end())
{
const LLUUID& current_image_id = current_iter->second->getID();
te_map_t::const_iterator saved_iter = mSavedTEMap.find(te);
if(saved_iter != mSavedTEMap.end())
{
const LLUUID& saved_image_id = saved_iter->second->getID();
if (saved_image_id != current_image_id)
{
// saved vs current images are different, wearable is dirty
return TRUE;
}
}
else
{
// image found in current image list but not saved image list
return TRUE;
}
}
}
}
return FALSE;
}
void LLViewerWearable::setParamsToDefaults()
{
if (!isAgentAvatarValid()) return;
for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() )
{
if( (((LLViewerVisualParam*)param)->getWearableType() == mType ) && (param->isTweakable() ) )
{
setVisualParamWeight(param->getID(),param->getDefaultWeight(), FALSE);
}
}
}
void LLViewerWearable::setTexturesToDefaults()
{
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
{
if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType)
{
LLUUID id = getDefaultTextureImageID((ETextureIndex) te);
LLViewerFetchedTexture * image = LLViewerTextureManager::getFetchedTexture( id );
if( mTEMap.find(te) == mTEMap.end() )
{
mTEMap[te] = new LLLocalTextureObject(image, id);
createLayers(te);
}
else
{
// Local Texture Object already created, just set image and UUID
LLLocalTextureObject *lto = mTEMap[te];
lto->setID(id);
lto->setImage(image);
}
}
}
}
//static
const LLUUID LLViewerWearable::getDefaultTextureImageID(ETextureIndex index)
{
const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::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 LLViewerWearable::writeToAvatar()
{
if (!isAgentAvatarValid()) return;
ESex old_sex = gAgentAvatarp->getSex();
// Pull params
for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() )
{
// cross-wearable parameters are not authoritative, as they are driven by a different wearable. So don't copy the values to the
// avatar object if cross wearable. Cross wearable params get their values from the avatar, they shouldn't write the other way.
if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (!((LLViewerVisualParam*)param)->getCrossWearable()) )
{
S32 param_id = param->getID();
F32 weight = getVisualParamWeight(param_id);
gAgentAvatarp->setVisualParamWeight( param_id, weight, FALSE );
}
}
// Pull texture entries
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
{
if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType)
{
te_map_t::const_iterator iter = mTEMap.find(te);
LLUUID image_id;
if(iter != mTEMap.end())
{
image_id = iter->second->getID();
}
else
{
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.
gAgentAvatarp->setLocalTextureTE(te, image, 0);
}
}
ESex new_sex = gAgentAvatarp->getSex();
if( old_sex != new_sex )
{
gAgentAvatarp->updateSexDependentLayerSets( FALSE );
}
// if( upload_bake )
// {
// gAgent.sendAgentSetAppearance();
// }
}
// Updates the user's avatar's appearance, replacing this wearables' parameters and textures with default values.
// static
void LLViewerWearable::removeFromAvatar( LLWearableType::EType type, BOOL upload_bake )
{
if (!isAgentAvatarValid()) return;
// You can't just remove body parts.
if( (type == LLWearableType::WT_SHAPE) ||
(type == LLWearableType::WT_SKIN) ||
(type == LLWearableType::WT_HAIR) ||
(type == LLWearableType::WT_EYES) )
{
return;
}
// Pull params
for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() )
{
if( (((LLViewerVisualParam*)param)->getWearableType() == type) && (param->isTweakable() ) )
{
S32 param_id = param->getID();
gAgentAvatarp->setVisualParamWeight( param_id, param->getDefaultWeight(), upload_bake );
}
}
if(gAgentCamera.cameraCustomizeAvatar())
{
LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit"));
}
gAgentAvatarp->updateVisualParams();
gAgentAvatarp->wearableUpdated(type, FALSE);
// if( upload_bake )
// {
// gAgent.sendAgentSetAppearance();
// }
}
// Does not copy mAssetID.
// Definition version is current: removes obsolete enties and creates default values for new ones.
void LLViewerWearable::copyDataFrom(const LLViewerWearable* src)
{
if (!isAgentAvatarValid()) return;
mDefinitionVersion = LLWearable::sCurrentDefinitionVersion;
mName = src->mName;
mDescription = src->mDescription;
mPermissions = src->mPermissions;
mSaleInfo = src->mSaleInfo;
setType(src->mType);
mSavedVisualParamMap.clear();
// Deep copy of mVisualParamMap (copies only those params that are current, filling in defaults where needed)
for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam();
param;
param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() )
{
if( (param->getWearableType() == mType) )
{
S32 id = param->getID();
F32 weight = src->getVisualParamWeight(id);
mSavedVisualParamMap[id] = weight;
}
}
destroyTextures();
// 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)
{
te_map_t::const_iterator iter = src->mTEMap.find(te);
LLUUID image_id;
LLViewerFetchedTexture *image = NULL;
if(iter != src->mTEMap.end())
{
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);
mTEMap[te]->setBakedReady(src->getLocalTextureObject(te)->getBakedReady());
mTEMap[te]->setDiscard(src->getLocalTextureObject(te)->getDiscard());
}
else
{
image_id = getDefaultTextureImageID((ETextureIndex) te);
image = LLViewerTextureManager::getFetchedTexture( image_id );
mTEMap[te] = new LLLocalTextureObject(image, image_id);
mSavedTEMap[te] = new LLLocalTextureObject(image, image_id);
}
createLayers(te);
}
}
// Probably reduntant, but ensure that the newly created wearable is not dirty by setting current value of params in new wearable
// to be the same as the saved values (which were loaded from src at param->cloneParam(this))
revertValues();
}
LLLocalTextureObject* LLViewerWearable::getLocalTextureObject(S32 index)
{
te_map_t::iterator iter = mTEMap.find(index);
if( iter != mTEMap.end() )
{
LLLocalTextureObject* lto = iter->second;
return lto;
}
return NULL;
}
const LLLocalTextureObject* LLViewerWearable::getLocalTextureObject(S32 index) const
{
te_map_t::const_iterator iter = mTEMap.find(index);
if( iter != mTEMap.end() )
{
const LLLocalTextureObject* lto = iter->second;
return lto;
}
return NULL;
}
std::vector<LLLocalTextureObject*> LLViewerWearable::getLocalTextureListSeq()
{
std::vector<LLLocalTextureObject*> result;
for(te_map_t::const_iterator iter = mTEMap.begin();
iter != mTEMap.end(); iter++)
{
LLLocalTextureObject* lto = iter->second;
result.push_back(lto);
}
return result;
}
void LLViewerWearable::setLocalTextureObject(S32 index, LLLocalTextureObject &lto)
{
if( mTEMap.find(index) != mTEMap.end() )
{
mTEMap.erase(index);
}
mTEMap[index] = new LLLocalTextureObject(lto);
}
void LLViewerWearable::revertValues()
{
//update saved settings so wearable is no longer dirty
// non-driver params first
for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++)
{
S32 id = iter->first;
F32 value = iter->second;
LLVisualParam *param = getVisualParam(id);
if(param && !dynamic_cast<LLDriverParam*>(param) )
{
setVisualParamWeight(id, value, TRUE);
}
}
//then driver params
for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++)
{
S32 id = iter->first;
F32 value = iter->second;
LLVisualParam *param = getVisualParam(id);
if(param && dynamic_cast<LLDriverParam*>(param) )
{
setVisualParamWeight(id, value, TRUE);
}
}
// make sure that saved values are sane
for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++)
{
S32 id = iter->first;
LLVisualParam *param = getVisualParam(id);
if( param )
{
mSavedVisualParamMap[id] = param->getWeight();
}
}
syncImages(mSavedTEMap, mTEMap);
LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(LLFloaterSidePanelContainer::getPanel("appearance"));
if( panel )
{
panel->updateScrollingPanelList();
}
}
BOOL LLViewerWearable::isOnTop() const
{
return (this == gAgentWearables.getTopWearable(mType));
}
void LLViewerWearable::saveValues()
{
//update saved settings so wearable is no longer dirty
mSavedVisualParamMap.clear();
for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); ++iter)
{
S32 id = iter->first;
LLVisualParam *wearable_param = iter->second;
F32 value = wearable_param->getWeight();
mSavedVisualParamMap[id] = value;
}
// Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed)
syncImages(mTEMap, mSavedTEMap);
LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(LLFloaterSidePanelContainer::getPanel("appearance"));
if( panel )
{
panel->updateScrollingPanelList();
}
}
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)
{
te_map_t::const_iterator iter = src.find(te);
LLUUID image_id;
LLViewerFetchedTexture *image = NULL;
LLLocalTextureObject *lto = NULL;
if(iter != src.end())
{
// 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 = 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 = getDefaultTextureImageID((ETextureIndex) te);
image = LLViewerTextureManager::getFetchedTexture( image_id );
}
if( dst.find(te) != dst.end() )
{
// there's already an entry in the destination map for the texture. Just update its values.
dst[te]->setImage(image);
dst[te]->setID(image_id);
}
else
{
// no entry found in the destination map, we need to create a new Local Texture Object
dst[te] = new LLLocalTextureObject(image, image_id);
}
if( lto )
{
// If we pulled values from a Local Texture Object in the source map, make sure the proper flags are set in the new (or updated) entry in the destination map.
dst[te]->setBakedReady(lto->getBakedReady());
dst[te]->setDiscard(lto->getDiscard());
}
}
}
}
void LLViewerWearable::destroyTextures()
{
for( te_map_t::iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter )
{
LLLocalTextureObject *lto = iter->second;
delete lto;
}
mTEMap.clear();
for( te_map_t::iterator iter = mSavedTEMap.begin(); iter != mSavedTEMap.end(); ++iter )
{
LLLocalTextureObject *lto = iter->second;
delete lto;
}
mSavedTEMap.clear();
}
void LLViewerWearable::pullCrossWearableValues()
{
// scan through all of the avatar's visual parameters
for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam();
param;
param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam())
{
if( param )
{
LLDriverParam *driver_param = dynamic_cast<LLDriverParam*>(param);
if(driver_param)
{
// parameter is a driver parameter, have it update its
driver_param->updateCrossDrivenParams(getType());
}
}
}
}
void LLViewerWearable::setLabelUpdated() const
{
gInventory.addChangedMask(LLInventoryObserver::LABEL, getItemID());
}
void LLViewerWearable::refreshName()
{
LLUUID item_id = getItemID();
LLInventoryItem* item = gInventory.getItem(item_id);
if( item )
{
mName = item->getName();
}
}
struct LLWearableSaveData
{
LLWearableType::EType mType;
};
void LLViewerWearable::saveNewAsset() const
{
// llinfos << "LLViewerWearable::saveNewAsset() type: " << getTypeName() << llendl;
//llinfos << *this << llendl;
const std::string filename = asset_id_to_filename(mAssetID);
LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */
BOOL successful_save = FALSE;
if(fp && exportFile(fp))
{
successful_save = TRUE;
}
if(fp)
{
fclose(fp);
fp = NULL;
}
if(!successful_save)
{
std::string buffer = llformat("Unable to save '%s' to wearable file.", mName.c_str());
llwarns << buffer << llendl;
LLSD args;
args["NAME"] = mName;
LLNotificationsUtil::add("CannotSaveWearableOutOfSpace", args);
return;
}
// save it out to database
if( gAssetStorage )
{
/*
std::string url = gAgent.getRegion()->getCapability("NewAgentInventory");
if (!url.empty())
{
llinfos << "Update Agent Inventory via capability" << llendl;
LLSD body;
body["folder_id"] = gInventory.findCategoryUUIDForType(LLFolderType::assetToFolderType(getAssetType()));
body["asset_type"] = LLAssetType::lookup(getAssetType());
body["inventory_type"] = LLInventoryType::lookup(LLInventoryType::IT_WEARABLE);
body["name"] = getName();
body["description"] = getDescription();
LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, filename));
}
else
{
}
*/
LLWearableSaveData* data = new LLWearableSaveData;
data->mType = mType;
gAssetStorage->storeAssetData(filename, mTransactionID, getAssetType(),
&LLViewerWearable::onSaveNewAssetComplete,
(void*)data);
}
}
// static
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);
if(0 == status)
{
// Success
llinfos << "Saved wearable " << type_name << llendl;
}
else
{
std::string buffer = llformat("Unable to save %s to central asset store.", type_name.c_str());
llwarns << buffer << " Status: " << status << llendl;
LLSD args;
args["NAME"] = type_name;
LLNotificationsUtil::add("CannotSaveToAssetStore", args);
}
// Delete temp file
const std::string src_filename = asset_id_to_filename(new_asset_id);
LLFile::remove(src_filename);
// delete the context data
delete data;
}
void LLViewerWearable::createLayers(S32 te)
{
LLViewerTexLayerSet *layer_set = gAgentAvatarp->getLayerSet((ETextureIndex)te);
if (layer_set)
{
layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this);
}
else
{
llerrs << "could not find layerset for LTO in wearable!" << llendl;
}
}
void LLViewerWearable::createVisualParams()
{
for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam();
param;
param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam())
{
if (param->getWearableType() == mType)
{
addVisualParam(param->cloneParam(this));
}
}
// resync driver parameters to point to the newly cloned driven parameters
for (visual_param_index_map_t::iterator param_iter = mVisualParamIndexMap.begin();
param_iter != mVisualParamIndexMap.end();
++param_iter)
{
LLVisualParam* param = param_iter->second;
LLVisualParam*(LLWearable::*wearable_function)(S32)const = &LLWearable::getVisualParam;
// need this line to disambiguate between versions of LLCharacter::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(param_function,gAgentAvatarp.get(),_1 ), true))
{
llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl;
continue;
}
}
}
}
void LLViewerWearable::setVisualParams()
{
for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); iter++)
{
S32 id = iter->first;
LLVisualParam *wearable_param = iter->second;
F32 value = wearable_param->getWeight();
gAgentAvatarp->setVisualParamWeight(id, value, FALSE);
}
}
std::ostream& operator<<(std::ostream &s, const LLViewerWearable &w)
{
s << "wearable " << LLWearableType::getTypeName(w.mType) << "\n";
s << " Name: " << w.mName << "\n";
s << " Desc: " << w.mDescription << "\n";
//w.mPermissions
//w.mSaleInfo
s << " Params:" << "\n";
for (LLWearable::visual_param_index_map_t::const_iterator iter = w.mVisualParamIndexMap.begin();
iter != w.mVisualParamIndexMap.end(); ++iter)
{
S32 param_id = iter->first;
LLVisualParam *wearable_param = iter->second;
F32 param_weight = wearable_param->getWeight();
s << " " << param_id << " " << param_weight << "\n";
}
s << " Textures:" << "\n";
for (LLViewerWearable::te_map_t::const_iterator iter = w.mTEMap.begin();
iter != w.mTEMap.end(); ++iter)
{
S32 te = iter->first;
const LLUUID& image_id = iter->second->getID();
s << " " << te << " " << image_id << "\n";
}
return s;
}
std::string asset_id_to_filename(const LLUUID &asset_id)
{
std::string asset_id_string;
asset_id.toString(asset_id_string);
std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,asset_id_string) + ".wbl";
return filename;
}

View File

@ -0,0 +1,116 @@
/**
* @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 "llvoavatardefines.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:
/*virtual*/ BOOL exportFile(LLFILE* file) const;
/*virtual*/ EImportResult importFile(LLFILE* file);
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 );
void setParamsToDefaults();
void setTexturesToDefaults();
static const LLUUID getDefaultTextureImageID(LLVOAvatarDefines::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 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:
void createLayers(S32 te);
/*virtual*/void createVisualParams();
void setVisualParams();
typedef std::map<S32, LLLocalTextureObject*> te_map_t;
void syncImages(te_map_t &src, te_map_t &dst);
void destroyTextures();
LLTransactionID mTransactionID;
LLAssetID mAssetID;
LLUUID mItemID; // ID of the inventory item in the agent's inventory
te_map_t mTEMap; // maps TE to LocalTextureObject
te_map_t mSavedTEMap; // last saved version of TEMap
};
#endif // LL_VIEWER_WEARABLE_H

View File

@ -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"
@ -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,
@ -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),
@ -768,7 +764,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
mRuthTimer.reset();
mRuthDebugTimer.reset();
mDebugExistenceTimer.reset();
mPelvisOffset = LLVector3(0.0f,0.0f,0.0f);
mLastPelvisToFoot = 0.0f;
mPelvisFixup = 0.0f;
@ -1133,7 +1128,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 +1137,7 @@ void LLVOAvatar::deleteCachedImages(bool clearAll)
LLVOAvatar* inst = (LLVOAvatar*) *iter;
inst->deleteLayerSetCaches(clearAll);
}
LLTexLayerSet::sHasCaches = FALSE;
LLViewerTexLayerSet::sHasCaches = FALSE;
}
LLVOAvatarSelf::deleteScratchTextures();
LLTexLayerStaticImageList::getInstance()->deleteCachedImages();
@ -5864,6 +5859,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 +6472,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 +6482,7 @@ void LLVOAvatar::invalidateAll()
{
}
// virtual
void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake )
{
if (global_color == mTexSkinColor)
@ -6682,6 +6682,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;
@ -6903,7 +6904,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();
@ -6973,112 +6974,6 @@ 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;
@ -8787,7 +8682,7 @@ BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 ind
}
//virtual
BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const
BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLViewerWearable *wearable) const
{
// non-self avatars don't have wearables
return FALSE;

View File

@ -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"
@ -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
@ -460,7 +474,14 @@ private:
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);
virtual void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLVOAvatarDefines::EBakedTextureIndex index = LLVOAvatarDefines::BAKED_NUM_INDICES);
//--------------------------------------------------------------------
// Global colors
//--------------------------------------------------------------------
public:
virtual void onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake);
//--------------------------------------------------------------------
// Visibility
@ -563,7 +584,7 @@ public:
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 isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLViewerWearable *wearable) const;
BOOL isFullyBaked();
static BOOL areAllNearbyInstancesBaked(S32& grey_avatars);
@ -586,7 +607,7 @@ protected:
struct BakedTextureData
{
LLUUID mLastTextureIndex;
LLTexLayerSet* mTexLayerSet; // Only exists for self
LLViewerTexLayerSet* mTexLayerSet; // Only exists for self
bool mIsLoaded;
bool mIsUsed;
LLVOAvatarDefines::ETextureIndex mTextureIndex;
@ -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;
@ -719,25 +739,6 @@ private:
BOOL mUseLocalAppearance; // flag for if we're using a local composite
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
//--------------------------------------------------------------------
@ -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
** **
*******************************************************************************/
@ -1038,11 +1038,9 @@ private:
//--------------------------------------------------------------------
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.
/** Diagnostics
** **
@ -1163,4 +1161,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

View File

@ -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"
@ -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))
{
@ -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();
@ -1375,7 +1377,7 @@ 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;
}
@ -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,7 +1418,7 @@ 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; */
@ -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.
@ -1515,7 +1517,7 @@ BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const
BOOL LLVOAvatarSelf::isBakedTextureFinal(const LLVOAvatarDefines::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;
@ -1568,7 +1570,7 @@ BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32
}
//virtual
BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const
BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLViewerWearable *wearable) const
{
if (isIndexBakedTexture(type))
{
@ -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();
@ -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);
@ -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="";
@ -2283,7 +2286,7 @@ BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const
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);
@ -2358,7 +2361,7 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe
LLLocalTextureObject* LLVOAvatarSelf::getLocalTextureObject(LLVOAvatarDefines::ETextureIndex i, U32 wearable_index) const
{
LLWearableType::EType type = LLVOAvatarDictionary::getInstance()->getTEWearableType(i);
LLWearable* wearable = gAgentWearables.getWearable(type, wearable_index);
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++)
{
@ -2512,7 +2515,7 @@ void LLVOAvatarSelf::outputRezDiagnostics() const
++baked_iter)
{
const LLVOAvatarDefines::EBakedTextureIndex baked_index = baked_iter->first;
const LLTexLayerSet *layerset = debugGetLayerSet(baked_index);
const LLViewerTexLayerSet *layerset = debugGetLayerSet(baked_index);
if (!layerset) continue;
const LLTexLayerSetBuffer *layerset_buffer = layerset->getComposite();
if (!layerset_buffer) continue;
@ -2590,7 +2593,7 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**)
{
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)
@ -2664,7 +2667,7 @@ void LLVOAvatarSelf::requestLayerSetUpdate(ETextureIndex index )
}
}
LLTexLayerSet* LLVOAvatarSelf::getLayerSet(ETextureIndex index) const
LLViewerTexLayerSet* LLVOAvatarSelf::getLayerSet(ETextureIndex index) const
{
/* switch(index)
case TEX_HEAD_BAKED:
@ -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:

View File

@ -197,13 +197,13 @@ public:
/*virtual*/ bool hasPendingBakedUploads() const;
S32 getLocalDiscardLevel(LLVOAvatarDefines::ETextureIndex type, U32 index) const;
bool areTexturesCurrent() const;
BOOL isLocalTextureDataAvailable(const LLTexLayerSet* layerset) const;
BOOL isLocalTextureDataFinal(const LLTexLayerSet* layerset) const;
BOOL isLocalTextureDataAvailable(const LLViewerTexLayerSet* layerset) const;
BOOL isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset) const;
BOOL isBakedTextureFinal(const LLVOAvatarDefines::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 isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLViewerWearable *wearable) const;
//--------------------------------------------------------------------
@ -233,7 +233,7 @@ private:
// Baked textures
//--------------------------------------------------------------------
public:
LLVOAvatarDefines::ETextureIndex getBakedTE(const LLTexLayerSet* layerset ) const;
LLVOAvatarDefines::ETextureIndex getBakedTE(const LLViewerTexLayerSet* 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);
@ -249,14 +249,14 @@ 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;
LLViewerTexLayerSet* getLayerSet(LLVOAvatarDefines::ETextureIndex index) const;
LLViewerTexLayerSet* getLayerSet(LLVOAvatarDefines::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);
@ -388,8 +388,8 @@ public:
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(LLVOAvatarDefines::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.

View File

@ -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;
}

View File

@ -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