diff options
-rw-r--r-- | indra/newview/llviewertexturelist.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llvograss.cpp | 56 | ||||
-rw-r--r-- | indra/newview/llvotree.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llvotree.h | 1 |
4 files changed, 71 insertions, 7 deletions
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index b3aff30324..f2a3839f97 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -1402,12 +1402,17 @@ LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const st mUIImages.insert(std::make_pair(name, new_imagep)); mUITextureList.push_back(imagep); - LLUIImageLoadData* datap = new LLUIImageLoadData; - datap->mImageName = name; - datap->mImageScaleRegion = scale_rect; - - imagep->setLoadedCallback(onUIImageLoaded, 0, FALSE, FALSE, datap, NULL, NULL); + //Note: + //Some other textures such as ICON also through this flow to be fetched. + //But only UI textures need to set this callback. + if(imagep->getBoostLevel() == LLViewerTexture::BOOST_UI) + { + LLUIImageLoadData* datap = new LLUIImageLoadData; + datap->mImageName = name; + datap->mImageScaleRegion = scale_rect; + imagep->setLoadedCallback(onUIImageLoaded, 0, FALSE, FALSE, datap, NULL, NULL); + } return new_imagep; } diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index a82afbeb76..8a58a9c65b 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -53,6 +53,7 @@ #include "llworld.h" #include "lldir.h" #include "llxmltree.h" +#include "llvotree.h" const S32 GRASS_MAX_BLADES = 32; const F32 GRASS_BLADE_BASE = 0.25f; // Width of grass at base @@ -294,6 +295,23 @@ BOOL LLVOGrass::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) return TRUE; } + if(LLVOTree::isTreeRenderingStopped()) //stop rendering grass + { + if(mNumBlades) + { + mNumBlades = 0 ; + gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, TRUE); + } + return TRUE ; + } + else if(!mNumBlades)//restart grass rendering + { + mNumBlades = GRASS_MAX_BLADES ; + gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, TRUE); + + return TRUE ; + } + if (mPatch && (mLastPatchUpdateTime != mPatch->getLastUpdateTime())) { gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE); @@ -340,7 +358,20 @@ BOOL LLVOGrass::updateLOD() { return FALSE; } - + if(LLVOTree::isTreeRenderingStopped()) + { + if(mNumBlades) + { + mNumBlades = 0 ; + gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, TRUE); + } + return TRUE ; + } + if(!mNumBlades) + { + mNumBlades = GRASS_MAX_BLADES; + } + LLFace* face = mDrawable->getFace(0); F32 tan_angle = 0.f; @@ -387,8 +418,24 @@ static LLFastTimer::DeclareTimer FTM_UPDATE_GRASS("Update Grass"); BOOL LLVOGrass::updateGeometry(LLDrawable *drawable) { LLFastTimer ftm(FTM_UPDATE_GRASS); + dirtySpatialGroup(); - plantBlades(); + + if(!mNumBlades)//stop rendering grass + { + if (mDrawable->getNumFaces() > 0) + { + LLFace* facep = mDrawable->getFace(0); + if(facep) + { + facep->setSize(0, 0); + } + } + } + else + { + plantBlades(); + } return TRUE; } @@ -429,6 +476,11 @@ void LLVOGrass::getGeometry(S32 idx, LLStrider<LLColor4U>& colorsp, LLStrider<U16>& indicesp) { + if(!mNumBlades)//stop rendering grass + { + return ; + } + mPatch = mRegionp->getLand().resolvePatchRegion(getPositionRegion()); if (mPatch) mLastPatchUpdateTime = mPatch->getLastUpdateTime(); diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 5431aec07c..10537a6eb5 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -101,6 +101,12 @@ LLVOTree::~LLVOTree() } } +//static +bool LLVOTree::isTreeRenderingStopped() +{ + return LLVOTree::sTreeFactor < LLVOTree::sLODAngles[sMAX_NUM_TREE_LOD_LEVELS - 1] ; +} + // static void LLVOTree::initClass() { diff --git a/indra/newview/llvotree.h b/indra/newview/llvotree.h index 036ad692b1..a6850e4790 100644 --- a/indra/newview/llvotree.h +++ b/indra/newview/llvotree.h @@ -59,6 +59,7 @@ public: // Initialize data that's only inited once per class. static void initClass(); static void cleanupClass(); + static bool isTreeRenderingStopped(); /*virtual*/ U32 processUpdateMessage(LLMessageSystem *mesgsys, void **user_data, |