fixed bug with terrain grid and cached neighbours in terrainQuad not being reset
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8673 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
253334fd07
commit
0342cceaaf
@ -105,6 +105,7 @@ public class TerrainGrid extends TerrainQuad {
|
||||
|
||||
public Object call() throws Exception {
|
||||
attachQuadAt(newQuad, quadrant, temp);
|
||||
newQuad.resetCachedNeighbours();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
@ -255,7 +256,6 @@ public class TerrainGrid extends TerrainQuad {
|
||||
for (TerrainGridListener l : listeners.values()) {
|
||||
l.tileAttached(cam, q);
|
||||
}
|
||||
System.err.println("attachQuadAt "+quadrant+", children: "+this.getChildren().size());
|
||||
updateModelBound();
|
||||
}
|
||||
|
||||
|
@ -545,6 +545,24 @@ public class TerrainQuad extends Node implements Terrain {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TerrainQuad caches neighbours for faster LOD checks.
|
||||
* Sometimes you might want to reset this cache (for instance in TerrainGrid)
|
||||
*/
|
||||
protected void resetCachedNeighbours() {
|
||||
if (children != null) {
|
||||
for (int x = children.size(); --x >= 0;) {
|
||||
Spatial child = children.get(x);
|
||||
if (child instanceof TerrainQuad) {
|
||||
((TerrainQuad) child).resetCachedNeighbours();
|
||||
} else if (child instanceof TerrainPatch) {
|
||||
TerrainPatch patch = (TerrainPatch) child;
|
||||
patch.searchedForNeighboursAlready = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find any neighbours that should have their edges seamed because another neighbour
|
||||
* changed its LOD to a greater value (less detailed)
|
||||
|
Loading…
x
Reference in New Issue
Block a user