From 35f585ec7a7ca7982fa33eefb383ef3f0316ea5f Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Tue, 25 May 2010 19:30:08 -0400 Subject: EXT-7392 WIP correct implementation of isTextureVisible() This is needed so that we don't duplicate this functionality for EXT-7392. Its late, so will be reviewed tomorrow (but before code is pushed!) --- indra/newview/llvoavatar.cpp | 23 +++++++++++++++++++++++ indra/newview/llvoavatar.h | 14 +++----------- indra/newview/llvoavatarself.cpp | 26 ++++++++++++++++++++++++++ indra/newview/llvoavatarself.h | 3 +++ 4 files changed, 55 insertions(+), 11 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4371396629..76aa2ae0f1 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7887,3 +7887,26 @@ BOOL LLVOAvatar::isTextureDefined(LLVOAvatarDefines::ETextureIndex te, U32 index getImage(te, index)->getID() != IMG_DEFAULT); } +//virtual +BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const +{ + if (isIndexLocalTexture(type)) + { + return isTextureDefined(type, index); + } + else + { + // baked textures can use TE images directly + return ((isTextureDefined(type) || isSelf()) + && (getTEImage(type)->getID() != IMG_INVISIBLE + || LLDrawPoolAlpha::sShowDebugAlpha)); + } +} + +//virtual +BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const +{ + // non-self avatars don't have wearables + return FALSE; +} + diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 86a7cdae02..df47e9ba1d 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -462,7 +462,9 @@ public: //-------------------------------------------------------------------- public: virtual BOOL isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const; - BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex index) const; + virtual BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const; + virtual BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const; + protected: BOOL isFullyBaked(); static BOOL areAllNearbyInstancesBaked(S32& grey_avatars); @@ -1039,14 +1041,4 @@ protected: // Shared with LLVOAvatarSelf }; // LLVOAvatar -//------------------------------------------------------------------------ -// Inlines -//------------------------------------------------------------------------ -inline BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex te) const -{ - return ((isTextureDefined(te) || isSelf()) - && (getTEImage(te)->getID() != IMG_INVISIBLE - || LLDrawPoolAlpha::sShowDebugAlpha)); -} - #endif // LL_VO_AVATAR_H diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index cf3fb01b5a..ebca12dee8 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1332,6 +1332,32 @@ BOOL LLVOAvatarSelf::isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 return isDefined; } +//virtual +BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const +{ + if (isIndexBakedTexture(type)) + { + return LLVOAvatar::isTextureVisible(type,0); + } + + LLUUID tex_id = getLocalTextureID(type,index); + return (tex_id != IMG_INVISIBLE) + || (LLDrawPoolAlpha::sShowDebugAlpha); +} + +//virtual +BOOL LLVOAvatarSelf::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const +{ + if (isIndexBakedTexture(type)) + { + return isTextureVisible(type); + } + + U32 index = gAgentWearables.getWearableIndex(wearable); + return isTextureVisible(type,index); +} + + //----------------------------------------------------------------------------- // requestLayerSetUploads() //----------------------------------------------------------------------------- diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 8e6d9698f2..189c1ac808 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -179,6 +179,9 @@ public: BOOL isLocalTextureDataFinal(const LLTexLayerSet* layerset) const; // If you want to check all textures of a given type, pass gAgentWearables.getWearableCount() for index /*virtual*/ BOOL isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index) const; + /*virtual*/ BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const; + /*virtual*/ BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const; + //-------------------------------------------------------------------- // Local Textures -- cgit v1.2.3