aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llsurface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llsurface.cpp')
-rw-r--r--linden/indra/newview/llsurface.cpp46
1 files changed, 21 insertions, 25 deletions
diff --git a/linden/indra/newview/llsurface.cpp b/linden/indra/newview/llsurface.cpp
index c1b22c9..191c079 100644
--- a/linden/indra/newview/llsurface.cpp
+++ b/linden/indra/newview/llsurface.cpp
@@ -50,7 +50,7 @@
50#include "noise.h" 50#include "noise.h"
51#include "llviewercamera.h" 51#include "llviewercamera.h"
52#include "llglheaders.h" 52#include "llglheaders.h"
53#include "lldrawpool.h" 53#include "lldrawpoolterrain.h"
54#include "lldrawable.h" 54#include "lldrawable.h"
55 55
56extern LLPipeline gPipeline; 56extern LLPipeline gPipeline;
@@ -120,7 +120,7 @@ LLSurface::~LLSurface()
120 mNumberOfPatches = 0; 120 mNumberOfPatches = 0;
121 destroyPatchData(); 121 destroyPatchData();
122 122
123 LLDrawPool *poolp = gPipeline.findPool(LLDrawPool::POOL_TERRAIN, mSTexturep); 123 LLDrawPoolTerrain *poolp = (LLDrawPoolTerrain*) gPipeline.findPool(LLDrawPool::POOL_TERRAIN, mSTexturep);
124 if (!poolp) 124 if (!poolp)
125 { 125 {
126 llwarns << "No pool for terrain on destruction!" << llendl; 126 llwarns << "No pool for terrain on destruction!" << llendl;
@@ -331,7 +331,6 @@ void LLSurface::setOriginGlobal(const LLVector3d &origin_global)
331 LLVector3d water_origin_global(x, y, z); 331 LLVector3d water_origin_global(x, y, z);
332 332
333 mWaterObjp->setPositionGlobal(water_origin_global); 333 mWaterObjp->setPositionGlobal(water_origin_global);
334 gPipeline.markMoved(mWaterObjp->mDrawable);
335 } 334 }
336} 335}
337 336
@@ -621,45 +620,45 @@ void LLSurface::updatePatchVisibilities(LLAgent &agent)
621 } 620 }
622} 621}
623 622
624 623BOOL LLSurface::idleUpdate(F32 max_update_time)
625
626BOOL LLSurface::idleUpdate()
627{ 624{
628 if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_TERRAIN)) 625 if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_TERRAIN))
629 { 626 {
630 return TRUE; 627 return FALSE;
631 } 628 }
632 629
633 // Perform idle time update of non-critical stuff. 630 // Perform idle time update of non-critical stuff.
634 // In this case, texture and normal updates. 631 // In this case, texture and normal updates.
635 LLTimer update_timer; 632 LLTimer update_timer;
636 LLSurfacePatch *patchp = NULL; 633 BOOL did_update = FALSE;
637 634
638 // If the Z height data has changed, we need to rebuild our 635 // If the Z height data has changed, we need to rebuild our
639 // property line vertex arrays. 636 // property line vertex arrays.
640 if (mDirtyPatchList.count() > 0) 637 if (mDirtyPatchList.size() > 0)
641 { 638 {
642 getRegion()->dirtyHeights(); 639 getRegion()->dirtyHeights();
643 } 640 }
644 641
645 S32 i = 0; 642 // Always call updateNormals() / updateVerticalStats()
646 while (i < mDirtyPatchList.count()) 643 // every frame to avoid artifacts
644 for(std::set<LLSurfacePatch *>::iterator iter = mDirtyPatchList.begin();
645 iter != mDirtyPatchList.end(); )
647 { 646 {
648 patchp = mDirtyPatchList[i]; 647 std::set<LLSurfacePatch *>::iterator curiter = iter++;
648 LLSurfacePatch *patchp = *curiter;
649 patchp->updateNormals(); 649 patchp->updateNormals();
650 patchp->updateVerticalStats(); 650 patchp->updateVerticalStats();
651 651 if (max_update_time == 0.f || update_timer.getElapsedTimeF32() < max_update_time)
652 if ((update_timer.getElapsedTimeF32() < 0.05f) && patchp->updateTexture())
653 {
654 patchp->clearDirty();
655 mDirtyPatchList.remove(i);
656 }
657 else
658 { 652 {
659 i++; 653 if (patchp->updateTexture())
654 {
655 did_update = TRUE;
656 patchp->clearDirty();
657 mDirtyPatchList.erase(curiter);
658 }
660 } 659 }
661 } 660 }
662 return TRUE; 661 return did_update;
663} 662}
664 663
665// TODO -- move this to LLViewerRegion class 664// TODO -- move this to LLViewerRegion class
@@ -1229,10 +1228,7 @@ void LLSurface::dirtyAllPatches()
1229void LLSurface::dirtySurfacePatch(LLSurfacePatch *patchp) 1228void LLSurface::dirtySurfacePatch(LLSurfacePatch *patchp)
1230{ 1229{
1231 // Put surface patch on dirty surface patch list 1230 // Put surface patch on dirty surface patch list
1232 if (-1 == mDirtyPatchList.find(patchp)) 1231 mDirtyPatchList.insert(patchp);
1233 {
1234 mDirtyPatchList.put(patchp);
1235 }
1236} 1232}
1237 1233
1238 1234