Fixed double calling of TerrainTechnique::init().

This commit is contained in:
Robert Osfield 2018-03-29 11:38:04 +01:00
parent 1e05e04a05
commit 751d7e8335

View File

@ -181,7 +181,7 @@ void TerrainTile::init(int dirtyMask, bool assumeMultiThreaded)
if (_terrainTechnique.valid()) 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; if (_terrainTechnique == terrainTechnique) return;
int dirtyDelta = (_dirtyMask==NOT_DIRTY) ? 0 : -1;
if (_terrainTechnique.valid()) if (_terrainTechnique.valid())
{ {
_terrainTechnique->setTerrainTile(0); _terrainTechnique->setTerrainTile(0);
@ -201,11 +199,9 @@ void TerrainTile::setTerrainTechnique(TerrainTechnique* terrainTechnique)
if (_terrainTechnique.valid()) if (_terrainTechnique.valid())
{ {
_terrainTechnique->setTerrainTile(this); _terrainTechnique->setTerrainTile(this);
++dirtyDelta;
}
if (dirtyDelta>0) setDirtyMask(ALL_DIRTY); setDirtyMask(ALL_DIRTY);
else if (dirtyDelta<0) setDirtyMask(NOT_DIRTY); }
} }
void TerrainTile::setDirtyMask(int dirtyMask) void TerrainTile::setDirtyMask(int dirtyMask)
@ -218,14 +214,6 @@ void TerrainTile::setDirtyMask(int dirtyMask)
if (_dirtyMask!=NOT_DIRTY) dirtyDelta += 1; 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. // setNumChildrenRequeingUpdateTraversal() isn't thread safe so should avoid using it.
if (dirtyDelta>0) if (dirtyDelta>0)
{ {
@ -235,7 +223,6 @@ void TerrainTile::setDirtyMask(int dirtyMask)
{ {
setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()-1); setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()-1);
} }
#endif
} }