protected void prepareTerrain() { TerrainQuad terrain = (TerrainQuad) getSpatial(); // cache the terrain's world transforms so they can be accessed on the separate thread safely terrain.cacheTerrainTransforms(); }
@Override protected void prepareTerrain() { if (!addedTerrains.isEmpty()) { for (TerrainQuad t : addedTerrains) { if (!terrains.contains(t)) { terrains.add(t); } } addedTerrains.clear(); } if (!removedTerrains.isEmpty()) { terrains.removeAll(removedTerrains); removedTerrains.clear(); } for (TerrainQuad terrain : terrains.getArray()) { // cache the terrain's world transforms so they can be accessed on the separate thread safely terrain.cacheTerrainTransforms(); } }
/** * Caches the transforms (except rotation) so the LOD calculator, * which runs on a separate thread, can access them safely. */ protected void cacheTerrainTransforms() { for (int i = children.size(); --i >= 0;) { Spatial child = children.get(i); if (child instanceof TerrainQuad) { ((TerrainQuad) child).cacheTerrainTransforms(); } else if (child instanceof TerrainPatch) { ((TerrainPatch) child).cacheTerrainTransforms(); } } }
@Override protected void prepareTerrain() { if (!addedTerrains.isEmpty()) { for (TerrainQuad t : addedTerrains) { if (!terrains.contains(t)) terrains.add(t); } addedTerrains.clear(); } if (!removedTerrains.isEmpty()) { terrains.removeAll(removedTerrains); removedTerrains.clear(); } for (TerrainQuad terrain : terrains) terrain.cacheTerrainTransforms();// cache the terrain's world transforms so they can be accessed on the separate thread safely }
protected void prepareTerrain() { TerrainQuad terrain = (TerrainQuad)getSpatial(); terrain.cacheTerrainTransforms();// cache the terrain's world transforms so they can be accessed on the separate thread safely }
/** * Caches the transforms (except rotation) so the LOD calculator, * which runs on a separate thread, can access them safely. */ protected void cacheTerrainTransforms() { for (int i = children.size(); --i >= 0;) { Spatial child = children.get(i); if (child instanceof TerrainQuad) { ((TerrainQuad) child).cacheTerrainTransforms(); } else if (child instanceof TerrainPatch) { ((TerrainPatch) child).cacheTerrainTransforms(); } } }