diff options
author | Vadim Savchuk <vsavchuk@productengine.com> | 2010-02-15 13:46:49 +0200 |
---|---|---|
committer | Vadim Savchuk <vsavchuk@productengine.com> | 2010-02-15 13:46:49 +0200 |
commit | 8ba5e0155ff0cbc2355ac4daf468d291fae84afa (patch) | |
tree | 74c8e9a6f9ae76f3fd3414fde4d74f6a824aad0a /indra/newview/llviewertexture.cpp | |
parent | 75a060497c06d0143a0515f4d5665097da34a3e3 (diff) | |
parent | 9fee359d1baf6e0046655cb8e4afabb8774754b1 (diff) |
Merge from default branch
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llviewertexture.cpp')
-rw-r--r-- | indra/newview/llviewertexture.cpp | 72 |
1 files changed, 67 insertions, 5 deletions
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index b66f58d853..28998d409e 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -496,7 +496,9 @@ void LLViewerTexture::init(bool firstinit) mAdditionalDecodePriority = 0.f ; mParcelMedia = NULL ; mNumFaces = 0 ; + mNumVolumes = 0; mFaceList.clear() ; + mVolumeList.clear(); } //virtual @@ -508,7 +510,7 @@ S8 LLViewerTexture::getType() const void LLViewerTexture::cleanup() { mFaceList.clear() ; - + mVolumeList.clear(); if(mGLTexturep) { mGLTexturep->cleanup(); @@ -661,6 +663,42 @@ S32 LLViewerTexture::getNumFaces() const return mNumFaces ; } + +//virtual +void LLViewerTexture::addVolume(LLVOVolume* volumep) +{ + if( mNumVolumes >= mVolumeList.size()) + { + mVolumeList.resize(2 * mNumVolumes + 1) ; + } + mVolumeList[mNumVolumes] = volumep ; + volumep->setIndexInTex(mNumVolumes) ; + mNumVolumes++ ; + mLastVolumeListUpdateTimer.reset() ; +} + +//virtual +void LLViewerTexture::removeVolume(LLVOVolume* volumep) +{ + if(mNumVolumes > 1) + { + S32 index = volumep->getIndexInTex() ; + mVolumeList[index] = mVolumeList[--mNumVolumes] ; + mVolumeList[index]->setIndexInTex(index) ; + } + else + { + mVolumeList.clear() ; + mNumVolumes = 0 ; + } + mLastVolumeListUpdateTimer.reset() ; +} + +S32 LLViewerTexture::getNumVolumes() const +{ + return mNumVolumes ; +} + void LLViewerTexture::reorganizeFaceList() { static const F32 MAX_WAIT_TIME = 20.f; // seconds @@ -680,6 +718,27 @@ void LLViewerTexture::reorganizeFaceList() mFaceList.erase(mFaceList.begin() + mNumFaces, mFaceList.end()); } +void LLViewerTexture::reorganizeVolumeList() +{ + static const F32 MAX_WAIT_TIME = 20.f; // seconds + static const U32 MAX_EXTRA_BUFFER_SIZE = 4 ; + + if(mNumVolumes + MAX_EXTRA_BUFFER_SIZE > mVolumeList.size()) + { + return ; + } + + if(mLastVolumeListUpdateTimer.getElapsedTimeF32() < MAX_WAIT_TIME) + { + return ; + } + + mLastVolumeListUpdateTimer.reset() ; + mVolumeList.erase(mVolumeList.begin() + mNumVolumes, mVolumeList.end()); +} + + + //virtual void LLViewerTexture::switchToCachedImage() { @@ -1610,6 +1669,7 @@ void LLViewerFetchedTexture::updateVirtualSize() } mNeedsResetMaxVirtualSize = TRUE ; reorganizeFaceList() ; + reorganizeVolumeList(); } bool LLViewerFetchedTexture::updateFetch() @@ -2250,13 +2310,13 @@ void LLViewerFetchedTexture::destroyRawImage() if (mRawImage.notNull()) { - sRawCount--; - setCachedRawImage() ; + sRawCount--; if(mForceToSaveRawImage) { saveRawImage() ; } + setCachedRawImage() ; } mRawImage = NULL; @@ -2346,7 +2406,8 @@ void LLViewerFetchedTexture::setCachedRawImage() mRawImage->scale(w >> i, h >> i) ; } mCachedRawImage = mRawImage ; - mCachedRawDiscardLevel = mRawDiscardLevel + i ; + mRawDiscardLevel += i ; + mCachedRawDiscardLevel = mRawDiscardLevel ; } } @@ -2416,7 +2477,7 @@ BOOL LLViewerFetchedTexture::hasSavedRawImage() const F32 LLViewerFetchedTexture::getElapsedLastReferencedSavedRawImageTime() const { - return mLastReferencedSavedRawImageTime - sCurrentTime ; + return sCurrentTime - mLastReferencedSavedRawImageTime ; } //---------------------------------------------------------------------------------------------- //atlasing @@ -3263,6 +3324,7 @@ F32 LLViewerMediaTexture::getMaxVirtualSize() mNeedsResetMaxVirtualSize = TRUE ; reorganizeFaceList() ; + reorganizeVolumeList(); return mMaxVirtualSize ; } |