aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llvoavatar.cpp
diff options
context:
space:
mode:
authorArmin Weatherwax2010-03-09 23:00:38 +0100
committerJacek Antonelli2010-06-19 02:43:01 -0500
commit523e0e2dff6af1c5bc12e2aefc0ca9b96bf26fd6 (patch)
treeefc2b1bf0b7ca57b4fcc5e64da555907437a408d /linden/indra/newview/llvoavatar.cpp
parentApplied patch by Kirstenlee Cinquetti for SNOW-493: LLDataPackerBinaryBuffer:... (diff)
downloadmeta-impy-523e0e2dff6af1c5bc12e2aefc0ca9b96bf26fd6.zip
meta-impy-523e0e2dff6af1c5bc12e2aefc0ca9b96bf26fd6.tar.gz
meta-impy-523e0e2dff6af1c5bc12e2aefc0ca9b96bf26fd6.tar.bz2
meta-impy-523e0e2dff6af1c5bc12e2aefc0ca9b96bf26fd6.tar.xz
Henri Beauchamp: Port of SG-2.0 alpha and tattoo layers (v6)
slviewer-0-v12350-AlphaAndTattooSupport-patch.zip contains the necessary avatar_lad.xml and other artwork. The new avatar_lad.xml crashes clients without alpha and tattoo support at startup.
Diffstat (limited to 'linden/indra/newview/llvoavatar.cpp')
-rw-r--r--linden/indra/newview/llvoavatar.cpp73
1 files changed, 41 insertions, 32 deletions
diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp
index bcc8472..7c867d2 100644
--- a/linden/indra/newview/llvoavatar.cpp
+++ b/linden/indra/newview/llvoavatar.cpp
@@ -767,6 +767,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
767 mFullyLoadedInitialized(FALSE), 767 mFullyLoadedInitialized(FALSE),
768 mFullyLoaded(FALSE), 768 mFullyLoaded(FALSE),
769 mHasBakedHair( FALSE ), 769 mHasBakedHair( FALSE ),
770 mSupportsAlphaLayers(FALSE),
770 mFirstSetActualBoobGravRan( false ), 771 mFirstSetActualBoobGravRan( false ),
771 mFirstSetActualButtGravRan( false ), 772 mFirstSetActualButtGravRan( false ),
772 mFirstSetActualFatGravRan( false ) 773 mFirstSetActualFatGravRan( false )
@@ -4706,14 +4707,9 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
4706 4707
4707 if (pass == AVATAR_RENDER_PASS_SINGLE) 4708 if (pass == AVATAR_RENDER_PASS_SINGLE)
4708 { 4709 {
4709 const bool should_alpha_mask = mHasBakedHair && isTextureDefined(TEX_HEAD_BAKED) && isTextureDefined(TEX_UPPER_BAKED) 4710 const bool should_alpha_mask = mSupportsAlphaLayers && mHasBakedHair
4710 && isTextureDefined(TEX_LOWER_BAKED) 4711 && !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked
4711 && mBakedTextureData[BAKED_HEAD].mIsLoaded 4712 && !LLDrawPoolAvatar::sSkipTransparent;
4712 && mBakedTextureData[BAKED_UPPER].mIsLoaded && mBakedTextureData[BAKED_LOWER].mIsLoaded
4713 && mBakedTextureData[BAKED_HEAD].mIsUsed
4714 && mBakedTextureData[BAKED_UPPER].mIsUsed && mBakedTextureData[BAKED_LOWER].mIsUsed
4715 && !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked
4716 && !(isSelf() && gAgent.cameraCustomizeAvatar()); // don't alpha mask if in customize mode
4717 4713
4718 LLGLState test(GL_ALPHA_TEST, should_alpha_mask); 4714 LLGLState test(GL_ALPHA_TEST, should_alpha_mask);
4719 4715
@@ -4826,27 +4822,25 @@ U32 LLVOAvatar::renderRigid()
4826 return 0; 4822 return 0;
4827 } 4823 }
4828 4824
4829 if (isTextureVisible(TEX_EYES_BAKED) || mIsDummy) 4825 const bool should_alpha_mask = mSupportsAlphaLayers && mHasBakedHair
4830 { 4826 && !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked
4831 // If the meshes need to be drawn, enable alpha masking but not blending 4827 && !LLDrawPoolAvatar::sSkipTransparent;
4832 bool should_alpha_mask = mHasBakedHair
4833 && mBakedTextureData[BAKED_EYES].mIsLoaded
4834 && mBakedTextureData[BAKED_EYES].mIsUsed
4835 && !(isSelf() && gAgent.cameraCustomizeAvatar());
4836 4828
4837 LLGLState test(GL_ALPHA_TEST, should_alpha_mask);
4838 4829
4839 if (should_alpha_mask) 4830 LLGLState test(GL_ALPHA_TEST, should_alpha_mask);
4840 {
4841 gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
4842 }
4843 4831
4832 if (should_alpha_mask)
4833 {
4834 gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
4835 }
4836
4837 if (isTextureVisible(TEX_EYES_BAKED) || mIsDummy)
4838 {
4844 num_indices += mMeshLOD[MESH_ID_EYEBALL_LEFT]->render(mAdjustedPixelArea, TRUE, mIsDummy); 4839 num_indices += mMeshLOD[MESH_ID_EYEBALL_LEFT]->render(mAdjustedPixelArea, TRUE, mIsDummy);
4845 num_indices += mMeshLOD[MESH_ID_EYEBALL_RIGHT]->render(mAdjustedPixelArea, TRUE, mIsDummy); 4840 num_indices += mMeshLOD[MESH_ID_EYEBALL_RIGHT]->render(mAdjustedPixelArea, TRUE, mIsDummy);
4846
4847 gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
4848 } 4841 }
4849 4842
4843 gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
4850 return num_indices; 4844 return num_indices;
4851} 4845}
4852 4846
@@ -5019,6 +5013,7 @@ void LLVOAvatar::updateTextures()
5019 // Spam if this is a baked texture, not set to default image, without valid host info 5013 // Spam if this is a baked texture, not set to default image, without valid host info
5020 if (isIndexBakedTexture((ETextureIndex)index) 5014 if (isIndexBakedTexture((ETextureIndex)index)
5021 && imagep->getID() != IMG_DEFAULT_AVATAR 5015 && imagep->getID() != IMG_DEFAULT_AVATAR
5016 && imagep->getID() != IMG_INVISIBLE
5022 && !imagep->getTargetHost().isOk()) 5017 && !imagep->getTargetHost().isOk())
5023 { 5018 {
5024 LL_WARNS_ONCE("Texture") << "LLVOAvatar::updateTextures No host for texture " 5019 LL_WARNS_ONCE("Texture") << "LLVOAvatar::updateTextures No host for texture "
@@ -5829,6 +5824,7 @@ BOOL LLVOAvatar::loadAvatar()
5829 if (layer_set->isBodyRegion(baked_dict->mName)) 5824 if (layer_set->isBodyRegion(baked_dict->mName))
5830 { 5825 {
5831 mBakedTextureData[baked_iter->first].mTexLayerSet = layer_set; 5826 mBakedTextureData[baked_iter->first].mTexLayerSet = layer_set;
5827 layer_set->setBakedTexIndex(baked_iter->first);
5832 found_baked_entry = true; 5828 found_baked_entry = true;
5833 break; 5829 break;
5834 } 5830 }
@@ -7525,6 +7521,9 @@ void LLVOAvatar::updateMeshTextures()
7525 7521
7526 } 7522 }
7527 7523
7524 // Turn on alpha masking correctly for yourself and other avatars on 1.23+
7525 mSupportsAlphaLayers = isSelf() || is_layer_baked[BAKED_HAIR];
7526
7528 // Baked textures should be requested from the sim this avatar is on. JC 7527 // Baked textures should be requested from the sim this avatar is on. JC
7529 const LLHost target_host = getObjectHost(); 7528 const LLHost target_host = getObjectHost();
7530 if (!target_host.isOk()) 7529 if (!target_host.isOk())
@@ -7554,7 +7553,7 @@ void LLVOAvatar::updateMeshTextures()
7554 else 7553 else
7555 { 7554 {
7556 mBakedTextureData[i].mIsLoaded = FALSE; 7555 mBakedTextureData[i].mIsLoaded = FALSE;
7557 if ( (i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER) ) 7556 if ((baked_img->getID() != IMG_INVISIBLE) && (i == BAKED_HEAD || i == BAKED_UPPER || i == BAKED_LOWER))
7558 { 7557 {
7559 baked_img->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID )); 7558 baked_img->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ));
7560 } 7559 }
@@ -7826,7 +7825,13 @@ void LLVOAvatar::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid )
7826 // Baked textures live on other sims. 7825 // Baked textures live on other sims.
7827 LLHost target_host = getObjectHost(); 7826 LLHost target_host = getObjectHost();
7828 setTEImage( te, gImageList.getImageFromHost( uuid, target_host ) ); 7827 setTEImage( te, gImageList.getImageFromHost( uuid, target_host ) );
7829 updateMeshTextures(); 7828 if (uuid != IMG_INVISIBLE)
7829 {
7830 // Do not update textures when setting a new invisible baked texture as
7831 // it would result in destroying the calling object (setNewBakedTexture()
7832 // is called by LLTexLayerSetBuffer::render()) !
7833 updateMeshTextures();
7834 }
7830 dirtyMesh(); 7835 dirtyMesh();
7831 7836
7832 7837
@@ -7839,7 +7844,7 @@ void LLVOAvatar::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid )
7839 if (text_dict->mIsBakedTexture) 7844 if (text_dict->mIsBakedTexture)
7840 { 7845 {
7841 llinfos << "New baked texture: " << text_dict->mName << " UUID: " << uuid <<llendl; 7846 llinfos << "New baked texture: " << text_dict->mName << " UUID: " << uuid <<llendl;
7842 mBakedTextureData[text_dict->mBakedTextureIndex].mTexLayerSet->requestUpdate(); 7847 //mBakedTextureData[text_dict->mBakedTextureIndex].mTexLayerSet->requestUpdate();
7843 } 7848 }
7844 else 7849 else
7845 { 7850 {
@@ -8087,6 +8092,10 @@ void LLVOAvatar::dumpAvatarTEs( const std::string& context )
8087 { 8092 {
8088 llinfos << " " << text_dict->mName << ": IMG_DEFAULT" << llendl; 8093 llinfos << " " << text_dict->mName << ": IMG_DEFAULT" << llendl;
8089 } 8094 }
8095 else if (te_image->getID() == IMG_INVISIBLE)
8096 {
8097 llinfos << " " << text_dict->mName << ": IMG_INVISIBLE" << llendl;
8098 }
8090 else if( te_image->getID() == IMG_DEFAULT_AVATAR ) 8099 else if( te_image->getID() == IMG_DEFAULT_AVATAR )
8091 { 8100 {
8092 llinfos << " " << text_dict->mName << ": IMG_DEFAULT_AVATAR" << llendl; 8101 llinfos << " " << text_dict->mName << ": IMG_DEFAULT_AVATAR" << llendl;
@@ -8258,11 +8267,11 @@ BOOL LLVOAvatar::isWearingWearableType( EWearableType type )
8258} 8267}
8259 8268
8260//----------------------------------------------------------------------------- 8269//-----------------------------------------------------------------------------
8261// updatedWearable( EWearableType type ) 8270// wearableUpdated(EWearableType type, BOOL upload_result)
8262// forces an update to any baked textures relevant to type. 8271// forces an update to any baked textures relevant to type.
8263// Should be called only on saving the wearable 8272// will force an upload of the resulting bake if the second parameter is TRUE
8264//----------------------------------------------------------------------------- 8273//-----------------------------------------------------------------------------
8265void LLVOAvatar::wearableUpdated( EWearableType type ) 8274void LLVOAvatar::wearableUpdated(EWearableType type, BOOL upload_result)
8266{ 8275{
8267 for (LLVOAvatarDictionary::wearable_map_t::const_iterator wearable_iter = LLVOAvatarDictionary::getInstance()->getWearables().begin(); 8276 for (LLVOAvatarDictionary::wearable_map_t::const_iterator wearable_iter = LLVOAvatarDictionary::getInstance()->getWearables().begin();
8268 wearable_iter != LLVOAvatarDictionary::getInstance()->getWearables().end(); 8277 wearable_iter != LLVOAvatarDictionary::getInstance()->getWearables().end();
@@ -8281,8 +8290,8 @@ void LLVOAvatar::wearableUpdated( EWearableType type )
8281 { 8290 {
8282 if (mBakedTextureData[index].mTexLayerSet) 8291 if (mBakedTextureData[index].mTexLayerSet)
8283 { 8292 {
8284 mBakedTextureData[index].mTexLayerSet->requestUpdate(); 8293 invalidateComposite(mBakedTextureData[index].mTexLayerSet, upload_result);
8285 mBakedTextureData[index].mTexLayerSet->requestUpload(); 8294 updateMeshTextures();
8286 } 8295 }
8287 break; 8296 break;
8288 } 8297 }
@@ -8381,7 +8390,7 @@ void LLVOAvatar::onFirstTEMessageReceived()
8381 LLViewerImage* image = getTEImage( mBakedTextureData[i].mTextureIndex ); 8390 LLViewerImage* image = getTEImage( mBakedTextureData[i].mTextureIndex );
8382 mBakedTextureData[i].mLastTextureIndex = image->getID(); 8391 mBakedTextureData[i].mLastTextureIndex = image->getID();
8383 // If we have more than one texture for the other baked layers, we'll want to call this for them too. 8392 // If we have more than one texture for the other baked layers, we'll want to call this for them too.
8384 if ( (i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER) ) 8393 if ((image->getID() != IMG_INVISIBLE) && (i == BAKED_HEAD || i == BAKED_UPPER || i == BAKED_LOWER))
8385 { 8394 {
8386 image->setLoadedCallback( onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID )); 8395 image->setLoadedCallback( onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ));
8387 } 8396 }
@@ -8653,7 +8662,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerImage *src_vi,
8653 { 8662 {
8654 const ETextureIndex texture_index = iter->first; 8663 const ETextureIndex texture_index = iter->first;
8655 const LLViewerImage *baked_img = self->getTEImage(texture_index); 8664 const LLViewerImage *baked_img = self->getTEImage(texture_index);
8656 if (id == baked_img->getID()) 8665 if (baked_img && id == baked_img->getID())
8657 { 8666 {
8658 const EBakedTextureIndex baked_index = text_dict->mBakedTextureIndex; 8667 const EBakedTextureIndex baked_index = text_dict->mBakedTextureIndex;
8659 if (self->mBakedTextureData[baked_index].mTexLayerSet) 8668 if (self->mBakedTextureData[baked_index].mTexLayerSet)