summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rwxr-xr-xindra/newview/llvoavatar.cpp133
1 files changed, 97 insertions, 36 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 366b6004be..4894f21e67 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -688,12 +688,13 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
mFullyLoaded(FALSE),
mPreviousFullyLoaded(FALSE),
mFullyLoadedInitialized(FALSE),
- mSupportsAlphaLayers(FALSE),
mLoadedCallbacksPaused(FALSE),
mHasPelvisOffset( FALSE ),
mRenderUnloadedAvatar(LLCachedControl<bool>(gSavedSettings, "RenderUnloadedAvatar")),
- mLastRezzedStatus(-1)
-
+ mLastRezzedStatus(-1),
+ mIsEditingAppearance(FALSE),
+ mUseLocalAppearance(FALSE),
+ mUseServerBakes(TRUE)
{
LLMemType mt(LLMemType::MTYPE_AVATAR);
//VTResume(); // VTune
@@ -2381,6 +2382,12 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid)
// to redirect certain avatar texture requests to different sims.
if (isIndexBakedTexture((ETextureIndex)te))
{
+ const std::string url = getImageURL(te,uuid);
+ if (!url.empty())
+ {
+ return setTETextureCore(te, uuid, url);
+ }
+
LLHost target_host = getObjectHost();
return setTETextureCore(te, uuid, target_host);
}
@@ -4149,7 +4156,7 @@ void LLVOAvatar::updateVisibility()
// private
bool LLVOAvatar::shouldAlphaMask()
{
- const bool should_alpha_mask = mSupportsAlphaLayers && !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked
+ const bool should_alpha_mask = !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked
&& !LLDrawPoolAvatar::sSkipTransparent;
return should_alpha_mask;
@@ -4588,6 +4595,7 @@ void LLVOAvatar::updateTextures()
if (isIndexBakedTexture((ETextureIndex)texture_index)
&& imagep->getID() != IMG_DEFAULT_AVATAR
&& imagep->getID() != IMG_INVISIBLE
+ && !mUseServerBakes
&& !imagep->getTargetHost().isOk())
{
LL_WARNS_ONCE("Texture") << "LLVOAvatar::updateTextures No host for texture "
@@ -4682,7 +4690,10 @@ void LLVOAvatar::addBakedTextureStats( LLViewerFetchedTexture* imagep, F32 pixel
//the texture pipeline will stop fetching this texture.
imagep->resetTextureStats();
- imagep->setCanUseHTTP(false) ; //turn off http fetching for baked textures.
+ // TODO: currently default to HTTP texture and fall back to UDP if cannot be found there.
+ // Once server messaging is in place, we should call setCanUseHTTP(false) for old style
+ // appearance requests
+ imagep->setCanUseHTTP(true);
imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL);
imagep->resetMaxVirtualSizeResetCounter() ;
@@ -4724,6 +4735,21 @@ void LLVOAvatar::setTexEntry(const U8 index, const LLTextureEntry &te)
setTE(index, te);
}
+const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid)
+{
+ std::string url = "";
+ if (mUseServerBakes && !gSavedSettings.getString("AgentAppearanceServiceURL").empty())
+ {
+ const LLVOAvatarDictionary::TextureEntry* texture_entry = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)te);
+ if (texture_entry != NULL)
+ {
+ url = gSavedSettings.getString("AgentAppearanceServiceURL") + "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString();
+ //llinfos << "baked texture url: " << url << llendl;
+ }
+ }
+ return url;
+}
+
//-----------------------------------------------------------------------------
// resolveHeight()
//-----------------------------------------------------------------------------
@@ -6669,7 +6695,6 @@ void LLVOAvatar::updateMeshTextures()
}
}
- const BOOL self_customizing = isSelf() && gAgentCamera.cameraCustomizeAvatar(); // During face edit mode, we don't use baked textures
const BOOL other_culled = !isSelf() && mCulled;
LLLoadedCallbackEntry::source_callback_list_t* src_callback_list = NULL ;
BOOL paused = FALSE;
@@ -6709,36 +6734,39 @@ void LLVOAvatar::updateMeshTextures()
{
use_lkg_baked_layer[i] = (!is_layer_baked[i]
&& mBakedTextureDatas[i].mLastTextureIndex != IMG_DEFAULT_AVATAR);
- if (mBakedTextureDatas[i].mTexLayerSet)
- {
- mBakedTextureDatas[i].mTexLayerSet->destroyComposite();
- }
}
}
-
- // Turn on alpha masking correctly for yourself and other avatars on 1.23+
- mSupportsAlphaLayers = isSelf() || is_layer_baked[BAKED_HAIR];
-
- // Baked textures should be requested from the sim this avatar is on. JC
- const LLHost target_host = getObjectHost();
- if (!target_host.isOk())
- {
- llwarns << "updateMeshTextures: invalid host for object: " << getID() << llendl;
- }
for (U32 i=0; i < mBakedTextureDatas.size(); i++)
{
- if (use_lkg_baked_layer[i] && !self_customizing )
+ if (use_lkg_baked_layer[i] && !mUseLocalAppearance )
{
- LLViewerFetchedTexture* baked_img = LLViewerTextureManager::getFetchedTextureFromHost( mBakedTextureDatas[i].mLastTextureIndex, target_host );
+ LLViewerFetchedTexture* baked_img;
+ const std::string url = getImageURL(i, mBakedTextureDatas[i].mLastTextureIndex);
+ if (!url.empty())
+ {
+ baked_img = LLViewerTextureManager::getFetchedTextureFromUrl(url, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, mBakedTextureDatas[i].mLastTextureIndex);
+ }
+ else
+ {
+ // Baked textures should be requested from the sim this avatar is on. JC
+ const LLHost target_host = getObjectHost();
+ if (!target_host.isOk())
+ {
+ llwarns << "updateMeshTextures: invalid host for object: " << getID() << llendl;
+ }
+
+ baked_img = LLViewerTextureManager::getFetchedTextureFromHost( mBakedTextureDatas[i].mLastTextureIndex, target_host );
+ }
+
mBakedTextureDatas[i].mIsUsed = TRUE;
for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++)
{
mBakedTextureDatas[i].mMeshes[k]->setTexture( baked_img );
}
}
- else if (!self_customizing && is_layer_baked[i])
+ else if (!mUseLocalAppearance && is_layer_baked[i])
{
LLViewerFetchedTexture* baked_img = LLViewerTextureManager::staticCastToFetchedTexture(getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ;
if( baked_img->getID() == mBakedTextureDatas[i].mLastTextureIndex )
@@ -6758,8 +6786,7 @@ void LLVOAvatar::updateMeshTextures()
src_callback_list, paused );
}
}
- else if (mBakedTextureDatas[i].mTexLayerSet
- && !other_culled)
+ else if (mBakedTextureDatas[i].mTexLayerSet && mUseLocalAppearance)
{
mBakedTextureDatas[i].mTexLayerSet->createComposite();
mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled( TRUE );
@@ -6774,7 +6801,7 @@ void LLVOAvatar::updateMeshTextures()
// set texture and color of hair manually if we are not using a baked image.
// This can happen while loading hair for yourself, or for clients that did not
// bake a hair texture. Still needed for yourself after 1.22 is depricated.
- if (!is_layer_baked[BAKED_HAIR] || self_customizing)
+ if (!is_layer_baked[BAKED_HAIR] || mIsEditingAppearance)
{
const LLColor4 color = mTexHairColor ? mTexHairColor->getColor() : LLColor4(1,1,1,1);
LLViewerTexture* hair_img = getImage( TEX_HAIR, 0 );
@@ -7309,7 +7336,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
if( isSelf() )
{
llwarns << avString() << "Received AvatarAppearance for self" << llendl;
- if( mFirstTEMessageReceived )
+ if( mFirstTEMessageReceived && !mUseServerBakes)
{
// llinfos << "processAvatarAppearance end " << mID << llendl;
return;
@@ -7320,9 +7347,44 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
// llinfos << "LLVOAvatar::processAvatarAppearance()" << llendl;
// dumpAvatarTEs( "PRE processAvatarAppearance()" );
- unpackTEMessage(mesgsys, _PREHASH_ObjectData);
+ LLTEContents tec;
+ parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, tec);
// dumpAvatarTEs( "POST processAvatarAppearance()" );
+ U8 appearance_version = 0;
+ S32 this_update_cof_version = LLViewerInventoryCategory::VERSION_UNKNOWN;
+ S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion;
+ // For future use:
+ //U32 appearance_flags = 0;
+
+ if (mesgsys->has(_PREHASH_AppearanceData))
+ {
+ mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, appearance_version, 0);
+ mesgsys->getS32Fast(_PREHASH_AppearanceData, _PREHASH_CofVersion, this_update_cof_version, 0);
+ // For future use:
+ //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0);
+ }
+
+ if (appearance_version > 0)
+ {
+ mUseServerBakes = true;
+ }
+ else
+ {
+ mUseServerBakes = false;
+ }
+
+ // Check for stale update.
+ if (mUseServerBakes && isSelf()
+ && this_update_cof_version >= LLViewerInventoryCategory::VERSION_INITIAL
+ && this_update_cof_version < last_update_request_cof_version)
+ {
+ llwarns << "Stale appearance update, wanted version " << last_update_request_cof_version
+ << ", got " << this_update_cof_version << llendl;
+ return;
+ }
+ applyParsedTEMessage(tec);
+
// prevent the overwriting of valid baked textures with invalid baked textures
for (U8 baked_index = 0; baked_index < mBakedTextureDatas.size(); baked_index++)
{
@@ -7345,16 +7407,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
}
setCompositeUpdatesEnabled( FALSE );
- mMeshTexturesDirty = TRUE;
gPipeline.markGLRebuild(this);
- // ! BACKWARDS COMPATIBILITY !
- // Non-self avatars will no longer have component textures
- if (!isSelf())
- {
- releaseComponentTextures();
- }
-
// parse visual params
S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam);
bool drop_visual_params_debug = gSavedSettings.getBOOL("BlockSomeAvatarAppearanceVisualParams") && (ll_rand(2) == 0); // pretend that ~12% of AvatarAppearance messages arrived without a VisualParam block, for testing
@@ -7464,6 +7518,13 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
// If all of the avatars are completely baked, release the global image caches to conserve memory.
LLVOAvatar::cullAvatarsByPixelArea();
+ if (isSelf())
+ {
+ mUseLocalAppearance = false;
+ }
+
+ updateMeshTextures();
+
// llinfos << "processAvatarAppearance end " << mID << llendl;
}