protected synchronized void reIndexPages(HashMap<String,UpdatedTerrainPatch> updated, boolean usesVariableLod) { if (children != null) { for (int i = children.size(); --i >= 0;) { Spatial child = children.get(i); if (child instanceof TerrainQuad) { ((TerrainQuad) child).reIndexPages(updated, usesVariableLod); } else if (child instanceof TerrainPatch) { ((TerrainPatch) child).reIndexGeometry(updated, usesVariableLod); } } } }
public HashMap<String, UpdatedTerrainPatch> call() throws Exception { TerrainQuad terrainQuad = (TerrainQuad) getSpatial(); // go through each patch and calculate its LOD based on camera distance HashMap<String, UpdatedTerrainPatch> updated = new HashMap<>(); // 'updated' gets populated here boolean lodChanged = terrainQuad.calculateLod(camLocations, updated, lodCalculator); if (!lodChanged) { // not worth updating anything else since no one's LOD changed lodCalcRunning.set(false); return null; } // then calculate its neighbour LOD values for seaming in the shader terrainQuad.findNeighboursLod(updated); // 'updated' can get added to here terrainQuad.fixEdges(updated); terrainQuad.reIndexPages(updated, lodCalculator.usesVariableLod()); //setUpdateQuadLODs(updated); // set back to main ogl thread lodCalcRunning.set(false); return updated; } }
@Override public HashMap<String, UpdatedTerrainPatch> call() throws Exception { HashMap<String, UpdatedTerrainPatch> updated = new HashMap<>(); for (TerrainQuad terrainQuad : terrains) { // go through each patch and calculate its LOD based on camera distance terrainQuad.calculateLod(camLocations, updated, lodCalculator); // 'updated' gets populated here } for (TerrainQuad terrainQuad : terrains) { // then calculate the neighbour LOD values for seaming terrainQuad.findNeighboursLod(updated); } for (TerrainQuad terrainQuad : terrains) { // check neighbour quads that need their edges seamed terrainQuad.fixEdges(updated); } for (TerrainQuad terrainQuad : terrains) { // perform the edge seaming, if it requires it terrainQuad.reIndexPages(updated, lodCalculator.usesVariableLod()); } //setUpdateQuadLODs(updated); // set back to main ogl thread lodCalcRunning.set(false); return updated; } }
protected synchronized void reIndexPages(HashMap<String,UpdatedTerrainPatch> updated, boolean usesVariableLod) { if (children != null) { for (int i = children.size(); --i >= 0;) { Spatial child = children.get(i); if (child instanceof TerrainQuad) { ((TerrainQuad) child).reIndexPages(updated, usesVariableLod); } else if (child instanceof TerrainPatch) { ((TerrainPatch) child).reIndexGeometry(updated, usesVariableLod); } } } }
terrainQuad.reIndexPages(updated, lodCalculator.usesVariableLod());
public HashMap<String, UpdatedTerrainPatch> call() throws Exception { //long start = System.currentTimeMillis(); //if (isLodCalcRunning()) { // return null; //} setLodCalcRunning(true); TerrainQuad terrainQuad = (TerrainQuad)getSpatial(); // go through each patch and calculate its LOD based on camera distance HashMap<String,UpdatedTerrainPatch> updated = new HashMap<String,UpdatedTerrainPatch>(); boolean lodChanged = terrainQuad.calculateLod(camLocations, updated, lodCalculator); // 'updated' gets populated here if (!lodChanged) { // not worth updating anything else since no one's LOD changed setLodCalcRunning(false); return null; } // then calculate its neighbour LOD values for seaming in the shader terrainQuad.findNeighboursLod(updated); terrainQuad.fixEdges(updated); // 'updated' can get added to here terrainQuad.reIndexPages(updated, lodCalculator.usesVariableLod()); //setUpdateQuadLODs(updated); // set back to main ogl thread setLodCalcRunning(false); return updated; } }