LLTexLayer refactored. Tried to keep behavior changes as minimal as possible. Consider as base slate for changes required for multi-wearables.
This commit is contained in:
@@ -386,7 +386,9 @@ set(viewer_SOURCE_FILES
|
||||
llstylemap.cpp
|
||||
llsurface.cpp
|
||||
llsurfacepatch.cpp
|
||||
lltexglobalcolor.cpp
|
||||
lltexlayer.cpp
|
||||
lltexlayerparams.cpp
|
||||
lltexturecache.cpp
|
||||
lltexturectrl.cpp
|
||||
lltexturefetch.cpp
|
||||
@@ -873,7 +875,9 @@ set(viewer_HEADER_FILES
|
||||
llsurface.h
|
||||
llsurfacepatch.h
|
||||
lltable.h
|
||||
lltexglobalcolor.h
|
||||
lltexlayer.h
|
||||
lltexlayerparams.h
|
||||
lltexturecache.h
|
||||
lltexturectrl.h
|
||||
lltexturefetch.h
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
virtual void uploadComplete(const LLSD& content);
|
||||
};
|
||||
|
||||
class LLBakedUploadData;
|
||||
struct LLBakedUploadData;
|
||||
class LLSendTexLayerResponder : public LLAssetUploadResponder
|
||||
{
|
||||
public:
|
||||
|
||||
145
indra/newview/lltexglobalcolor.cpp
Normal file
145
indra/newview/lltexglobalcolor.cpp
Normal file
@@ -0,0 +1,145 @@
|
||||
/**
|
||||
* @file lltexlayerglobalcolor.cpp
|
||||
* @brief Color for texture layers.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2008&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 "lltexlayer.h"
|
||||
#include "llvoavatar.h"
|
||||
#include "llwearable.h"
|
||||
#include "lltexglobalcolor.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTexGlobalColor
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
LLTexGlobalColor::LLTexGlobalColor(LLVOAvatar* avatar)
|
||||
:
|
||||
mAvatar(avatar),
|
||||
mInfo(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
LLTexGlobalColor::~LLTexGlobalColor()
|
||||
{
|
||||
// mParamColorList are LLViewerVisualParam's and get deleted with ~LLCharacter()
|
||||
//std::for_each(mParamColorList.begin(), mParamColorList.end(), DeletePointer());
|
||||
}
|
||||
|
||||
BOOL LLTexGlobalColor::setInfo(LLTexGlobalColorInfo *info)
|
||||
{
|
||||
llassert(mInfo == NULL);
|
||||
mInfo = info;
|
||||
//mID = info->mID; // No ID
|
||||
|
||||
mParamGlobalColorList.reserve(mInfo->mParamColorInfoList.size());
|
||||
for (param_color_info_list_t::iterator iter = mInfo->mParamColorInfoList.begin();
|
||||
iter != mInfo->mParamColorInfoList.end();
|
||||
iter++)
|
||||
{
|
||||
LLTexParamGlobalColor* param_color = new LLTexParamGlobalColor(this);
|
||||
if (!param_color->setInfo(*iter, TRUE))
|
||||
{
|
||||
mInfo = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
mParamGlobalColorList.push_back(param_color);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LLColor4 LLTexGlobalColor::getColor() const
|
||||
{
|
||||
// Sum of color params
|
||||
if (mParamGlobalColorList.empty())
|
||||
return LLColor4(1.f, 1.f, 1.f, 1.f);
|
||||
|
||||
LLColor4 net_color(0.f, 0.f, 0.f, 0.f);
|
||||
LLTexLayer::calculateTexLayerColor(mParamGlobalColorList, net_color);
|
||||
return net_color;
|
||||
}
|
||||
|
||||
const std::string& LLTexGlobalColor::getName() const
|
||||
{
|
||||
return mInfo->mName;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTexParamGlobalColor
|
||||
//-----------------------------------------------------------------------------
|
||||
LLTexParamGlobalColor::LLTexParamGlobalColor(LLTexGlobalColor* tex_global_color) :
|
||||
LLTexLayerParamColor(tex_global_color->getAvatar()),
|
||||
mTexGlobalColor(tex_global_color)
|
||||
{
|
||||
}
|
||||
|
||||
void LLTexParamGlobalColor::onGlobalColorChanged(bool upload_bake)
|
||||
{
|
||||
mAvatar->onGlobalColorChanged(mTexGlobalColor, upload_bake);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTexGlobalColorInfo
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
LLTexGlobalColorInfo::LLTexGlobalColorInfo()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
LLTexGlobalColorInfo::~LLTexGlobalColorInfo()
|
||||
{
|
||||
for_each(mParamColorInfoList.begin(), mParamColorInfoList.end(), DeletePointer());
|
||||
}
|
||||
|
||||
BOOL LLTexGlobalColorInfo::parseXml(LLXmlTreeNode* node)
|
||||
{
|
||||
// name attribute
|
||||
static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
|
||||
if (!node->getFastAttributeString(name_string, mName))
|
||||
{
|
||||
llwarns << "<global_color> element is missing name attribute." << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
// <param> sub-element
|
||||
for (LLXmlTreeNode* child = node->getChildByName("param");
|
||||
child;
|
||||
child = node->getNextNamedChild())
|
||||
{
|
||||
if (child->getChildByName("param_color"))
|
||||
{
|
||||
// <param><param_color/></param>
|
||||
LLTexLayerParamColorInfo* info = new LLTexLayerParamColorInfo();
|
||||
if (!info->parseXml(child))
|
||||
{
|
||||
delete info;
|
||||
return FALSE;
|
||||
}
|
||||
mParamColorInfoList.push_back(info);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
83
indra/newview/lltexglobalcolor.h
Normal file
83
indra/newview/lltexglobalcolor.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* @file lltexglobalcolor.h
|
||||
* @brief This is global texture color info used by llvoavatar.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2008&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_LLTEXGLOBALCOLOR_H
|
||||
#define LL_LLTEXGLOBALCOLOR_H
|
||||
|
||||
#include "lltexlayer.h"
|
||||
#include "lltexlayerparams.h"
|
||||
|
||||
class LLVOAvatar;
|
||||
class LLWearable;
|
||||
class LLTexGlobalColorInfo;
|
||||
|
||||
class LLTexGlobalColor
|
||||
{
|
||||
public:
|
||||
LLTexGlobalColor( LLVOAvatar* avatar );
|
||||
~LLTexGlobalColor();
|
||||
|
||||
LLTexGlobalColorInfo* getInfo() const { return mInfo; }
|
||||
// This sets mInfo and calls initialization functions
|
||||
BOOL setInfo(LLTexGlobalColorInfo *info);
|
||||
|
||||
LLVOAvatar* getAvatar() const { return mAvatar; }
|
||||
LLColor4 getColor() const;
|
||||
const std::string& getName() const;
|
||||
|
||||
private:
|
||||
param_color_list_t mParamGlobalColorList;
|
||||
LLVOAvatar* mAvatar; // just backlink, don't LLPointer
|
||||
LLTexGlobalColorInfo *mInfo;
|
||||
};
|
||||
|
||||
// Used by llvoavatar to determine skin/eye/hair color.
|
||||
class LLTexGlobalColorInfo
|
||||
{
|
||||
friend class LLTexGlobalColor;
|
||||
public:
|
||||
LLTexGlobalColorInfo();
|
||||
~LLTexGlobalColorInfo();
|
||||
|
||||
BOOL parseXml(LLXmlTreeNode* node);
|
||||
|
||||
private:
|
||||
param_color_info_list_t mParamColorInfoList;
|
||||
std::string mName;
|
||||
};
|
||||
|
||||
class LLTexParamGlobalColor : public LLTexLayerParamColor
|
||||
{
|
||||
public:
|
||||
LLTexParamGlobalColor(LLTexGlobalColor *tex_color);
|
||||
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
|
||||
protected:
|
||||
/*virtual*/ void onGlobalColorChanged(bool upload_bake);
|
||||
private:
|
||||
LLTexGlobalColor* mTexGlobalColor;
|
||||
};
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -34,524 +34,312 @@
|
||||
#define LL_LLTEXLAYER_H
|
||||
|
||||
#include <deque>
|
||||
#include "llassetstorage.h"
|
||||
#include "lldynamictexture.h"
|
||||
#include "llrect.h"
|
||||
#include "llstring.h"
|
||||
#include "lluuid.h"
|
||||
#include "llviewertexture.h"
|
||||
#include "llviewervisualparam.h"
|
||||
#include "llvoavatardefines.h"
|
||||
#include "llwearable.h"
|
||||
#include "v4color.h"
|
||||
#include "llfloater.h"
|
||||
#include "llvoavatar.h"
|
||||
#include "lltexlayerparams.h"
|
||||
|
||||
class LLTexLayerSetInfo;
|
||||
class LLTexLayerSet;
|
||||
class LLTexLayerInfo;
|
||||
class LLTexLayer;
|
||||
class LLViewerTexture;
|
||||
class LLImageTGA;
|
||||
class LLTexGlobalColorInfo;
|
||||
class LLTexLayerParamAlphaInfo;
|
||||
class LLTexLayerParamAlpha;
|
||||
class LLTexParamColorInfo;
|
||||
class LLTexParamColor;
|
||||
class LLPolyMesh;
|
||||
class LLXmlTreeNode;
|
||||
class LLImageRaw;
|
||||
class LLPolyMorphTarget;
|
||||
class LLViewerTexture;
|
||||
|
||||
class LLTextureCtrl;
|
||||
class LLVOAvatar;
|
||||
class LLVOAvatarSelf;
|
||||
class LLImageTGA;
|
||||
class LLImageRaw;
|
||||
class LLXmlTreeNode;
|
||||
class LLTexLayerSet;
|
||||
class LLTexLayerSetInfo;
|
||||
class LLTexLayerInfo;
|
||||
class LLTexLayerSetBuffer;
|
||||
class LLWearable;
|
||||
class LLViewerVisualParam;
|
||||
class LLPolyMorphTarget;
|
||||
|
||||
|
||||
enum EColorOperation
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// LLTexLayerInterface
|
||||
//
|
||||
// Interface class to generalize functionality shared by LLTexLayer
|
||||
// and LLTexLayerTemplate.
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
class LLTexLayerInterface
|
||||
{
|
||||
OP_ADD = 0,
|
||||
OP_MULTIPLY = 1,
|
||||
OP_BLEND = 2,
|
||||
OP_COUNT = 3 // Number of operations
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTexLayerParamAlphaInfo
|
||||
//-----------------------------------------------------------------------------
|
||||
class LLTexLayerParamAlphaInfo : public LLViewerVisualParamInfo
|
||||
{
|
||||
friend class LLTexLayerParamAlpha;
|
||||
public:
|
||||
LLTexLayerParamAlphaInfo();
|
||||
/*virtual*/ ~LLTexLayerParamAlphaInfo() {};
|
||||
enum ERenderPass
|
||||
{
|
||||
RP_COLOR,
|
||||
RP_BUMP,
|
||||
RP_SHINE
|
||||
};
|
||||
|
||||
/*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
|
||||
LLTexLayerInterface(LLTexLayerSet* const layer_set);
|
||||
virtual ~LLTexLayerInterface() {}
|
||||
|
||||
virtual BOOL render(S32 x, S32 y, S32 width, S32 height) = 0;
|
||||
virtual void deleteCaches() = 0;
|
||||
virtual BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height) = 0;
|
||||
virtual BOOL isInvisibleAlphaMask() const = 0;
|
||||
|
||||
const LLTexLayerInfo* getInfo() const { return mInfo; }
|
||||
virtual BOOL setInfo(const LLTexLayerInfo *info); // sets mInfo, calls initialization functions
|
||||
|
||||
const std::string& getName() const;
|
||||
const LLTexLayerSet* const getTexLayerSet() const { return mTexLayerSet; }
|
||||
LLTexLayerSet* const getTexLayerSet() { return mTexLayerSet; }
|
||||
|
||||
void invalidateMorphMasks();
|
||||
virtual void setHasMorph(BOOL newval) { mHasMorph = newval; }
|
||||
BOOL hasMorph() const { return mHasMorph; }
|
||||
BOOL isMorphValid() const { return mMorphMasksValid; }
|
||||
void addMaskedMorph(LLPolyMorphTarget* morph_target, BOOL invert);
|
||||
void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components);
|
||||
|
||||
void requestUpdate();
|
||||
virtual void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height) = 0;
|
||||
BOOL hasAlphaParams() const { return !mParamAlphaList.empty(); }
|
||||
|
||||
ERenderPass getRenderPass() const;
|
||||
BOOL isVisibilityMask() const;
|
||||
|
||||
protected:
|
||||
std::string mStaticImageFileName;
|
||||
BOOL mMultiplyBlend;
|
||||
BOOL mSkipIfZeroWeight;
|
||||
F32 mDomain;
|
||||
};
|
||||
const std::string& getGlobalColor() const;
|
||||
LLViewerVisualParam* getVisualParamPtr(S32 index) const;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTexParamColorInfo
|
||||
//-----------------------------------------------------------------------------
|
||||
class LLTexParamColorInfo : public LLViewerVisualParamInfo
|
||||
{
|
||||
friend class LLTexParamColor;
|
||||
|
||||
public:
|
||||
LLTexParamColorInfo();
|
||||
virtual ~LLTexParamColorInfo() {};
|
||||
BOOL parseXml( LLXmlTreeNode* node );
|
||||
|
||||
protected:
|
||||
enum { MAX_COLOR_VALUES = 20 };
|
||||
EColorOperation mOperation;
|
||||
LLColor4 mColors[MAX_COLOR_VALUES];
|
||||
S32 mNumColors;
|
||||
};
|
||||
LLTexLayerSet* const mTexLayerSet;
|
||||
const LLTexLayerInfo* mInfo;
|
||||
BOOL mMorphMasksValid;
|
||||
BOOL mHasMorph;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTexGlobalColorInfo
|
||||
//-----------------------------------------------------------------------------
|
||||
class LLTexGlobalColorInfo
|
||||
{
|
||||
friend class LLTexGlobalColor;
|
||||
public:
|
||||
LLTexGlobalColorInfo();
|
||||
~LLTexGlobalColorInfo();
|
||||
|
||||
BOOL parseXml(LLXmlTreeNode* node);
|
||||
// Layers can have either mParamColorList, mGlobalColor, or mFixedColor. They are looked for in that order.
|
||||
param_color_list_t mParamColorList;
|
||||
param_alpha_list_t mParamAlphaList;
|
||||
// mGlobalColor name stored in mInfo
|
||||
// mFixedColor value stored in mInfo
|
||||
|
||||
protected:
|
||||
typedef std::vector<LLTexParamColorInfo *> color_info_list_t;
|
||||
color_info_list_t mColorInfoList;
|
||||
std::string mName;
|
||||
typedef std::deque<char *> morph_list_t; //Hack.
|
||||
morph_list_t mMaskedMorphs;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// LLTexLayer
|
||||
//
|
||||
// A single texture layer. Only exists for llvoavatarself.
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
class LLTexLayer : public LLTexLayerInterface
|
||||
{
|
||||
public:
|
||||
LLTexLayer(LLTexLayerSet* const layer_set);
|
||||
/*virtual*/ ~LLTexLayer();
|
||||
|
||||
/*virtual*/ BOOL setInfo(const LLTexLayerInfo *info); // This sets mInfo and calls initialization functions
|
||||
/*virtual*/ BOOL render(S32 x, S32 y, S32 width, S32 height);
|
||||
|
||||
/*virtual*/ void deleteCaches();
|
||||
const U8* getAlphaData() const;
|
||||
|
||||
BOOL findNetColor(LLColor4* color) const;
|
||||
/*virtual*/ BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height); // Multiplies a single alpha texture against the frame buffer
|
||||
/*virtual*/ void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height);
|
||||
BOOL renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLColor4 &layer_color);
|
||||
void addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 height);
|
||||
/*virtual*/ BOOL isInvisibleAlphaMask() const;
|
||||
|
||||
|
||||
static void calculateTexLayerColor(const param_color_list_t ¶m_list, LLColor4 &net_color);
|
||||
protected:
|
||||
LLUUID getUUID() const;
|
||||
LLPointer<LLImageRaw> mStaticImageRaw;
|
||||
private:
|
||||
typedef std::map<U32, U8*> alpha_cache_t;
|
||||
alpha_cache_t mAlphaCache;
|
||||
BOOL mStaticImageInvalid;
|
||||
};
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// LLTexLayerSet
|
||||
//
|
||||
// An ordered set of texture layers that gets composited into a single texture.
|
||||
// Only exists for llvoavatarself.
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
class LLTexLayerSet
|
||||
{
|
||||
friend class LLTexLayerSetBuffer;
|
||||
public:
|
||||
LLTexLayerSet(LLVOAvatarSelf* const avatar);
|
||||
~LLTexLayerSet();
|
||||
|
||||
const LLTexLayerSetInfo* getInfo() const { return mInfo; }
|
||||
BOOL setInfo(const LLTexLayerSetInfo *info); // This sets mInfo and calls initialization functions
|
||||
|
||||
BOOL render(S32 x, S32 y, S32 width, S32 height);
|
||||
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;
|
||||
void invalidateMorphMasks();
|
||||
LLTexLayerInterface* findLayerByName(const std::string& name);
|
||||
|
||||
LLVOAvatarSelf* getAvatar() const { return mAvatar; }
|
||||
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:
|
||||
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;
|
||||
BOOL mIsVisible;
|
||||
|
||||
LLVOAvatarDefines::EBakedTextureIndex mBakedTexIndex;
|
||||
const LLTexLayerSetInfo* mInfo;
|
||||
};
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// LLTexLayerSetInfo
|
||||
// Containes shared layer set data
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Contains shared layer set data.
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
class LLTexLayerSetInfo
|
||||
{
|
||||
friend class LLTexLayerSet;
|
||||
public:
|
||||
LLTexLayerSetInfo();
|
||||
~LLTexLayerSetInfo();
|
||||
|
||||
BOOL parseXml(LLXmlTreeNode* node);
|
||||
|
||||
protected:
|
||||
private:
|
||||
std::string mBodyRegion;
|
||||
S32 mWidth;
|
||||
S32 mHeight;
|
||||
std::string mStaticAlphaFileName;
|
||||
BOOL mClearAlpha; // Set alpha to 1 for this layerset (if there is no mStaticAlphaFileName)
|
||||
|
||||
BOOL mClearAlpha; // Set alpha to 1 for this layerset (if there is no mStaticAlphaFileName)
|
||||
typedef std::vector<LLTexLayerInfo*> layer_info_list_t;
|
||||
layer_info_list_t mLayerInfoList;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTexLayerInfo
|
||||
//-----------------------------------------------------------------------------
|
||||
enum ERenderPass
|
||||
{
|
||||
RP_COLOR,
|
||||
RP_BUMP,
|
||||
RP_SHINE
|
||||
};
|
||||
|
||||
class LLTexLayerInfo
|
||||
{
|
||||
friend class LLTexLayer;
|
||||
public:
|
||||
LLTexLayerInfo();
|
||||
~LLTexLayerInfo();
|
||||
|
||||
BOOL parseXml(LLXmlTreeNode* node);
|
||||
|
||||
protected:
|
||||
std::string mName;
|
||||
|
||||
BOOL mWriteAllChannels; // Don't use masking. Just write RGBA into buffer,
|
||||
ERenderPass mRenderPass;
|
||||
|
||||
std::string mGlobalColor;
|
||||
LLColor4 mFixedColor;
|
||||
|
||||
S32 mLocalTexture;
|
||||
std::string mStaticImageFileName;
|
||||
BOOL mStaticImageIsMask;
|
||||
BOOL mUseLocalTextureAlphaOnly; // Ignore RGB channels from the input texture. Use alpha as a mask
|
||||
BOOL mIsVisibilityMask;
|
||||
|
||||
typedef std::vector<std::pair<std::string,BOOL> > morph_name_list_t;
|
||||
morph_name_list_t mMorphNameList;
|
||||
|
||||
typedef std::vector<LLTexParamColorInfo*> color_info_list_t;
|
||||
color_info_list_t mColorInfoList;
|
||||
|
||||
typedef std::vector<LLTexLayerParamAlphaInfo*> alpha_info_list_t;
|
||||
alpha_info_list_t mAlphaInfoList;
|
||||
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// LLTexLayerSetBuffer
|
||||
//
|
||||
// The composite image that a LLTexLayerSet writes to. Each LLTexLayerSet has one.
|
||||
//-----------------------------------------------------------------------------
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
class LLTexLayerSetBuffer : public LLViewerDynamicTexture
|
||||
{
|
||||
public:
|
||||
LLTexLayerSetBuffer(LLTexLayerSet* owner, S32 width, S32 height);
|
||||
LLTexLayerSetBuffer(LLTexLayerSet* const owner, S32 width, S32 height);
|
||||
virtual ~LLTexLayerSetBuffer();
|
||||
|
||||
public:
|
||||
/*virtual*/ S8 getType() const;
|
||||
BOOL isInitialized(void) const;
|
||||
static void dumpTotalByteCount();
|
||||
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();
|
||||
BOOL updateImmediate();
|
||||
bool isInitialized(void) const;
|
||||
BOOL needsRender();
|
||||
void requestUpdate();
|
||||
virtual BOOL render();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Uploads
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
void requestUpload();
|
||||
void requestDelayedUpload(U64 delay_usec);
|
||||
void cancelUpload();
|
||||
BOOL uploadPending() { return mUploadPending; }
|
||||
BOOL render( S32 x, S32 y, S32 width, S32 height );
|
||||
void readBackAndUpload();
|
||||
|
||||
static void onTextureUploadComplete( const LLUUID& uuid,
|
||||
void* userdata,
|
||||
S32 result, LLExtStat ext_status);
|
||||
static void dumpTotalByteCount();
|
||||
|
||||
virtual S8 getType() const ;
|
||||
virtual void restoreGLTexture() ;
|
||||
virtual void destroyGLTexture() ;
|
||||
|
||||
private:
|
||||
void pushProjection();
|
||||
void popProjection();
|
||||
BOOL needsUploadNow() const;
|
||||
|
||||
private:
|
||||
BOOL mNeedsUpdate;
|
||||
BOOL mNeedsUpload;
|
||||
BOOL mUploadPending;
|
||||
LLUUID mUploadID; // Identifys the current upload process (null if none). Used to avoid overlaps (eg, when the user rapidly makes two changes outside of Face Edit)
|
||||
S32 mUploadFailCount;
|
||||
U64 mUploadAfter; // delay upload until after this time (in microseconds)
|
||||
LLTexLayerSet* mTexLayerSet;
|
||||
|
||||
static S32 sGLByteCount;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTexLayerSet
|
||||
// An ordered set of texture layers that get composited into a single texture.
|
||||
//-----------------------------------------------------------------------------
|
||||
class LLTexLayerSet
|
||||
{
|
||||
friend class LLTexLayerSetBuffer;
|
||||
public:
|
||||
LLTexLayerSet( LLVOAvatarSelf* avatar );
|
||||
~LLTexLayerSet();
|
||||
|
||||
//BOOL parseData(LLXmlTreeNode* node);
|
||||
LLTexLayerSetInfo* getInfo() const { return mInfo; }
|
||||
// This sets mInfo and calls initialization functions
|
||||
BOOL setInfo(LLTexLayerSetInfo *info);
|
||||
|
||||
BOOL render( S32 x, S32 y, S32 width, S32 height );
|
||||
void renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, bool forceClear = false);
|
||||
BOOL isBodyRegion( const std::string& region ) { return mInfo->mBodyRegion == region; }
|
||||
LLTexLayerSetBuffer* getComposite();
|
||||
void requestUpdate();
|
||||
void requestUpload();
|
||||
void cancelUpload();
|
||||
LLVOAvatarSelf* getAvatar() { return mAvatar; }
|
||||
void updateComposite();
|
||||
BOOL isLocalTextureDataAvailable();
|
||||
BOOL isLocalTextureDataFinal();
|
||||
void createComposite();
|
||||
void destroyComposite();
|
||||
void setUpdatesEnabled( BOOL b );
|
||||
BOOL getUpdatesEnabled() { return mUpdatesEnabled; }
|
||||
void deleteCaches();
|
||||
void gatherAlphaMasks(U8 *data, S32 width, S32 height);
|
||||
void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components);
|
||||
const std::string getBodyRegion() { return mInfo->mBodyRegion; }
|
||||
BOOL hasComposite() { return (mComposite.notNull()); }
|
||||
LLVOAvatarDefines::EBakedTextureIndex getBakedTexIndex() { return mBakedTexIndex; }
|
||||
void setBakedTexIndex(LLVOAvatarDefines::EBakedTextureIndex index) { mBakedTexIndex = index; }
|
||||
BOOL isVisible() const { return mIsVisible; }
|
||||
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);
|
||||
|
||||
void doUpload(); // Does a read back and upload.
|
||||
private:
|
||||
|
||||
BOOL mNeedsUpload; // Whether we need to send 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).
|
||||
S32 mUploadFailCount; // Number of consecutive upload failures
|
||||
BOOL mNeedsUpdate;
|
||||
U64 mUploadAfter; // delay upload until after this time (in microseconds)
|
||||
//--------------------------------------------------------------------
|
||||
// Updates
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
static BOOL sHasCaches;
|
||||
|
||||
protected:
|
||||
typedef std::vector<LLTexLayer *> layer_list_t;
|
||||
layer_list_t mLayerList;
|
||||
layer_list_t mMaskLayerList;
|
||||
LLPointer<LLTexLayerSetBuffer> mComposite;
|
||||
// Backlink only; don't make this an LLPointer.
|
||||
LLVOAvatarSelf* mAvatar;
|
||||
BOOL mUpdatesEnabled;
|
||||
BOOL mIsVisible;
|
||||
|
||||
LLVOAvatarDefines::EBakedTextureIndex mBakedTexIndex;
|
||||
|
||||
LLTexLayerSetInfo *mInfo;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTexLayer
|
||||
// A single texture layer
|
||||
//-----------------------------------------------------------------------------
|
||||
class LLTexLayer
|
||||
{
|
||||
public:
|
||||
LLTexLayer( LLTexLayerSet* layer_set );
|
||||
~LLTexLayer();
|
||||
|
||||
//BOOL parseData(LLXmlTreeNode* node);
|
||||
LLTexLayerInfo* getInfo() const { return mInfo; }
|
||||
// This sets mInfo and calls initialization functions
|
||||
BOOL setInfo(LLTexLayerInfo *info);
|
||||
|
||||
BOOL render( S32 x, S32 y, S32 width, S32 height );
|
||||
void requestUpdate();
|
||||
LLTexLayerSet* getTexLayerSet() { return mTexLayerSet; }
|
||||
|
||||
const std::string& getName() { return mInfo->mName; }
|
||||
|
||||
void addMaskedMorph(LLPolyMorphTarget* morph_target, BOOL invert);
|
||||
void deleteCaches();
|
||||
U8* getAlphaData();
|
||||
void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components);
|
||||
|
||||
void invalidateMorphMasks();
|
||||
ERenderPass getRenderPass() { return mInfo->mRenderPass; }
|
||||
const std::string& getGlobalColor() { return mInfo->mGlobalColor; }
|
||||
BOOL findNetColor( LLColor4* color );
|
||||
BOOL renderImageRaw( U8* in_data, S32 in_width, S32 in_height, S32 in_components, S32 width, S32 height, BOOL is_mask );
|
||||
BOOL renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4* colorp );
|
||||
BOOL hasAlphaParams() { return (!mParamAlphaList.empty());}
|
||||
BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height);
|
||||
BOOL isVisibilityMask() const;
|
||||
BOOL isInvisibleAlphaMask();
|
||||
|
||||
protected:
|
||||
LLTexLayerSet* mTexLayerSet;
|
||||
LLPointer<LLImageRaw> mStaticImageRaw;
|
||||
|
||||
// Layers can have either mParamColorList, mGlobalColor, or mFixedColor. They are looked for in that order.
|
||||
typedef std::vector<LLTexParamColor *> color_list_t;
|
||||
color_list_t mParamColorList;
|
||||
// mGlobalColor name stored in mInfo
|
||||
// mFixedColor value stored in mInfo
|
||||
|
||||
typedef std::vector<LLTexLayerParamAlpha *> alpha_list_t;
|
||||
alpha_list_t mParamAlphaList;
|
||||
|
||||
|
||||
typedef std::deque<LLVOAvatar::LLMaskedMorph> morph_list_t;
|
||||
morph_list_t mMaskedMorphs;
|
||||
typedef std::map<U32, U8*> alpha_cache_t;
|
||||
alpha_cache_t mAlphaCache;
|
||||
BOOL mMorphMasksValid;
|
||||
BOOL mStaticImageInvalid;
|
||||
|
||||
LLTexLayerInfo *mInfo;
|
||||
BOOL requestUpdateImmediate();
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTexLayerParamAlpha
|
||||
//-----------------------------------------------------------------------------
|
||||
class LLTexLayerParamAlpha : public LLViewerVisualParam
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// LLTexLayerStaticImageList
|
||||
//
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
class LLTexLayerStaticImageList : public LLSingleton<LLTexLayerStaticImageList>
|
||||
{
|
||||
public:
|
||||
LLTexLayerParamAlpha( LLTexLayer* layer );
|
||||
/*virtual*/ ~LLTexLayerParamAlpha();
|
||||
|
||||
// Special: These functions are overridden by child classes
|
||||
LLTexLayerParamAlphaInfo* getInfo() const { return (LLTexLayerParamAlphaInfo*)mInfo; }
|
||||
// This sets mInfo and calls initialization functions
|
||||
BOOL setInfo(LLTexLayerParamAlphaInfo *info);
|
||||
|
||||
// LLVisualParam Virtual functions
|
||||
///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
|
||||
/*virtual*/ void apply( ESex avatar_sex ) {}
|
||||
/*virtual*/ void setWeight(F32 weight, BOOL set_by_user);
|
||||
/*virtual*/ void setAnimationTarget(F32 target_value, BOOL set_by_user);
|
||||
/*virtual*/ void animate(F32 delta, BOOL set_by_user);
|
||||
|
||||
// LLViewerVisualParam Virtual functions
|
||||
/*virtual*/ F32 getTotalDistortion() { return 1.f; }
|
||||
/*virtual*/ const LLVector3& getAvgDistortion() { return mAvgDistortionVec; }
|
||||
/*virtual*/ F32 getMaxDistortion() { return 3.f; }
|
||||
/*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector3(1.f, 1.f, 1.f);}
|
||||
/*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;};
|
||||
/*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;};
|
||||
|
||||
// New functions
|
||||
BOOL render( S32 x, S32 y, S32 width, S32 height );
|
||||
BOOL getSkip();
|
||||
void deleteCaches();
|
||||
LLTexLayer* getTexLayer() { return mTexLayer; }
|
||||
BOOL getMultiplyBlend() { return getInfo()->mMultiplyBlend; }
|
||||
|
||||
protected:
|
||||
LLPointer<LLViewerTexture> mCachedProcessedTexture;
|
||||
LLTexLayer* mTexLayer;
|
||||
LLPointer<LLImageTGA> mStaticImageTGA;
|
||||
LLPointer<LLImageRaw> mStaticImageRaw;
|
||||
BOOL mNeedsCreateTexture;
|
||||
BOOL mStaticImageInvalid;
|
||||
LLVector3 mAvgDistortionVec;
|
||||
F32 mCachedEffectiveWeight;
|
||||
|
||||
public:
|
||||
// Global list of instances for gathering statistics
|
||||
static void dumpCacheByteCount();
|
||||
static void getCacheByteCount( S32* gl_bytes );
|
||||
|
||||
typedef std::list< LLTexLayerParamAlpha* > param_alpha_ptr_list_t;
|
||||
static param_alpha_ptr_list_t sInstances;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTexGlobalColor
|
||||
//-----------------------------------------------------------------------------
|
||||
class LLTexGlobalColor
|
||||
{
|
||||
public:
|
||||
LLTexGlobalColor( LLVOAvatar* avatar );
|
||||
~LLTexGlobalColor();
|
||||
|
||||
//BOOL parseData(LLXmlTreeNode* node);
|
||||
LLTexGlobalColorInfo* getInfo() const { return mInfo; }
|
||||
// This sets mInfo and calls initialization functions
|
||||
BOOL setInfo(LLTexGlobalColorInfo *info);
|
||||
|
||||
void requstUpdate();
|
||||
LLVOAvatar* getAvatar() { return mAvatar; }
|
||||
LLColor4 getColor();
|
||||
const std::string& getName() { return mInfo->mName; }
|
||||
|
||||
protected:
|
||||
typedef std::vector<LLTexParamColor *> param_list_t;
|
||||
param_list_t mParamList;
|
||||
LLVOAvatar* mAvatar; // just backlink, don't LLPointer
|
||||
|
||||
LLTexGlobalColorInfo *mInfo;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTexParamColor
|
||||
//-----------------------------------------------------------------------------
|
||||
class LLTexParamColor : public LLViewerVisualParam
|
||||
{
|
||||
public:
|
||||
LLTexParamColor( LLTexGlobalColor* tex_color );
|
||||
LLTexParamColor( LLTexLayer* layer );
|
||||
/* virtual */ ~LLTexParamColor();
|
||||
|
||||
// Special: These functions are overridden by child classes
|
||||
LLTexParamColorInfo* getInfo() const { return (LLTexParamColorInfo*)mInfo; }
|
||||
// This sets mInfo and calls initialization functions
|
||||
BOOL setInfo(LLTexParamColorInfo *info);
|
||||
|
||||
// LLVisualParam Virtual functions
|
||||
///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
|
||||
/*virtual*/ void apply( ESex avatar_sex ) {}
|
||||
/*virtual*/ void setWeight(F32 weight, BOOL set_by_user);
|
||||
/*virtual*/ void setAnimationTarget(F32 target_value, BOOL set_by_user);
|
||||
/*virtual*/ void animate(F32 delta, BOOL set_by_user);
|
||||
|
||||
|
||||
// LLViewerVisualParam Virtual functions
|
||||
/*virtual*/ F32 getTotalDistortion() { return 1.f; }
|
||||
/*virtual*/ const LLVector3& getAvgDistortion() { return mAvgDistortionVec; }
|
||||
/*virtual*/ F32 getMaxDistortion() { return 3.f; }
|
||||
/*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector3(1.f, 1.f, 1.f); }
|
||||
/*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;};
|
||||
/*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;};
|
||||
|
||||
// New functions
|
||||
LLColor4 getNetColor();
|
||||
EColorOperation getOperation() const { return getInfo()->mOperation; }
|
||||
|
||||
|
||||
protected:
|
||||
LLVector3 mAvgDistortionVec;
|
||||
LLTexGlobalColor* mTexGlobalColor; // either has mTexGlobalColor or mTexLayer as its parent
|
||||
LLTexLayer* mTexLayer;
|
||||
LLVOAvatar* mAvatar; // redundant, but simplifies the code (don't LLPointer)
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLTexStaticImageList
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class LLTexStaticImageList
|
||||
{
|
||||
public:
|
||||
LLTexStaticImageList();
|
||||
~LLTexStaticImageList();
|
||||
|
||||
LLImageRaw* getImageRaw( const std::string& file_name );
|
||||
LLViewerTexture* getTexture( const std::string& file_name, BOOL is_mask );
|
||||
LLImageTGA* getImageTGA( const std::string& file_name );
|
||||
|
||||
LLTexLayerStaticImageList();
|
||||
~LLTexLayerStaticImageList();
|
||||
LLViewerTexture* getTexture(const std::string& file_name, BOOL is_mask);
|
||||
LLImageTGA* getImageTGA(const std::string& file_name);
|
||||
void deleteCachedImages();
|
||||
void dumpByteCount() const;
|
||||
protected:
|
||||
BOOL loadImageRaw(const std::string& file_name, LLImageRaw* image_raw);
|
||||
|
||||
private:
|
||||
static LLStringTable sImageNames;
|
||||
|
||||
LLStringTable mImageNames;
|
||||
typedef std::map<const char*, LLPointer<LLViewerTexture> > texture_map_t;
|
||||
texture_map_t mStaticImageList;
|
||||
typedef std::map<const char*, LLPointer<LLImageTGA> > image_tga_map_t;
|
||||
image_tga_map_t mStaticImageListTGA;
|
||||
public:
|
||||
S32 mGLBytes;
|
||||
S32 mTGABytes;
|
||||
};
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// LLBakedUploadData
|
||||
//
|
||||
// Used by LLTexLayerSetBuffer for a callback.
|
||||
|
||||
// For DEV-DEV-31590, "Heap corruption and crash after outfit
|
||||
// changes", added the mLayerSet member. The current
|
||||
// LLTexLayerSetBuffer can be found by querying mLayerSet->mComposite,
|
||||
// but we still store the original mLayerSetBuffer here so we can
|
||||
// detect when an upload is out of date. This prevents a memory
|
||||
// stomp. See LLTexLayerSetBuffer::onTextureUploadComplete() for usage.
|
||||
class LLBakedUploadData
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
struct LLBakedUploadData
|
||||
{
|
||||
public:
|
||||
LLBakedUploadData( LLVOAvatarSelf* avatar, LLTexLayerSet* layerset, LLTexLayerSetBuffer* layerset_buffer, const LLUUID & id);
|
||||
LLBakedUploadData(const LLVOAvatarSelf* avatar,
|
||||
LLTexLayerSet* layerset,
|
||||
const LLUUID& id);
|
||||
~LLBakedUploadData() {}
|
||||
const LLUUID mID;
|
||||
const LLVOAvatarSelf* mAvatar; // note: backlink only; don't LLPointer
|
||||
LLTexLayerSet* mTexLayerSet;
|
||||
|
||||
LLUUID mID;
|
||||
LLVOAvatarSelf* mAvatar; // just backlink, don't LLPointer
|
||||
LLTexLayerSet* mTexLayerSet;
|
||||
LLTexLayerSetBuffer* mLayerSetBuffer;
|
||||
LLUUID mWearableAssets[LLWearableType::WT_COUNT];
|
||||
U64 mStartTime; // Used to measure time baked texture upload requires
|
||||
const U64 mStartTime; // for measuring baked texture upload time
|
||||
};
|
||||
|
||||
extern LLTexStaticImageList gTexStaticImageList;
|
||||
|
||||
|
||||
#endif // LL_LLTEXLAYER_H
|
||||
|
||||
@@ -145,13 +145,6 @@ LLTexLayerParamAlpha::~LLTexLayerParamAlpha()
|
||||
sInstances.remove(this);
|
||||
}
|
||||
|
||||
/*virtual*/ LLViewerVisualParam* LLTexLayerParamAlpha::cloneParam(LLWearable* wearable) const
|
||||
{
|
||||
LLTexLayerParamAlpha *new_param = new LLTexLayerParamAlpha(mTexLayer);
|
||||
*new_param = *this;
|
||||
return new_param;
|
||||
}
|
||||
|
||||
void LLTexLayerParamAlpha::deleteCaches()
|
||||
{
|
||||
mStaticImageTGA = NULL; // deletes image
|
||||
@@ -188,6 +181,7 @@ void LLTexLayerParamAlpha::setWeight(F32 weight, BOOL upload_bake)
|
||||
}
|
||||
mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
|
||||
mTexLayer->invalidateMorphMasks();
|
||||
mAvatar->updateMeshTextures();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -323,14 +317,14 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
|
||||
// Create the GL texture, and then hang onto it for future use.
|
||||
if (mNeedsCreateTexture)
|
||||
{
|
||||
mCachedProcessedTexture->createGLTexture(0, mStaticImageRaw);
|
||||
mCachedProcessedTexture->createGLTexture(0, mStaticImageRaw, 0, TRUE, LLViewerTexture::BOOST_AVATAR_SELF);
|
||||
mNeedsCreateTexture = FALSE;
|
||||
gGL.getTexUnit(0)->bind(mCachedProcessedTexture);
|
||||
mCachedProcessedTexture->setAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
}
|
||||
|
||||
LLGLSNoAlphaTest gls_no_alpha_test;
|
||||
gGL.getTexUnit(0)->bind(mCachedProcessedTexture);
|
||||
gGL.getTexUnit(0)->bind(mCachedProcessedTexture, TRUE);
|
||||
gl_rect_2d_simple_tex(width, height);
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
stop_glerror();
|
||||
@@ -419,12 +413,6 @@ LLTexLayerParamColor::~LLTexLayerParamColor()
|
||||
{
|
||||
}
|
||||
|
||||
/*virtual*/ LLViewerVisualParam* LLTexLayerParamColor::cloneParam(LLWearable* wearable) const
|
||||
{
|
||||
LLTexLayerParamColor *new_param = new LLTexLayerParamColor(mTexLayer);
|
||||
*new_param = *this;
|
||||
return new_param;
|
||||
}
|
||||
|
||||
LLColor4 LLTexLayerParamColor::getNetColor() const
|
||||
{
|
||||
@@ -521,7 +509,7 @@ LLTexLayerParamColorInfo::LLTexLayerParamColorInfo() :
|
||||
|
||||
BOOL LLTexLayerParamColorInfo::parseXml(LLXmlTreeNode *node)
|
||||
{
|
||||
llassert(node->hasName("param") && node->getChildByName("param_color"));
|
||||
llassert( node->hasName( "param" ) && node->getChildByName( "param_color" ) );
|
||||
|
||||
if (!LLViewerVisualParamInfo::parseXml(node))
|
||||
return FALSE;
|
||||
|
||||
187
indra/newview/lltexlayerparams.h
Normal file
187
indra/newview/lltexlayerparams.h
Normal file
@@ -0,0 +1,187 @@
|
||||
/**
|
||||
* @file lltexlayerparams.h
|
||||
* @brief Texture layer parameters, used by lltexlayer.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LLTEXLAYERPARAMS_H
|
||||
#define LL_LLTEXLAYERPARAMS_H
|
||||
|
||||
#include "llviewervisualparam.h"
|
||||
|
||||
class LLImageRaw;
|
||||
class LLImageTGA;
|
||||
class LLTexLayer;
|
||||
class LLTexLayerInterface;
|
||||
class LLViewerTexture;
|
||||
class LLVOAvatar;
|
||||
class LLWearable;
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// LLTexLayerParam
|
||||
//
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
class LLTexLayerParam : public LLViewerVisualParam
|
||||
{
|
||||
public:
|
||||
LLTexLayerParam(LLTexLayerInterface *layer);
|
||||
LLTexLayerParam(LLVOAvatar *avatar);
|
||||
/*virtual*/ BOOL setInfo(LLViewerVisualParamInfo *info, BOOL add_to_avatar );
|
||||
protected:
|
||||
LLTexLayerInterface* mTexLayer;
|
||||
LLVOAvatar* mAvatar;
|
||||
};
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// LLTexLayerParamAlpha
|
||||
//
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
class LLTexLayerParamAlpha : public LLTexLayerParam
|
||||
{
|
||||
public:
|
||||
LLTexLayerParamAlpha( LLTexLayerInterface* layer );
|
||||
LLTexLayerParamAlpha( LLVOAvatar* avatar );
|
||||
/*virtual*/ ~LLTexLayerParamAlpha();
|
||||
|
||||
// LLVisualParam Virtual functions
|
||||
///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
|
||||
/*virtual*/ void apply( ESex avatar_sex ) {}
|
||||
/*virtual*/ void setWeight(F32 weight, BOOL upload_bake);
|
||||
/*virtual*/ void setAnimationTarget(F32 target_value, BOOL upload_bake);
|
||||
/*virtual*/ void animate(F32 delta, BOOL upload_bake);
|
||||
|
||||
// LLViewerVisualParam Virtual functions
|
||||
/*virtual*/ F32 getTotalDistortion() { return 1.f; }
|
||||
/*virtual*/ const LLVector3& getAvgDistortion() { return mAvgDistortionVec; }
|
||||
/*virtual*/ F32 getMaxDistortion() { return 3.f; }
|
||||
/*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector3(1.f, 1.f, 1.f);}
|
||||
/*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;};
|
||||
/*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;};
|
||||
|
||||
// New functions
|
||||
BOOL render( S32 x, S32 y, S32 width, S32 height );
|
||||
BOOL getSkip() const;
|
||||
void deleteCaches();
|
||||
BOOL getMultiplyBlend() const;
|
||||
|
||||
private:
|
||||
LLPointer<LLViewerTexture> mCachedProcessedTexture;
|
||||
LLPointer<LLImageTGA> mStaticImageTGA;
|
||||
LLPointer<LLImageRaw> mStaticImageRaw;
|
||||
BOOL mNeedsCreateTexture;
|
||||
BOOL mStaticImageInvalid;
|
||||
LLVector3 mAvgDistortionVec;
|
||||
F32 mCachedEffectiveWeight;
|
||||
|
||||
public:
|
||||
// Global list of instances for gathering statistics
|
||||
static void dumpCacheByteCount();
|
||||
static void getCacheByteCount( S32* gl_bytes );
|
||||
|
||||
typedef std::list< LLTexLayerParamAlpha* > param_alpha_ptr_list_t;
|
||||
static param_alpha_ptr_list_t sInstances;
|
||||
};
|
||||
class LLTexLayerParamAlphaInfo : public LLViewerVisualParamInfo
|
||||
{
|
||||
friend class LLTexLayerParamAlpha;
|
||||
public:
|
||||
LLTexLayerParamAlphaInfo();
|
||||
/*virtual*/ ~LLTexLayerParamAlphaInfo() {};
|
||||
|
||||
/*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
|
||||
|
||||
private:
|
||||
std::string mStaticImageFileName;
|
||||
BOOL mMultiplyBlend;
|
||||
BOOL mSkipIfZeroWeight;
|
||||
F32 mDomain;
|
||||
};
|
||||
//
|
||||
// LLTexLayerParamAlpha
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// LLTexLayerParamColor
|
||||
//
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
class LLTexLayerParamColor : public LLTexLayerParam
|
||||
{
|
||||
public:
|
||||
enum EColorOperation
|
||||
{
|
||||
OP_ADD = 0,
|
||||
OP_MULTIPLY = 1,
|
||||
OP_BLEND = 2,
|
||||
OP_COUNT = 3 // Number of operations
|
||||
};
|
||||
|
||||
LLTexLayerParamColor( LLTexLayerInterface* layer );
|
||||
LLTexLayerParamColor( LLVOAvatar* avatar );
|
||||
/* virtual */ ~LLTexLayerParamColor();
|
||||
|
||||
// LLVisualParam Virtual functions
|
||||
///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
|
||||
/*virtual*/ void apply( ESex avatar_sex ) {}
|
||||
/*virtual*/ void setWeight(F32 weight, BOOL upload_bake);
|
||||
/*virtual*/ void setAnimationTarget(F32 target_value, BOOL upload_bake);
|
||||
/*virtual*/ void animate(F32 delta, BOOL upload_bake);
|
||||
|
||||
|
||||
// LLViewerVisualParam Virtual functions
|
||||
/*virtual*/ F32 getTotalDistortion() { return 1.f; }
|
||||
/*virtual*/ const LLVector3& getAvgDistortion() { return mAvgDistortionVec; }
|
||||
/*virtual*/ F32 getMaxDistortion() { return 3.f; }
|
||||
/*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector3(1.f, 1.f, 1.f); }
|
||||
/*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;};
|
||||
/*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;};
|
||||
|
||||
// New functions
|
||||
LLColor4 getNetColor() const;
|
||||
protected:
|
||||
virtual void onGlobalColorChanged(bool upload_bake) {}
|
||||
private:
|
||||
LLVector3 mAvgDistortionVec;
|
||||
};
|
||||
|
||||
class LLTexLayerParamColorInfo : public LLViewerVisualParamInfo
|
||||
{
|
||||
friend class LLTexLayerParamColor;
|
||||
|
||||
public:
|
||||
LLTexLayerParamColorInfo();
|
||||
virtual ~LLTexLayerParamColorInfo() {};
|
||||
BOOL parseXml( LLXmlTreeNode* node );
|
||||
LLTexLayerParamColor::EColorOperation getOperation() const { return mOperation; }
|
||||
private:
|
||||
enum { MAX_COLOR_VALUES = 20 };
|
||||
LLTexLayerParamColor::EColorOperation mOperation;
|
||||
LLColor4 mColors[MAX_COLOR_VALUES];
|
||||
S32 mNumColors;
|
||||
};
|
||||
|
||||
typedef std::vector<LLTexLayerParamColor *> param_color_list_t;
|
||||
typedef std::vector<LLTexLayerParamAlpha *> param_alpha_list_t;
|
||||
typedef std::vector<LLTexLayerParamColorInfo *> param_color_info_list_t;
|
||||
typedef std::vector<LLTexLayerParamAlphaInfo *> param_alpha_info_list_t;
|
||||
|
||||
#endif
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "llviewerobjectlist.h"
|
||||
#include "llviewertexturelist.h"
|
||||
#include "lltexlayer.h"
|
||||
#include "lltexlayerparams.h"
|
||||
#include "llsurface.h"
|
||||
#include "llvlmanager.h"
|
||||
#include "llagent.h"
|
||||
@@ -525,7 +526,7 @@ void output_statistics(void*)
|
||||
|
||||
llinfos << "--------------------------------" << llendl;
|
||||
llinfos << "Avatar Memory (partly overlaps with above stats):" << llendl;
|
||||
gTexStaticImageList.dumpByteCount();
|
||||
LLTexLayerStaticImageList::getInstance()->dumpByteCount();
|
||||
LLVOAvatarSelf::dumpScratchTextureByteCount();
|
||||
LLTexLayerSetBuffer::dumpTotalByteCount();
|
||||
LLVOAvatarSelf::dumpTotalLocalTextureByteCount();
|
||||
|
||||
@@ -119,12 +119,6 @@ LLViewerVisualParam::LLViewerVisualParam()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
//=============================================================================
|
||||
// These virtual functions should always be overridden,
|
||||
// but are included here for use as templates
|
||||
//=============================================================================
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// setInfo()
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -139,7 +133,7 @@ BOOL LLViewerVisualParam::setInfo(LLViewerVisualParamInfo *info)
|
||||
setWeight(getDefaultWeight(), FALSE );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
//-----------------------------------------------------------------------------
|
||||
// parseData()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
virtual const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **mesh) = 0;
|
||||
|
||||
// interface methods
|
||||
F32 getDisplayOrder() { return getInfo()->mEditGroupDisplayOrder; }
|
||||
F32 getDisplayOrder() const { return getInfo()->mEditGroupDisplayOrder; }
|
||||
S32 getWearableType() const { return getInfo()->mWearableType; }
|
||||
const std::string& getEditGroup() const { return getInfo()->mEditGroup; }
|
||||
|
||||
|
||||
@@ -1131,7 +1131,7 @@ void LLVOAvatar::deleteCachedImages(bool clearAll)
|
||||
}
|
||||
|
||||
LLVOAvatarSelf::deleteScratchTextures();
|
||||
gTexStaticImageList.deleteCachedImages();
|
||||
LLTexLayerStaticImageList::getInstance()->deleteCachedImages();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "llrendertarget.h"
|
||||
#include "llwearable.h"
|
||||
#include "llvoavatardefines.h"
|
||||
#include "lltexglobalcolor.h"
|
||||
#include "emeraldboobutils.h"
|
||||
#include "llavatarname.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user