summaryrefslogtreecommitdiff
path: root/indra/newview/lllocalbitmaps.cpp
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2013-10-14 16:30:08 -0700
committerMerov Linden <merov@lindenlab.com>2013-10-14 16:30:08 -0700
commitc2f5365f986aab49d5c7cfa2834a68f5b35c09c2 (patch)
tree4cbbf7bd730ad0ad3aa00569c4364dad51de6082 /indra/newview/lllocalbitmaps.cpp
parent0cf0efb6e31d505bc079f757fe7d832110797199 (diff)
parentf7158bc5afcec1da8b9d2d5a4ed86921e62d4959 (diff)
Pull merge from lindenlab/viewer-release
Diffstat (limited to 'indra/newview/lllocalbitmaps.cpp')
-rwxr-xr-x[-rw-r--r--]indra/newview/lllocalbitmaps.cpp171
1 files changed, 105 insertions, 66 deletions
diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp
index 97ba5b634a..2d9385390b 100644..100755
--- a/indra/newview/lllocalbitmaps.cpp
+++ b/indra/newview/lllocalbitmaps.cpp
@@ -53,11 +53,13 @@
#include "llviewerobject.h"
#include "llface.h"
#include "llvoavatarself.h"
-#include "llwearable.h"
+#include "llviewerwearable.h"
#include "llagentwearables.h"
#include "lltexlayerparams.h"
#include "llvovolume.h"
#include "llnotificationsutil.h"
+#include "pipeline.h"
+#include "llmaterialmgr.h"
/*=======================================*/
/* Formal declarations, constants, etc. */
@@ -195,7 +197,7 @@ bool LLLocalBitmap::updateSelf(EUpdateType optional_firstupdate)
mLastModified = new_last_modified;
LLPointer<LLViewerFetchedTexture> texture = new LLViewerFetchedTexture
- ("file://"+mFilename, mWorldID, LL_LOCAL_USE_MIPMAPS);
+ ("file://"+mFilename, FTT_LOCAL_FILE, mWorldID, LL_LOCAL_USE_MIPMAPS);
texture->createGLTexture(LL_LOCAL_DISCARD_LEVEL, raw_image);
texture->setCachedRawImage(LL_LOCAL_DISCARD_LEVEL, raw_image);
@@ -339,7 +341,12 @@ void LLLocalBitmap::replaceIDs(LLUUID old_id, LLUUID new_id)
return;
}
- updateUserPrims(old_id, new_id);
+ // processing updates per channel; makes the process scalable.
+ // the only actual difference is in SetTE* call i.e. SetTETexture, SetTENormal, etc.
+ updateUserPrims(old_id, new_id, LLRender::DIFFUSE_MAP);
+ updateUserPrims(old_id, new_id, LLRender::NORMAL_MAP);
+ updateUserPrims(old_id, new_id, LLRender::SPECULAR_MAP);
+
updateUserSculpts(old_id, new_id); // isn't there supposed to be an IMG_DEFAULT_SCULPT or something?
// default safeguard image for layers
@@ -367,15 +374,15 @@ void LLLocalBitmap::replaceIDs(LLUUID old_id, LLUUID new_id)
// this function sorts the faces from a getFaceList[getNumFaces] into a list of objects
// in order to prevent multiple sendTEUpdate calls per object during updateUserPrims
-std::vector<LLViewerObject*> LLLocalBitmap::prepUpdateObjects(LLUUID old_id)
+std::vector<LLViewerObject*> LLLocalBitmap::prepUpdateObjects(LLUUID old_id, U32 channel)
{
std::vector<LLViewerObject*> obj_list;
LLViewerFetchedTexture* old_texture = gTextureList.findImage(old_id);
-
- for(U32 face_iterator = 0; face_iterator < old_texture->getNumFaces(); face_iterator++)
+
+ for(U32 face_iterator = 0; face_iterator < old_texture->getNumFaces(channel); face_iterator++)
{
// getting an object from a face
- LLFace* face_to_object = (*old_texture->getFaceList())[face_iterator];
+ LLFace* face_to_object = (*old_texture->getFaceList(channel))[face_iterator];
if(face_to_object)
{
@@ -416,9 +423,9 @@ std::vector<LLViewerObject*> LLLocalBitmap::prepUpdateObjects(LLUUID old_id)
return obj_list;
}
-void LLLocalBitmap::updateUserPrims(LLUUID old_id, LLUUID new_id)
+void LLLocalBitmap::updateUserPrims(LLUUID old_id, LLUUID new_id, U32 channel)
{
- std::vector<LLViewerObject*> objectlist = prepUpdateObjects(old_id);
+ std::vector<LLViewerObject*> objectlist = prepUpdateObjects(old_id, channel);
for(std::vector<LLViewerObject*>::iterator object_iterator = objectlist.begin();
object_iterator != objectlist.end(); object_iterator++)
@@ -427,7 +434,8 @@ void LLLocalBitmap::updateUserPrims(LLUUID old_id, LLUUID new_id)
if(object)
{
- bool update_obj = false;
+ bool update_tex = false;
+ bool update_mat = false;
S32 num_faces = object->getNumFaces();
for (U8 face_iter = 0; face_iter < num_faces; face_iter++)
@@ -435,20 +443,51 @@ void LLLocalBitmap::updateUserPrims(LLUUID old_id, LLUUID new_id)
if (object->mDrawable)
{
LLFace* face = object->mDrawable->getFace(face_iter);
- if (face && face->getTexture() && face->getTexture()->getID() == old_id)
+ if (face && face->getTexture(channel) && face->getTexture(channel)->getID() == old_id)
{
- object->setTEImage(face_iter, LLViewerTextureManager::getFetchedTexture
- (new_id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE));
+ // these things differ per channel, unless there already is a universal
+ // texture setting function to setTE that takes channel as a param?
+ // p.s.: switch for now, might become if - if an extra test is needed to verify before touching normalmap/specmap
+ switch(channel)
+ {
+ case LLRender::DIFFUSE_MAP:
+ {
+ object->setTETexture(face_iter, new_id);
+ update_tex = true;
+ break;
+ }
+
+ case LLRender::NORMAL_MAP:
+ {
+ object->setTENormalMap(face_iter, new_id);
+ update_mat = true;
+ update_tex = true;
+ break;
+ }
+
+ case LLRender::SPECULAR_MAP:
+ {
+ object->setTESpecularMap(face_iter, new_id);
+ update_mat = true;
+ update_tex = true;
+ break;
+ }
+ }
+ // end switch
- update_obj = true;
}
}
}
- if (update_obj)
+ if (update_tex)
{
object->sendTEUpdate();
}
+
+ if (update_mat)
+ {
+ object->mDrawable->getVOVolume()->faceMappingChanged();
+ }
}
}
@@ -481,7 +520,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.getViewerWearable(type, wearable_iter);
if (wearable)
{
std::vector<LLLocalTextureObject*> texture_list = wearable->getLocalTextureListSeq();
@@ -493,11 +532,11 @@ void LLLocalBitmap::updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableTyp
if (lto && lto->getID() == old_id)
{
U32 local_texlayer_index = 0; /* can't keep that as static const, gives errors, so i'm leaving this var here */
- LLVOAvatarDefines::EBakedTextureIndex baked_texind =
+ LLAvatarAppearanceDefines::EBakedTextureIndex baked_texind =
lto->getTexLayer(local_texlayer_index)->getTexLayerSet()->getBakedTexIndex();
- LLVOAvatarDefines::ETextureIndex reg_texind = getTexIndex(type, baked_texind);
- if (reg_texind != LLVOAvatarDefines::TEX_NUM_INDICES)
+ LLAvatarAppearanceDefines::ETextureIndex reg_texind = getTexIndex(type, baked_texind);
+ if (reg_texind != LLAvatarAppearanceDefines::TEX_NUM_INDICES)
{
U32 index = gAgentWearables.getWearableIndex(wearable);
gAgentAvatarp->setLocalTexture(reg_texind, gTextureList.getImage(new_id), FALSE, index);
@@ -513,10 +552,10 @@ void LLLocalBitmap::updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableTyp
}
}
-LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
- LLWearableType::EType type, LLVOAvatarDefines::EBakedTextureIndex baked_texind)
+LLAvatarAppearanceDefines::ETextureIndex LLLocalBitmap::getTexIndex(
+ LLWearableType::EType type, LLAvatarAppearanceDefines::EBakedTextureIndex baked_texind)
{
- LLVOAvatarDefines::ETextureIndex result = LLVOAvatarDefines::TEX_NUM_INDICES; // using as a default/fail return.
+ LLAvatarAppearanceDefines::ETextureIndex result = LLAvatarAppearanceDefines::TEX_NUM_INDICES; // using as a default/fail return.
switch(type)
{
@@ -524,32 +563,32 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
{
switch(baked_texind)
{
- case LLVOAvatarDefines::BAKED_EYES:
+ case LLAvatarAppearanceDefines::BAKED_EYES:
{
- result = LLVOAvatarDefines::TEX_EYES_ALPHA;
+ result = LLAvatarAppearanceDefines::TEX_EYES_ALPHA;
break;
}
- case LLVOAvatarDefines::BAKED_HAIR:
+ case LLAvatarAppearanceDefines::BAKED_HAIR:
{
- result = LLVOAvatarDefines::TEX_HAIR_ALPHA;
+ result = LLAvatarAppearanceDefines::TEX_HAIR_ALPHA;
break;
}
- case LLVOAvatarDefines::BAKED_HEAD:
+ case LLAvatarAppearanceDefines::BAKED_HEAD:
{
- result = LLVOAvatarDefines::TEX_HEAD_ALPHA;
+ result = LLAvatarAppearanceDefines::TEX_HEAD_ALPHA;
break;
}
- case LLVOAvatarDefines::BAKED_LOWER:
+ case LLAvatarAppearanceDefines::BAKED_LOWER:
{
- result = LLVOAvatarDefines::TEX_LOWER_ALPHA;
+ result = LLAvatarAppearanceDefines::TEX_LOWER_ALPHA;
break;
}
- case LLVOAvatarDefines::BAKED_UPPER:
+ case LLAvatarAppearanceDefines::BAKED_UPPER:
{
- result = LLVOAvatarDefines::TEX_UPPER_ALPHA;
+ result = LLAvatarAppearanceDefines::TEX_UPPER_ALPHA;
break;
}
@@ -565,9 +604,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
case LLWearableType::WT_EYES:
{
- if (baked_texind == LLVOAvatarDefines::BAKED_EYES)
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_EYES)
{
- result = LLVOAvatarDefines::TEX_EYES_IRIS;
+ result = LLAvatarAppearanceDefines::TEX_EYES_IRIS;
}
break;
@@ -575,9 +614,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
case LLWearableType::WT_GLOVES:
{
- if (baked_texind == LLVOAvatarDefines::BAKED_UPPER)
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_UPPER)
{
- result = LLVOAvatarDefines::TEX_UPPER_GLOVES;
+ result = LLAvatarAppearanceDefines::TEX_UPPER_GLOVES;
}
break;
@@ -585,13 +624,13 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
case LLWearableType::WT_JACKET:
{
- if (baked_texind == LLVOAvatarDefines::BAKED_LOWER)
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER)
{
- result = LLVOAvatarDefines::TEX_LOWER_JACKET;
+ result = LLAvatarAppearanceDefines::TEX_LOWER_JACKET;
}
- else if (baked_texind == LLVOAvatarDefines::BAKED_UPPER)
+ else if (baked_texind == LLAvatarAppearanceDefines::BAKED_UPPER)
{
- result = LLVOAvatarDefines::TEX_UPPER_JACKET;
+ result = LLAvatarAppearanceDefines::TEX_UPPER_JACKET;
}
break;
@@ -599,9 +638,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
case LLWearableType::WT_PANTS:
{
- if (baked_texind == LLVOAvatarDefines::BAKED_LOWER)
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER)
{
- result = LLVOAvatarDefines::TEX_LOWER_PANTS;
+ result = LLAvatarAppearanceDefines::TEX_LOWER_PANTS;
}
break;
@@ -609,9 +648,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
case LLWearableType::WT_SHIRT:
{
- if (baked_texind == LLVOAvatarDefines::BAKED_UPPER)
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_UPPER)
{
- result = LLVOAvatarDefines::TEX_UPPER_SHIRT;
+ result = LLAvatarAppearanceDefines::TEX_UPPER_SHIRT;
}
break;
@@ -619,9 +658,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
case LLWearableType::WT_SHOES:
{
- if (baked_texind == LLVOAvatarDefines::BAKED_LOWER)
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER)
{
- result = LLVOAvatarDefines::TEX_LOWER_SHOES;
+ result = LLAvatarAppearanceDefines::TEX_LOWER_SHOES;
}
break;
@@ -631,20 +670,20 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
{
switch(baked_texind)
{
- case LLVOAvatarDefines::BAKED_HEAD:
+ case LLAvatarAppearanceDefines::BAKED_HEAD:
{
- result = LLVOAvatarDefines::TEX_HEAD_BODYPAINT;
+ result = LLAvatarAppearanceDefines::TEX_HEAD_BODYPAINT;
break;
}
- case LLVOAvatarDefines::BAKED_LOWER:
+ case LLAvatarAppearanceDefines::BAKED_LOWER:
{
- result = LLVOAvatarDefines::TEX_LOWER_BODYPAINT;
+ result = LLAvatarAppearanceDefines::TEX_LOWER_BODYPAINT;
break;
}
- case LLVOAvatarDefines::BAKED_UPPER:
+ case LLAvatarAppearanceDefines::BAKED_UPPER:
{
- result = LLVOAvatarDefines::TEX_UPPER_BODYPAINT;
+ result = LLAvatarAppearanceDefines::TEX_UPPER_BODYPAINT;
break;
}
@@ -659,9 +698,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
case LLWearableType::WT_SKIRT:
{
- if (baked_texind == LLVOAvatarDefines::BAKED_SKIRT)
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_SKIRT)
{
- result = LLVOAvatarDefines::TEX_SKIRT;
+ result = LLAvatarAppearanceDefines::TEX_SKIRT;
}
break;
@@ -669,9 +708,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
case LLWearableType::WT_SOCKS:
{
- if (baked_texind == LLVOAvatarDefines::BAKED_LOWER)
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER)
{
- result = LLVOAvatarDefines::TEX_LOWER_SOCKS;
+ result = LLAvatarAppearanceDefines::TEX_LOWER_SOCKS;
}
break;
@@ -681,20 +720,20 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
{
switch(baked_texind)
{
- case LLVOAvatarDefines::BAKED_HEAD:
+ case LLAvatarAppearanceDefines::BAKED_HEAD:
{
- result = LLVOAvatarDefines::TEX_HEAD_TATTOO;
+ result = LLAvatarAppearanceDefines::TEX_HEAD_TATTOO;
break;
}
- case LLVOAvatarDefines::BAKED_LOWER:
+ case LLAvatarAppearanceDefines::BAKED_LOWER:
{
- result = LLVOAvatarDefines::TEX_LOWER_TATTOO;
+ result = LLAvatarAppearanceDefines::TEX_LOWER_TATTOO;
break;
}
- case LLVOAvatarDefines::BAKED_UPPER:
+ case LLAvatarAppearanceDefines::BAKED_UPPER:
{
- result = LLVOAvatarDefines::TEX_UPPER_TATTOO;
+ result = LLAvatarAppearanceDefines::TEX_UPPER_TATTOO;
break;
}
@@ -709,9 +748,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
case LLWearableType::WT_UNDERPANTS:
{
- if (baked_texind == LLVOAvatarDefines::BAKED_LOWER)
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_LOWER)
{
- result = LLVOAvatarDefines::TEX_LOWER_UNDERPANTS;
+ result = LLAvatarAppearanceDefines::TEX_LOWER_UNDERPANTS;
}
break;
@@ -719,9 +758,9 @@ LLVOAvatarDefines::ETextureIndex LLLocalBitmap::getTexIndex(
case LLWearableType::WT_UNDERSHIRT:
{
- if (baked_texind == LLVOAvatarDefines::BAKED_UPPER)
+ if (baked_texind == LLAvatarAppearanceDefines::BAKED_UPPER)
{
- result = LLVOAvatarDefines::TEX_UPPER_UNDERSHIRT;
+ result = LLAvatarAppearanceDefines::TEX_UPPER_UNDERSHIRT;
}
break;