diff options
Diffstat (limited to 'indra/newview/llviewertexture.cpp')
-rw-r--r-- | indra/newview/llviewertexture.cpp | 67 |
1 files changed, 64 insertions, 3 deletions
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 051e1330d5..d35d2ac2bf 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() { @@ -735,7 +794,7 @@ BOOL LLViewerTexture::createGLTexture(S32 discard_level, const LLImageRaw* image llassert_always(mGLTexturep.notNull()) ; BOOL ret = mGLTexturep->createGLTexture(discard_level, imageraw, usename, to_create, category) ; - + if(ret) { mFullWidth = mGLTexturep->getCurrentWidth() ; @@ -1610,6 +1669,7 @@ void LLViewerFetchedTexture::updateVirtualSize() } mNeedsResetMaxVirtualSize = TRUE ; reorganizeFaceList() ; + reorganizeVolumeList(); } bool LLViewerFetchedTexture::updateFetch() @@ -2557,7 +2617,7 @@ BOOL LLViewerFetchedTexture::insertToAtlas() } //process the waiting_list - for(ll_face_list_t::iterator iter = waiting_list.begin(); iter != waiting_list.end(); ++iter) + for(std::vector<LLFace*>::iterator iter = waiting_list.begin(); iter != waiting_list.end(); ++iter) { facep = (LLFace*)*iter ; groupp = facep->getDrawable()->getSpatialGroup() ; @@ -3264,6 +3324,7 @@ F32 LLViewerMediaTexture::getMaxVirtualSize() mNeedsResetMaxVirtualSize = TRUE ; reorganizeFaceList() ; + reorganizeVolumeList(); return mMaxVirtualSize ; } |