From 79b181f9c9cb294252c0f8a0db3129c247c2ed94 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 29 Mar 2018 11:38:04 +0100 Subject: [PATCH] Fixed double calling of TerrainTechnique::init(). --- src/osgTerrain/TerrainTile.cpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/osgTerrain/TerrainTile.cpp b/src/osgTerrain/TerrainTile.cpp index 46780d7f3..8808b73b5 100644 --- a/src/osgTerrain/TerrainTile.cpp +++ b/src/osgTerrain/TerrainTile.cpp @@ -181,7 +181,7 @@ void TerrainTile::init(int dirtyMask, bool assumeMultiThreaded) if (_terrainTechnique.valid()) { - _terrainTechnique->init(dirtyMask, assumeMultiThreaded); + _terrainTechnique->init(dirtyMask|getDirtyMask(), assumeMultiThreaded); } } @@ -189,8 +189,6 @@ void TerrainTile::setTerrainTechnique(TerrainTechnique* terrainTechnique) { if (_terrainTechnique == terrainTechnique) return; - int dirtyDelta = (_dirtyMask==NOT_DIRTY) ? 0 : -1; - if (_terrainTechnique.valid()) { _terrainTechnique->setTerrainTile(0); @@ -201,11 +199,9 @@ void TerrainTile::setTerrainTechnique(TerrainTechnique* terrainTechnique) if (_terrainTechnique.valid()) { _terrainTechnique->setTerrainTile(this); - ++dirtyDelta; - } - if (dirtyDelta>0) setDirtyMask(ALL_DIRTY); - else if (dirtyDelta<0) setDirtyMask(NOT_DIRTY); + setDirtyMask(ALL_DIRTY); + } } void TerrainTile::setDirtyMask(int dirtyMask) @@ -218,14 +214,6 @@ void TerrainTile::setDirtyMask(int dirtyMask) if (_dirtyMask!=NOT_DIRTY) dirtyDelta += 1; -#if 0 - if (dirtyDelta>0) - { - // need to signal that we need an update - if (_terrain) _terrain->updateTerrainTileOnNextFrame(this); - } -#else - // setNumChildrenRequeingUpdateTraversal() isn't thread safe so should avoid using it. if (dirtyDelta>0) { @@ -235,7 +223,6 @@ void TerrainTile::setDirtyMask(int dirtyMask) { setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()-1); } -#endif }