diff --git a/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainGrid.java b/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainGrid.java index c38f005c3..523f5d900 100644 --- a/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainGrid.java +++ b/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainGrid.java @@ -281,7 +281,7 @@ public class TerrainGrid extends TerrainQuad { // to accept more, there are two ways: // 1: every camera has an associated grid, then the location is not enough to identify which camera location has changed // 2: grids are associated with locations, and no incremental update is done, we load new grids for new locations, and unload those that are not needed anymore - Vector3f cam = locations.get(0); + Vector3f cam = locations.size() == 0 ? Vector3f.ZERO.clone() : locations.get(0); Vector3f camCell = this.getCamCell(cam); // get the grid index value of where the camera is (ie. 2,1) if (cellsLoaded > 1) { // Check if cells are updated before updating gridoffset. gridOffset[0] = Math.round(camCell.x * (size / 2)); diff --git a/engine/src/test-data/TerrainGrid/testgrid_-1_0_-1.j3o b/engine/src/test-data/TerrainGrid/testgrid_-1_0_-1.j3o deleted file mode 100644 index ad25512a7..000000000 Binary files a/engine/src/test-data/TerrainGrid/testgrid_-1_0_-1.j3o and /dev/null differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_-1_0_0.j3o b/engine/src/test-data/TerrainGrid/testgrid_-1_0_0.j3o deleted file mode 100644 index 2753ecbd1..000000000 Binary files a/engine/src/test-data/TerrainGrid/testgrid_-1_0_0.j3o and /dev/null differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_-1_0_1.j3o b/engine/src/test-data/TerrainGrid/testgrid_-1_0_1.j3o deleted file mode 100644 index a9dbc62a6..000000000 Binary files a/engine/src/test-data/TerrainGrid/testgrid_-1_0_1.j3o and /dev/null differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_-1_0_2.j3o b/engine/src/test-data/TerrainGrid/testgrid_-1_0_2.j3o deleted file mode 100644 index ecb84fc14..000000000 Binary files a/engine/src/test-data/TerrainGrid/testgrid_-1_0_2.j3o and /dev/null differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_0_0_-1.j3o b/engine/src/test-data/TerrainGrid/testgrid_0_0_-1.j3o index 9a597f426..1e9467d91 100644 Binary files a/engine/src/test-data/TerrainGrid/testgrid_0_0_-1.j3o and b/engine/src/test-data/TerrainGrid/testgrid_0_0_-1.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_0_0_-2.j3o b/engine/src/test-data/TerrainGrid/testgrid_0_0_-2.j3o new file mode 100644 index 000000000..c7ee9345e Binary files /dev/null and b/engine/src/test-data/TerrainGrid/testgrid_0_0_-2.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_0_0_-3.j3o b/engine/src/test-data/TerrainGrid/testgrid_0_0_-3.j3o new file mode 100644 index 000000000..c13985efc Binary files /dev/null and b/engine/src/test-data/TerrainGrid/testgrid_0_0_-3.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_0_0_0.j3o b/engine/src/test-data/TerrainGrid/testgrid_0_0_0.j3o index 289d32cf5..73c5a009c 100644 Binary files a/engine/src/test-data/TerrainGrid/testgrid_0_0_0.j3o and b/engine/src/test-data/TerrainGrid/testgrid_0_0_0.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_0_0_2.j3o b/engine/src/test-data/TerrainGrid/testgrid_0_0_2.j3o deleted file mode 100644 index 60c67b5df..000000000 Binary files a/engine/src/test-data/TerrainGrid/testgrid_0_0_2.j3o and /dev/null differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_0_0_3.j3o b/engine/src/test-data/TerrainGrid/testgrid_0_0_3.j3o deleted file mode 100644 index 729fdad6e..000000000 Binary files a/engine/src/test-data/TerrainGrid/testgrid_0_0_3.j3o and /dev/null differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_1_0_-1.j3o b/engine/src/test-data/TerrainGrid/testgrid_1_0_-1.j3o index 514d8b929..2a8b59d82 100644 Binary files a/engine/src/test-data/TerrainGrid/testgrid_1_0_-1.j3o and b/engine/src/test-data/TerrainGrid/testgrid_1_0_-1.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_1_0_-2.j3o b/engine/src/test-data/TerrainGrid/testgrid_1_0_-2.j3o new file mode 100644 index 000000000..0a69a0d87 Binary files /dev/null and b/engine/src/test-data/TerrainGrid/testgrid_1_0_-2.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_1_0_-3.j3o b/engine/src/test-data/TerrainGrid/testgrid_1_0_-3.j3o new file mode 100644 index 000000000..2a044106e Binary files /dev/null and b/engine/src/test-data/TerrainGrid/testgrid_1_0_-3.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_1_0_0.j3o b/engine/src/test-data/TerrainGrid/testgrid_1_0_0.j3o index 864a9bb42..140dcf850 100644 Binary files a/engine/src/test-data/TerrainGrid/testgrid_1_0_0.j3o and b/engine/src/test-data/TerrainGrid/testgrid_1_0_0.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_1_0_1.j3o b/engine/src/test-data/TerrainGrid/testgrid_1_0_1.j3o index b757550ed..7d20ace1f 100644 Binary files a/engine/src/test-data/TerrainGrid/testgrid_1_0_1.j3o and b/engine/src/test-data/TerrainGrid/testgrid_1_0_1.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_1_0_2.j3o b/engine/src/test-data/TerrainGrid/testgrid_1_0_2.j3o deleted file mode 100644 index 85b5e8148..000000000 Binary files a/engine/src/test-data/TerrainGrid/testgrid_1_0_2.j3o and /dev/null differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_2_0_-1.j3o b/engine/src/test-data/TerrainGrid/testgrid_2_0_-1.j3o index c6464a7e1..1c4d1fbc0 100644 Binary files a/engine/src/test-data/TerrainGrid/testgrid_2_0_-1.j3o and b/engine/src/test-data/TerrainGrid/testgrid_2_0_-1.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_2_0_-2.j3o b/engine/src/test-data/TerrainGrid/testgrid_2_0_-2.j3o new file mode 100644 index 000000000..cd87ea5ef Binary files /dev/null and b/engine/src/test-data/TerrainGrid/testgrid_2_0_-2.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_2_0_-3.j3o b/engine/src/test-data/TerrainGrid/testgrid_2_0_-3.j3o new file mode 100644 index 000000000..08251160d Binary files /dev/null and b/engine/src/test-data/TerrainGrid/testgrid_2_0_-3.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_2_0_-4.j3o b/engine/src/test-data/TerrainGrid/testgrid_2_0_-4.j3o new file mode 100644 index 000000000..b45d2c39b Binary files /dev/null and b/engine/src/test-data/TerrainGrid/testgrid_2_0_-4.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_2_0_0.j3o b/engine/src/test-data/TerrainGrid/testgrid_2_0_0.j3o index f88b1cea5..7764d0ccc 100644 Binary files a/engine/src/test-data/TerrainGrid/testgrid_2_0_0.j3o and b/engine/src/test-data/TerrainGrid/testgrid_2_0_0.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_2_0_1.j3o b/engine/src/test-data/TerrainGrid/testgrid_2_0_1.j3o deleted file mode 100644 index 5e09cfcd3..000000000 Binary files a/engine/src/test-data/TerrainGrid/testgrid_2_0_1.j3o and /dev/null differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_2_0_2.j3o b/engine/src/test-data/TerrainGrid/testgrid_2_0_2.j3o deleted file mode 100644 index 9aa45ea05..000000000 Binary files a/engine/src/test-data/TerrainGrid/testgrid_2_0_2.j3o and /dev/null differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_1_0_3.j3o b/engine/src/test-data/TerrainGrid/testgrid_3_0_-1.j3o similarity index 86% rename from engine/src/test-data/TerrainGrid/testgrid_1_0_3.j3o rename to engine/src/test-data/TerrainGrid/testgrid_3_0_-1.j3o index 3055eba9a..c8cbb413a 100644 Binary files a/engine/src/test-data/TerrainGrid/testgrid_1_0_3.j3o and b/engine/src/test-data/TerrainGrid/testgrid_3_0_-1.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_3_0_-2.j3o b/engine/src/test-data/TerrainGrid/testgrid_3_0_-2.j3o new file mode 100644 index 000000000..edada9624 Binary files /dev/null and b/engine/src/test-data/TerrainGrid/testgrid_3_0_-2.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_3_0_-3.j3o b/engine/src/test-data/TerrainGrid/testgrid_3_0_-3.j3o new file mode 100644 index 000000000..6d61636b5 Binary files /dev/null and b/engine/src/test-data/TerrainGrid/testgrid_3_0_-3.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_3_0_-4.j3o b/engine/src/test-data/TerrainGrid/testgrid_3_0_-4.j3o new file mode 100644 index 000000000..a14d6cf64 Binary files /dev/null and b/engine/src/test-data/TerrainGrid/testgrid_3_0_-4.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_3_0_0.j3o b/engine/src/test-data/TerrainGrid/testgrid_3_0_0.j3o index 830b6cba5..7137ee9a9 100644 Binary files a/engine/src/test-data/TerrainGrid/testgrid_3_0_0.j3o and b/engine/src/test-data/TerrainGrid/testgrid_3_0_0.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_3_0_1.j3o b/engine/src/test-data/TerrainGrid/testgrid_3_0_1.j3o deleted file mode 100644 index bf5a0a395..000000000 Binary files a/engine/src/test-data/TerrainGrid/testgrid_3_0_1.j3o and /dev/null differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_3_0_2.j3o b/engine/src/test-data/TerrainGrid/testgrid_3_0_2.j3o deleted file mode 100644 index 718a79b93..000000000 Binary files a/engine/src/test-data/TerrainGrid/testgrid_3_0_2.j3o and /dev/null differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_-1_0_3.j3o b/engine/src/test-data/TerrainGrid/testgrid_4_0_-1.j3o similarity index 98% rename from engine/src/test-data/TerrainGrid/testgrid_-1_0_3.j3o rename to engine/src/test-data/TerrainGrid/testgrid_4_0_-1.j3o index 952774413..f0f6471c0 100644 Binary files a/engine/src/test-data/TerrainGrid/testgrid_-1_0_3.j3o and b/engine/src/test-data/TerrainGrid/testgrid_4_0_-1.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_4_0_-2.j3o b/engine/src/test-data/TerrainGrid/testgrid_4_0_-2.j3o new file mode 100644 index 000000000..95699bfa2 Binary files /dev/null and b/engine/src/test-data/TerrainGrid/testgrid_4_0_-2.j3o differ diff --git a/engine/src/test-data/TerrainGrid/testgrid_4_0_-3.j3o b/engine/src/test-data/TerrainGrid/testgrid_4_0_-3.j3o new file mode 100644 index 000000000..b44143149 Binary files /dev/null and b/engine/src/test-data/TerrainGrid/testgrid_4_0_-3.j3o differ diff --git a/engine/src/test/jme3test/terrain/TerrainGridTest.java b/engine/src/test/jme3test/terrain/TerrainGridTest.java index 8c7a700e6..ab9b63b63 100644 --- a/engine/src/test/jme3test/terrain/TerrainGridTest.java +++ b/engine/src/test/jme3test/terrain/TerrainGridTest.java @@ -142,6 +142,9 @@ public class TerrainGridTest extends SimpleApplication { } public void tileAttached(Vector3f cell, TerrainQuad quad) { + while(quad.getControl(RigidBodyControl.class)!=null){ + quad.removeControl(RigidBodyControl.class); + } // try { // BinaryExporter.getInstance().save(quad, new File("/Users/normenhansen/Documents/Code/jme3/engine/src/test-data/TerrainGrid/" // + "testgrid_" + Math.round(cell.x) + "_" + Math.round(cell.y) + "_" + Math.round(cell.z) + ".j3o"));