diff options
Diffstat (limited to 'indra/newview/lllocalbitmaps.cpp')
-rwxr-xr-x[-rw-r--r--] | indra/newview/lllocalbitmaps.cpp | 175 |
1 files changed, 106 insertions, 69 deletions
diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index 459e52c4f4..2d9385390b 100644..100755 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -32,9 +32,7 @@ #include "lllocalbitmaps.h" /* boost: will not compile unless equivalent is undef'd, beware. */ -#ifdef equivalent -#undef equivalent -#endif +#include "fix_macros.h" #include <boost/filesystem.hpp> /* image compression headers. */ @@ -55,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. */ @@ -197,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); @@ -341,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 @@ -369,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) { @@ -418,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++) @@ -429,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++) @@ -437,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(); + } } } @@ -483,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(); @@ -495,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); @@ -515,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) { @@ -526,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; } @@ -567,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; @@ -577,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; @@ -587,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; @@ -601,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; @@ -611,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; @@ -621,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; @@ -633,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; } @@ -661,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; @@ -671,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; @@ -683,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; } @@ -711,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; @@ -721,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; |