diff options
author | Kent Quirk <q@lindenlab.com> | 2010-07-30 10:11:55 -0400 |
---|---|---|
committer | Kent Quirk <q@lindenlab.com> | 2010-07-30 10:11:55 -0400 |
commit | 19c0d6d4eaf21cbfc96d7057c11db35edf73f2fe (patch) | |
tree | 21984bc2d7a41ba2587a424499f97d3e6d527da4 /indra/newview/llvoavatar.cpp | |
parent | fe8a5a007ab82f3d6a763c5cb133e1299d238632 (diff) | |
parent | 7a4174447a0762dcab2769d1401295b78c9341fd (diff) |
Merge from q/viewer-release to dessie/viewer-release for 2.1.1 beta 1
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rw-r--r-- | indra/newview/llvoavatar.cpp | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 47e35ca0c4..32723dfe3d 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -835,6 +835,7 @@ LLVOAvatar::~LLVOAvatar() mDead = TRUE; mAnimationSources.clear(); + LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList) ; lldebugs << "LLVOAvatar Destructor end" << llendl; } @@ -848,7 +849,7 @@ void LLVOAvatar::markDead() sNumVisibleChatBubbles--; } mVoiceVisualizer->markDead(); - LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList, this) ; + LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList) ; LLViewerObject::markDead(); } @@ -4142,9 +4143,13 @@ void LLVOAvatar::updateTextures() } else { - render_avatar = isVisible() && !mCulled; + if(!isVisible()) + { + return ;//do not update for invisible avatar. + } + + render_avatar = !mCulled; //visible and not culled. } - checkTextureLoading() ; std::vector<BOOL> layer_baked; // GL NOT ACTIVE HERE - *TODO @@ -4224,10 +4229,11 @@ void LLVOAvatar::addLocalTextureStats( ETextureIndex idx, LLViewerFetchedTexture return; } - +const S32 MAX_TEXTURE_UPDATE_INTERVAL = 64 ; //need to call updateTextures() at least every 32 frames. +const S32 MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL = S32_MAX ; //frames void LLVOAvatar::checkTextureLoading() { - static const F32 MAX_INVISIBLE_WAITING_TIME = 30.f ; //seconds + static const F32 MAX_INVISIBLE_WAITING_TIME = 15.f ; //seconds BOOL pause = !isVisible() ; if(!pause) @@ -4247,7 +4253,7 @@ void LLVOAvatar::checkTextureLoading() if(pause && mInvisibleTimer.getElapsedTimeF32() < MAX_INVISIBLE_WAITING_TIME) { - return ; + return ; //have not been invisible for enough time. } for(LLLoadedCallbackEntry::source_callback_list_t::iterator iter = mCallbackTextureList.begin(); @@ -4258,30 +4264,40 @@ void LLVOAvatar::checkTextureLoading() { if(pause)//pause texture fetching. { - tex->pauseLoadedCallbacks(this) ; + tex->pauseLoadedCallbacks(&mCallbackTextureList) ; + + //set to terminate texture fetching after MAX_TEXTURE_UPDATE_INTERVAL frames. + tex->setMaxVirtualSizeResetInterval(MAX_TEXTURE_UPDATE_INTERVAL); + tex->resetMaxVirtualSizeResetCounter() ; } else//unpause { static const F32 START_AREA = 100.f ; - tex->unpauseLoadedCallbacks(this) ; + tex->unpauseLoadedCallbacks(&mCallbackTextureList) ; tex->addTextureStats(START_AREA); //jump start the fetching again } } } + if(!pause) + { + updateTextures() ; //refresh texture stats. + } mLoadedCallbacksPaused = pause ; return ; } void LLVOAvatar::addBakedTextureStats( LLViewerFetchedTexture* imagep, F32 pixel_area, F32 texel_area_ratio, S32 boost_level) { - //if this function is not called for the last 512 frames, the texture pipeline will stop fetching this texture. - static const S32 MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL = 512 ; //frames + //Note: + //if this function is not called for the last MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL frames, + //the texture pipeline will stop fetching this texture. imagep->resetTextureStats(); imagep->setCanUseHTTP(false) ; //turn off http fetching for baked textures. imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); + imagep->resetMaxVirtualSizeResetCounter() ; mMaxPixelArea = llmax(pixel_area, mMaxPixelArea); mMinPixelArea = llmin(pixel_area, mMinPixelArea); @@ -6206,11 +6222,9 @@ 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 ; - void* callback_src = NULL ; BOOL paused = FALSE; if(!isSelf()) { - callback_src = this ; src_callback_list = &mCallbackTextureList ; paused = mLoadedCallbacksPaused ; } @@ -6286,10 +6300,10 @@ void LLVOAvatar::updateMeshTextures() if ( (baked_img->getID() != IMG_INVISIBLE) && ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) ) { baked_img->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ), - callback_src, src_callback_list, paused); + src_callback_list, paused); } baked_img->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ), - callback_src, src_callback_list, paused ); + src_callback_list, paused ); } } else if (mBakedTextureDatas[i].mTexLayerSet @@ -6750,11 +6764,9 @@ void LLVOAvatar::onFirstTEMessageReceived() mFirstTEMessageReceived = TRUE; LLLoadedCallbackEntry::source_callback_list_t* src_callback_list = NULL ; - void* callback_src = NULL ; BOOL paused = FALSE ; if(!isSelf()) { - callback_src = this ; src_callback_list = &mCallbackTextureList ; paused = mLoadedCallbacksPaused ; } @@ -6773,10 +6785,10 @@ void LLVOAvatar::onFirstTEMessageReceived() if ( (image->getID() != IMG_INVISIBLE) && ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) ) { image->setLoadedCallback( onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ), - callback_src, src_callback_list, paused); + src_callback_list, paused); } image->setLoadedCallback( onInitialBakedTextureLoaded, MAX_DISCARD_LEVEL, FALSE, FALSE, new LLUUID( mID ), - callback_src, src_callback_list, paused ); + src_callback_list, paused ); } } |