summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2012-10-02 01:02:34 +0000
committerDon Kjer <don@lindenlab.com>2012-10-02 01:02:34 +0000
commit5483bc28ae6b33bf5b2371d46648ad20975daf8c (patch)
tree37f0334ac9e84304db8c6ee4063e56d61696cbbd
parent5010cf72d345e60d0a367ea213dafe8727414612 (diff)
Moved gatherMorphMaskAlpha into llappearance.
-rw-r--r--indra/llappearance/llavatarappearancedefines.cpp24
-rw-r--r--indra/llappearance/llavatarappearancedefines.h1
-rw-r--r--indra/llappearance/lltexlayer.cpp15
-rw-r--r--indra/llappearance/lltexlayer.h1
-rwxr-xr-xindra/newview/llviewertexlayer.cpp21
-rw-r--r--indra/newview/llviewertexlayer.h1
6 files changed, 43 insertions, 20 deletions
diff --git a/indra/llappearance/llavatarappearancedefines.cpp b/indra/llappearance/llavatarappearancedefines.cpp
index 0416309fc7..f1c78946a1 100644
--- a/indra/llappearance/llavatarappearancedefines.cpp
+++ b/indra/llappearance/llavatarappearancedefines.cpp
@@ -220,7 +220,7 @@ ETextureIndex LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(EBakedTextu
return LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(index)->mTextureIndex;
}
-//static
+// static
EBakedTextureIndex LLAvatarAppearanceDictionary::findBakedByRegionName(std::string name)
{
U8 index = 0;
@@ -238,6 +238,28 @@ EBakedTextureIndex LLAvatarAppearanceDictionary::findBakedByRegionName(std::stri
return BAKED_NUM_INDICES;
}
+// static
+EBakedTextureIndex LLAvatarAppearanceDictionary::findBakedByImageName(std::string name)
+{
+ U8 index = 0;
+ while (index < BAKED_NUM_INDICES)
+ {
+ const BakedEntry *be = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex) index);
+ if (be)
+ {
+ const TextureEntry *te = LLAvatarAppearanceDictionary::getInstance()->getTexture(be->mTextureIndex);
+ if (te && te->mDefaultImageName.compare(name) == 0)
+ {
+ // baked texture found
+ return (EBakedTextureIndex) index;
+ }
+ }
+ index++;
+ }
+ // baked texture could not be found
+ return BAKED_NUM_INDICES;
+}
+
// static
LLWearableType::EType LLAvatarAppearanceDictionary::getTEWearableType(ETextureIndex index )
{
diff --git a/indra/llappearance/llavatarappearancedefines.h b/indra/llappearance/llavatarappearancedefines.h
index 2e073bf5d2..496f85c107 100644
--- a/indra/llappearance/llavatarappearancedefines.h
+++ b/indra/llappearance/llavatarappearancedefines.h
@@ -217,6 +217,7 @@ public:
// find a baked texture index based on its name
static EBakedTextureIndex findBakedByRegionName(std::string name);
+ static EBakedTextureIndex findBakedByImageName(std::string name);
// Given a texture entry, determine which wearable type owns it.
static LLWearableType::EType getTEWearableType(ETextureIndex index);
diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp
index 6f079b4abb..16f94c48dd 100644
--- a/indra/llappearance/lltexlayer.cpp
+++ b/indra/llappearance/lltexlayer.cpp
@@ -516,6 +516,21 @@ const LLTexLayerSetBuffer* LLTexLayerSet::getComposite() const
return mComposite;
}
+void LLTexLayerSet::gatherMorphMaskAlpha(U8 *data, S32 origin_x, S32 origin_y, 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, origin_x, origin_y, width, height);
+ }
+
+ // Set alpha back to that of our alpha masks.
+ renderAlphaMaskTextures(origin_x, origin_y, width, height, true);
+}
+
+
void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, bool forceClear)
{
const LLTexLayerSetInfo *info = getInfo();
diff --git a/indra/llappearance/lltexlayer.h b/indra/llappearance/lltexlayer.h
index f9f8bdd817..405d2c7df4 100644
--- a/indra/llappearance/lltexlayer.h
+++ b/indra/llappearance/lltexlayer.h
@@ -194,6 +194,7 @@ public:
const LLTexLayerSetBuffer* getComposite() const; // Do not create one if it doesn't exist.
virtual void createComposite() = 0;
void destroyComposite();
+ void gatherMorphMaskAlpha(U8 *data, S32 origin_x, S32 origin_y, S32 width, S32 height);
const LLTexLayerSetInfo* getInfo() const { return mInfo; }
BOOL setInfo(const LLTexLayerSetInfo *info); // This sets mInfo and calls initialization functions
diff --git a/indra/newview/llviewertexlayer.cpp b/indra/newview/llviewertexlayer.cpp
index b129c28e0d..cd5e781d71 100755
--- a/indra/newview/llviewertexlayer.cpp
+++ b/indra/newview/llviewertexlayer.cpp
@@ -379,7 +379,9 @@ void LLViewerTexLayerSetBuffer::doUpload()
LLGLSUIDefault gls_ui;
LLPointer<LLImageRaw> baked_mask_image = new LLImageRaw(mFullWidth, mFullHeight, 1 );
U8* baked_mask_data = baked_mask_image->getData();
- layer_set->gatherMorphMaskAlpha(baked_mask_data, mFullWidth, mFullHeight);
+ layer_set->gatherMorphMaskAlpha(baked_mask_data,
+ mOrigin.mX, mOrigin.mY,
+ mFullWidth, mFullHeight);
// Create the baked image from our color and mask information
@@ -700,23 +702,6 @@ void LLViewerTexLayerSet::setUpdatesEnabled( BOOL b )
mUpdatesEnabled = b;
}
-
-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, getViewerComposite()->getOriginX(),
- getViewerComposite()->getOriginY(), width, height);
- }
-
- // Set alpha back to that of our alpha masks.
- renderAlphaMaskTextures(getViewerComposite()->getOriginX(),
- getViewerComposite()->getOriginY(), width, height, true);
-}
-
LLVOAvatarSelf* LLViewerTexLayerSet::getAvatar()
{
return dynamic_cast<LLVOAvatarSelf*> (mAvatarAppearance);
diff --git a/indra/newview/llviewertexlayer.h b/indra/newview/llviewertexlayer.h
index 9df9474eff..959c883da8 100644
--- a/indra/newview/llviewertexlayer.h
+++ b/indra/newview/llviewertexlayer.h
@@ -55,7 +55,6 @@ public:
/*virtual*/void createComposite();
void setUpdatesEnabled(BOOL b);
BOOL getUpdatesEnabled() const { return mUpdatesEnabled; }
- void gatherMorphMaskAlpha(U8 *data, S32 width, S32 height);
LLVOAvatarSelf* getAvatar();
const LLVOAvatarSelf* getAvatar() const;