From 69b7f7e65543939ec4b33c9c4786b74eae9d02f8 Mon Sep 17 00:00:00 2001 From: javasabr Date: Sun, 6 Aug 2017 18:12:10 +0300 Subject: [PATCH] fixed some changes. --- .../terrain/executor/TerrainExecutorService.java | 2 +- .../geomipmap/MultiTerrainLodControl.java | 4 ++-- .../terrain/geomipmap/TerrainLodControl.java | 16 +++++++--------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/jme3-terrain/src/main/java/com/jme3/terrain/executor/TerrainExecutorService.java b/jme3-terrain/src/main/java/com/jme3/terrain/executor/TerrainExecutorService.java index 61b57f1f0..7d8dbe3ba 100644 --- a/jme3-terrain/src/main/java/com/jme3/terrain/executor/TerrainExecutorService.java +++ b/jme3-terrain/src/main/java/com/jme3/terrain/executor/TerrainExecutorService.java @@ -4,7 +4,7 @@ import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicInteger; /** - * The class to provide single executor service to run background tasks of terrain staff. + * The class to provide single executor service to run background tasks of terrain stuff. * * @author JavaSaBr */ diff --git a/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/MultiTerrainLodControl.java b/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/MultiTerrainLodControl.java index 541f7a997..9e37fb6b2 100644 --- a/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/MultiTerrainLodControl.java +++ b/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/MultiTerrainLodControl.java @@ -107,7 +107,7 @@ public class MultiTerrainLodControl extends TerrainLodControl { } @Override - protected UpdateLOD createLodUpdateTask(final SafeArrayList locations, + protected UpdateLOD createLodUpdateTask(final List locations, final LodCalculator lodCalculator) { return new UpdateMultiLOD(locations, lodCalculator); } @@ -140,7 +140,7 @@ public class MultiTerrainLodControl extends TerrainLodControl { */ protected class UpdateMultiLOD extends UpdateLOD { - protected UpdateMultiLOD(final SafeArrayList camLocations, final LodCalculator lodCalculator) { + protected UpdateMultiLOD(final List camLocations, final LodCalculator lodCalculator) { super(camLocations, lodCalculator); } diff --git a/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/TerrainLodControl.java b/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/TerrainLodControl.java index d38a32878..a6b94024e 100644 --- a/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/TerrainLodControl.java +++ b/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/TerrainLodControl.java @@ -31,6 +31,7 @@ */ package com.jme3.terrain.geomipmap; +import static java.util.Collections.singletonList; import com.jme3.export.InputCapsule; import com.jme3.export.JmeExporter; import com.jme3.export.JmeImporter; @@ -267,11 +268,8 @@ public class TerrainLodControl extends AbstractControl { prepareTerrain(); - final SafeArrayList locations = new SafeArrayList<>(Vector3f.class, 1); - locations.add(currentLocation); - final TerrainExecutorService executorService = TerrainExecutorService.getInstance(); - indexer = executorService.submit(createLodUpdateTask(locations, lodCalculator)); + indexer = executorService.submit(createLodUpdateTask(singletonList(currentLocation), lodCalculator)); } // do all of the LOD calculations @@ -348,7 +346,7 @@ public class TerrainLodControl extends AbstractControl { terrain.cacheTerrainTransforms(); } - protected UpdateLOD createLodUpdateTask(final SafeArrayList locations, final LodCalculator lodCalculator) { + protected UpdateLOD createLodUpdateTask(final List locations, final LodCalculator lodCalculator) { return new UpdateLOD(locations, lodCalculator); } @@ -378,9 +376,9 @@ public class TerrainLodControl extends AbstractControl { } } - private SafeArrayList cloneVectorList(SafeArrayList locations) { + private List cloneVectorList(SafeArrayList locations) { - final SafeArrayList cloned = new SafeArrayList<>(Vector3f.class, locations.size()); + final List cloned = new ArrayList<>(locations.size()); for (final Vector3f location : locations.getArray()) { cloned.add(location.clone()); @@ -468,10 +466,10 @@ public class TerrainLodControl extends AbstractControl { */ protected class UpdateLOD implements Callable> { - protected final SafeArrayList camLocations; + protected final List camLocations; protected final LodCalculator lodCalculator; - protected UpdateLOD(final SafeArrayList camLocations, final LodCalculator lodCalculator) { + protected UpdateLOD(final List camLocations, final LodCalculator lodCalculator) { this.camLocations = camLocations; this.lodCalculator = lodCalculator; }