* simplified terrain tests, only passing in single camera

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7824 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
bre..ns 14 years ago
parent 9407f4c3d0
commit 1a72ca91b1
  1. 17
      engine/src/test/jme3test/terrain/TerrainGridTest.java
  2. 9
      engine/src/test/jme3test/terrain/TerrainTest.java
  3. 7
      engine/src/test/jme3test/terrain/TerrainTestAdvanced.java
  4. 8
      engine/src/test/jme3test/terrain/TerrainTestCollision.java
  5. 6
      engine/src/test/jme3test/terrain/TerrainTestModifyHeight.java
  6. 8
      engine/src/test/jme3test/terrain/TerrainTestReadWrite.java

@ -1,7 +1,5 @@
package jme3test.terrain;
import java.util.ArrayList;
import java.util.List;
import com.jme3.app.SimpleApplication;
import com.jme3.app.state.ScreenshotAppState;
@ -18,24 +16,13 @@ import com.jme3.input.controls.KeyTrigger;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.Camera;
import com.jme3.terrain.geomipmap.TerrainGrid;
import com.jme3.terrain.geomipmap.TerrainLodControl;
import com.jme3.terrain.geomipmap.TerrainQuad;
import com.jme3.terrain.heightmap.FractalHeightMapGrid;
import com.jme3.terrain.heightmap.ImageBasedHeightMapGrid;
import com.jme3.terrain.heightmap.Namer;
import com.jme3.texture.Texture;
import com.jme3.texture.Texture.WrapMode;
import java.io.File;
import org.novyon.noise.ShaderUtils;
import org.novyon.noise.basis.FilteredBasis;
import org.novyon.noise.filter.IterativeFilter;
import org.novyon.noise.filter.OptimizedErode;
import org.novyon.noise.filter.PerturbFilter;
import org.novyon.noise.filter.SmoothFilter;
import org.novyon.noise.fractal.FractalSum;
import org.novyon.noise.modulator.NoiseModulator;
public class TerrainGridTest extends SimpleApplication {
@ -116,9 +103,7 @@ public class TerrainGridTest extends SimpleApplication {
this.terrain.initialize(Vector3f.ZERO);
this.rootNode.attachChild(this.terrain);
List<Camera> cameras = new ArrayList<Camera>();
cameras.add(this.getCamera());
TerrainLodControl control = new TerrainLodControl(this.terrain, cameras);
TerrainLodControl control = new TerrainLodControl(this.terrain, getCamera());
this.terrain.addControl(control);
BulletAppState bulletAppState = new BulletAppState();

@ -33,7 +33,6 @@ package jme3test.terrain;
import jme3tools.converters.ImageToAwt;
import com.jme3.app.SimpleApplication;
import com.jme3.bounding.BoundingBox;
import com.jme3.font.BitmapText;
import com.jme3.input.KeyInput;
import com.jme3.input.controls.ActionListener;
@ -43,17 +42,13 @@ import com.jme3.light.PointLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.Camera;
import com.jme3.scene.Geometry;
import com.jme3.terrain.geomipmap.TerrainLodControl;
import com.jme3.terrain.heightmap.AbstractHeightMap;
import com.jme3.terrain.heightmap.ImageBasedHeightMap;
import com.jme3.terrain.geomipmap.TerrainQuad;
import com.jme3.terrain.geomipmap.lodcalc.LodPerspectiveCalculatorFactory;
import com.jme3.texture.Texture;
import com.jme3.texture.Texture.WrapMode;
import java.util.ArrayList;
import java.util.List;
/**
* Demonstrates how to use terrain.
@ -161,9 +156,7 @@ public class TerrainTest extends SimpleApplication {
* size=2049, it got really slow. But that is a jump from 2 million to 8 million triangles...
*/
terrain = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());//, new LodPerspectiveCalculatorFactory(getCamera(), 4)); // add this in to see it use entropy for LOD calculations
List<Camera> cameras = new ArrayList<Camera>();
cameras.add(getCamera());
TerrainLodControl control = new TerrainLodControl(terrain, cameras);
TerrainLodControl control = new TerrainLodControl(terrain, getCamera());
terrain.addControl(control);
terrain.setMaterial(matRock);
terrain.setLocalTranslation(0, -100, 0);

@ -44,7 +44,6 @@ import com.jme3.light.PointLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.Camera;
import com.jme3.scene.Geometry;
import com.jme3.scene.Spatial;
import com.jme3.terrain.geomipmap.TerrainLodControl;
@ -54,8 +53,6 @@ import com.jme3.terrain.geomipmap.TerrainQuad;
import com.jme3.texture.Texture;
import com.jme3.texture.Texture.WrapMode;
import com.jme3.util.SkyFactory;
import java.util.ArrayList;
import java.util.List;
/**
* Uses the terrain's lighting texture with normal maps and lights.
@ -180,9 +177,7 @@ public class TerrainTestAdvanced extends SimpleApplication {
* size=2049, it got really slow. But that is a jump from 2 million to 8 million triangles...
*/
terrain = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());//, new LodPerspectiveCalculatorFactory(getCamera(), 4)); // add this in to see it use entropy for LOD calculations
List<Camera> cameras = new ArrayList<Camera>();
cameras.add(getCamera());
TerrainLodControl control = new TerrainLodControl(terrain, cameras);
TerrainLodControl control = new TerrainLodControl(terrain, getCamera());
terrain.addControl(control);
terrain.setMaterial(matTerrain);
terrain.setModelBound(new BoundingBox());

