- update test data, add list size check to TerrainGrid

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8698 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
nor..67 2011-11-16 00:47:46 +00:00
parent 534ab2f737
commit 9e18ec6184
35 changed files with 4 additions and 1 deletions

@ -281,7 +281,7 @@ public class TerrainGrid extends TerrainQuad {
// to accept more, there are two ways: // 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 // 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 // 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) 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. if (cellsLoaded > 1) { // Check if cells are updated before updating gridoffset.
gridOffset[0] = Math.round(camCell.x * (size / 2)); gridOffset[0] = Math.round(camCell.x * (size / 2));

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -142,6 +142,9 @@ public class TerrainGridTest extends SimpleApplication {
} }
public void tileAttached(Vector3f cell, TerrainQuad quad) { public void tileAttached(Vector3f cell, TerrainQuad quad) {
while(quad.getControl(RigidBodyControl.class)!=null){
quad.removeControl(RigidBodyControl.class);
}
// try { // try {
// BinaryExporter.getInstance().save(quad, new File("/Users/normenhansen/Documents/Code/jme3/engine/src/test-data/TerrainGrid/" // 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")); // + "testgrid_" + Math.round(cell.x) + "_" + Math.round(cell.y) + "_" + Math.round(cell.z) + ".j3o"));