diff options
author | Steven Bennetts <steve@lindenlab.com> | 2007-03-02 21:25:50 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2007-03-02 21:25:50 +0000 |
commit | 4dabd9c0472deb49573fdafef2fa413e59703f19 (patch) | |
tree | 06c680d6a2047e03838d6548bccd26c7baf9d652 /indra/newview/llsurface.cpp | |
parent | d4462963c6ba5db2088723bbedc7b60f1184c594 (diff) |
merge release@58699 beta-1-14-0@58707 -> release
Diffstat (limited to 'indra/newview/llsurface.cpp')
-rw-r--r-- | indra/newview/llsurface.cpp | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp index fc0c46bbe1..4087f7f96c 100644 --- a/indra/newview/llsurface.cpp +++ b/indra/newview/llsurface.cpp @@ -31,7 +31,7 @@ #include "noise.h" #include "llviewercamera.h" #include "llglheaders.h" -#include "lldrawpool.h" +#include "lldrawpoolterrain.h" #include "lldrawable.h" extern LLPipeline gPipeline; @@ -101,7 +101,7 @@ LLSurface::~LLSurface() mNumberOfPatches = 0; destroyPatchData(); - LLDrawPool *poolp = gPipeline.findPool(LLDrawPool::POOL_TERRAIN, mSTexturep); + LLDrawPoolTerrain *poolp = (LLDrawPoolTerrain*) gPipeline.findPool(LLDrawPool::POOL_TERRAIN, mSTexturep); if (!poolp) { llwarns << "No pool for terrain on destruction!" << llendl; @@ -312,7 +312,6 @@ void LLSurface::setOriginGlobal(const LLVector3d &origin_global) LLVector3d water_origin_global(x, y, z); mWaterObjp->setPositionGlobal(water_origin_global); - gPipeline.markMoved(mWaterObjp->mDrawable); } } @@ -602,45 +601,45 @@ void LLSurface::updatePatchVisibilities(LLAgent &agent) } } - - -BOOL LLSurface::idleUpdate() +BOOL LLSurface::idleUpdate(F32 max_update_time) { if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_TERRAIN)) { - return TRUE; + return FALSE; } // Perform idle time update of non-critical stuff. // In this case, texture and normal updates. LLTimer update_timer; - LLSurfacePatch *patchp = NULL; + BOOL did_update = FALSE; // If the Z height data has changed, we need to rebuild our // property line vertex arrays. - if (mDirtyPatchList.count() > 0) + if (mDirtyPatchList.size() > 0) { getRegion()->dirtyHeights(); } - S32 i = 0; - while (i < mDirtyPatchList.count()) + // Always call updateNormals() / updateVerticalStats() + // every frame to avoid artifacts + for(std::set<LLSurfacePatch *>::iterator iter = mDirtyPatchList.begin(); + iter != mDirtyPatchList.end(); ) { - patchp = mDirtyPatchList[i]; + std::set<LLSurfacePatch *>::iterator curiter = iter++; + LLSurfacePatch *patchp = *curiter; patchp->updateNormals(); patchp->updateVerticalStats(); - - if ((update_timer.getElapsedTimeF32() < 0.05f) && patchp->updateTexture()) - { - patchp->clearDirty(); - mDirtyPatchList.remove(i); - } - else + if (max_update_time == 0.f || update_timer.getElapsedTimeF32() < max_update_time) { - i++; + if (patchp->updateTexture()) + { + did_update = TRUE; + patchp->clearDirty(); + mDirtyPatchList.erase(curiter); + } } } - return TRUE; + return did_update; } // TODO -- move this to LLViewerRegion class @@ -1210,10 +1209,7 @@ void LLSurface::dirtyAllPatches() void LLSurface::dirtySurfacePatch(LLSurfacePatch *patchp) { // Put surface patch on dirty surface patch list - if (-1 == mDirtyPatchList.find(patchp)) - { - mDirtyPatchList.put(patchp); - } + mDirtyPatchList.insert(patchp); } |