@ -36,7 +36,6 @@ import com.jme3.bullet.collision.shapes.SphereCollisionShape;
import com.jme3.bounding.BoundingBox;
import com.jme3.bullet.BulletAppState;
import com.jme3.app.SimpleApplication;
import com.jme3.bounding.BoundingSphere;
import com.jme3.bullet.control.RigidBodyControl;
import com.jme3.collision.CollisionResult;
import com.jme3.collision.CollisionResults;
@ -53,7 +52,6 @@ import com.jme3.math.ColorRGBA;
import com.jme3.math.Ray;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector3f;
import com.jme3.renderer.Camera;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.shape.Box;
@ -64,8 +62,6 @@ import com.jme3.terrain.heightmap.ImageBasedHeightMap;
import com.jme3.terrain.geomipmap.TerrainQuad;
import com.jme3.texture.Texture;
import com.jme3.texture.Texture.WrapMode;
import java.util.ArrayList;
import java.util.List;
/**
* Creates a terrain object and a collision node to go with it. Then
@ -137,9 +133,7 @@ public class TerrainTestCollision extends SimpleApplication {
}
terrain = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());
List<Camera> cameras = new ArrayList<Camera>();
cameras.add(getCamera());
TerrainLodControl control = new TerrainLodControl(terrain, cameras);
TerrainLodControl control = new TerrainLodControl(terrain, getCamera());
terrain.addControl(control);
terrain.setMaterial(matRock);
terrain.setLocalScale(new Vector3f(2, 2, 2));

@ -32,7 +32,6 @@
package jme3test.terrain;
import com.jme3.app.SimpleApplication;
import com.jme3.bounding.BoundingBox;
import com.jme3.collision.CollisionResult;
import com.jme3.collision.CollisionResults;
import com.jme3.font.BitmapText;
@ -48,7 +47,6 @@ import com.jme3.math.ColorRGBA;
import com.jme3.math.Ray;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector3f;
import com.jme3.renderer.Camera;
import com.jme3.terrain.geomipmap.TerrainLodControl;
import com.jme3.terrain.geomipmap.TerrainQuad;
import com.jme3.texture.Texture;
@ -140,9 +138,7 @@ public class TerrainTestModifyHeight extends SimpleApplication {
// CREATE THE TERRAIN
terrain = new TerrainQuad("terrain", 65, 513, null);
List<Camera> cameras = new ArrayList<Camera>();
cameras.add(getCamera());
TerrainLodControl control = new TerrainLodControl(terrain, cameras);
TerrainLodControl control = new TerrainLodControl(terrain, getCamera());
terrain.addControl(control);
terrain.setMaterial(matTerrain);
terrain.setLocalTranslation(0, -100, 0);

@ -32,7 +32,6 @@
package jme3test.terrain;
import com.jme3.app.SimpleApplication;
import com.jme3.bounding.BoundingBox;
import com.jme3.export.Savable;
import com.jme3.export.binary.BinaryExporter;
import com.jme3.export.binary.BinaryImporter;
@ -44,7 +43,6 @@ import com.jme3.light.DirectionalLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.Camera;
import com.jme3.scene.Node;
import com.jme3.terrain.Terrain;
import com.jme3.terrain.geomipmap.TerrainLodControl;
@ -59,8 +57,6 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import jme3tools.converters.ImageToAwt;
@ -162,9 +158,7 @@ public class TerrainTestReadWrite extends SimpleApplication {
} else {
// create the terrain as normal, and give it a control for LOD management
TerrainQuad terrainQuad = new TerrainQuad("terrain", 65, 129, heightmap.getHeightMap());//, new LodPerspectiveCalculatorFactory(getCamera(), 4)); // add this in to see it use entropy for LOD calculations
List<Camera> cameras = new ArrayList<Camera>();
cameras.add(getCamera());
TerrainLodControl control = new TerrainLodControl(terrainQuad, cameras);
TerrainLodControl control = new TerrainLodControl(terrainQuad, getCamera());
terrainQuad.addControl(control);
terrainQuad.setMaterial(matTerrain);
terrainQuad.setLocalTranslation(0, -100, 0);

Loading…
Cancel
Save