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!)
master
Nyx (Neal Orman) 2010-05-25 19:30:08 -04:00
parent 61dfb969ea
commit 35f585ec7a
4 changed files with 55 additions and 11 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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()
//-----------------------------------------------------------------------------

View File

@ -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