diff options
-rw-r--r-- | indra/newview/llface.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llface.h | 2 | ||||
-rw-r--r-- | indra/newview/llflexibleobject.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewertexture.cpp | 57 | ||||
-rw-r--r-- | indra/newview/llviewertexture.h | 6 |
5 files changed, 60 insertions, 17 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 09b3ce1e86..0276cd9a24 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -278,6 +278,16 @@ void LLFace::setTexture(LLViewerTexture* tex) } mTexture = tex ; + + //check if this texture is replaced by a parcel media texture. + if(mTexture.notNull() && mTexture->hasParcelMedia()) + { + LLViewerMediaTexture* mediap = LLViewerTextureManager::findMediaTexture(mTexture->getID()) ; + if(mediap) + { + mediap->addMediaToFace(this) ; + } + } } void LLFace::dirtyTexture() diff --git a/indra/newview/llface.h b/indra/newview/llface.h index d734b327d9..2b134c8c31 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -246,7 +246,7 @@ protected: //atlas LLPointer<LLTextureAtlasSlot> mAtlasInfop ; - BOOL mUsingAtlas ; + BOOL mUsingAtlas ; protected: static BOOL sSafeRenderSelect; diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index 216bca8262..fc8790c172 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -704,7 +704,7 @@ BOOL LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable) } if (volume->mLODChanged || volume->mFaceMappingChanged || - volume->mVolumeChanged) + volume->mVolumeChanged || drawable->isState(LLDrawable::REBUILD_MATERIAL)) { volume->regenFaces(); volume->mDrawable->setState(LLDrawable::REBUILD_VOLUME); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 2368a2da33..28ef128265 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -416,6 +416,7 @@ void LLViewerTexture::init(bool firstinit) mDontDiscard = FALSE; mMaxVirtualSize = 0.f; mNeedsResetMaxVirtualSize = FALSE ; + mHasParcelMedia = FALSE ; } //virtual @@ -2150,19 +2151,20 @@ void LLViewerMediaTexture::updateClass() for(media_map_t::iterator iter = sMediaMap.begin() ; iter != sMediaMap.end(); ) { LLViewerMediaTexture* mediap = iter->second; - - // - //Note: delay some time to delete the media textures to stop endlessly creating and immediately removing media texture. - // - if(mediap->getNumRefs() == 1 && mediap->getLastReferencedTimer()->getElapsedTimeF32() > MAX_INACTIVE_TIME) //one by sMediaMap - { - media_map_t::iterator cur = iter++ ; - sMediaMap.erase(cur) ; - } - else + + if(mediap->getNumRefs() == 1) //one reference by sMediaMap { - ++iter ; + // + //Note: delay some time to delete the media textures to stop endlessly creating and immediately removing media texture. + // + if(mediap->getLastReferencedTimer()->getElapsedTimeF32() > MAX_INACTIVE_TIME) + { + media_map_t::iterator cur = iter++ ; + sMediaMap.erase(cur) ; + continue ; + } } + ++iter ; } } @@ -2215,11 +2217,22 @@ LLViewerMediaTexture::LLViewerMediaTexture(const LLUUID& id, BOOL usemipmaps, LL mIsPlaying = FALSE ; setMediaImpl() ; + + LLViewerTexture* tex = gTextureList.findImage(mID) ; + if(tex) //this media is a parcel media for tex. + { + tex->setParcelMedia(TRUE) ; + mParcelTexture = tex ; + } } //virtual LLViewerMediaTexture::~LLViewerMediaTexture() { + if(mParcelTexture.notNull()) + { + mParcelTexture->setParcelMedia(FALSE) ; + } } void LLViewerMediaTexture::reinit(BOOL usemipmaps /* = TRUE */) @@ -2272,10 +2285,19 @@ BOOL LLViewerMediaTexture::findFaces() BOOL ret = TRUE ; //for parcel media - LLViewerTexture* tex = gTextureList.findImage(mID) ; - if(tex) + if(mParcelTexture.isNull()) { - const ll_face_list_t* face_list = tex->getFaceList() ; + LLViewerTexture* tex = gTextureList.findImage(mID) ; + if(tex) + { + tex->setParcelMedia(TRUE) ; + mParcelTexture = tex ; + } + } + + if(mParcelTexture.notNull()) + { + const ll_face_list_t* face_list = mParcelTexture->getFaceList() ; for(ll_face_list_t::const_iterator iter = face_list->begin(); iter != face_list->end(); ++iter) { mMediaFaceList.push_back(*iter) ; @@ -2382,9 +2404,14 @@ void LLViewerMediaTexture::addFace(LLFace* facep) if(facep->getTexture() && facep->getTexture() != this && facep->getTexture()->getID() == mID) { mTextureList.push_back(facep->getTexture()) ; //a parcel media. + if(mParcelTexture.isNull()) + { + mParcelTexture = facep->getTexture() ; + mParcelTexture->setParcelMedia(TRUE) ; + } return ; } - + llerrs << "The face does not have a valid texture before media texture." << llendl ; } diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index ef298319d2..ce8c47b878 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -221,6 +221,9 @@ public: BOOL getDontDiscard() const { return mDontDiscard; } //----------------- + void setParcelMedia(BOOL has_media) {mHasParcelMedia = has_media;} + BOOL hasParcelMedia() const { return mHasParcelMedia ;} + /*virtual*/ void updateBindStatsForTester() ; protected: void cleanup() ; @@ -247,6 +250,8 @@ protected: LLPointer<LLImageGL> mGLTexturep ; S8 mDontDiscard; // Keep full res version of this image (for UI, etc) + BOOL mHasParcelMedia ; + protected: typedef enum { @@ -547,6 +552,7 @@ private: LLViewerMediaImpl* mMediaImplp ; BOOL mIsPlaying ; U32 mUpdateVirtualSizeTime ; + LLPointer< LLViewerTexture > mParcelTexture ; //the texture replaces this media texure when it is a parcel media texture. public: static void updateClass() ; |