/** * Creates a terrain with: * <ul> * <li>the total, real-world, size of the terrain</li> * <li>the patchSize, or the size of each geometry tile of the terrain</li> * <li>the heightmap that defines the height of the terrain</li> * </ul> * <p> * A TerrainQuad of totalSize 513x513 will be 513 units wide and 513 units long. * PatchSize is just used to subdivide the terrain into tiles that can be culled. * </p> * @param name the name of the scene element. This is required for * identification and comparison purposes. * @param patchSize size of the individual patches (geometry). Power of 2 plus 1, * must be smaller than totalSize. (eg. 33, 65...) * @param totalSize the size of this entire terrain (on one side). Power of 2 plus 1 * (eg. 513, 1025, 2049...) * @param heightMap The height map to generate the terrain from (a flat * height map will be generated if this is null). The size of one side of the heightmap * must match the totalSize. So a 513x513 heightmap is needed for a terrain with totalSize of 513. */ public TerrainQuad(String name, int patchSize, int totalSize, float[] heightMap) { this(name, patchSize, totalSize, Vector3f.UNIT_XYZ, heightMap); affectedAreaBBox = new BoundingBox(new Vector3f(0,0,0), size*2, Float.MAX_VALUE, size*2); fixNormalEdges(affectedAreaBBox); addControl(new NormalRecalcControl(this)); }
public TerrainGrid(String name, int patchSize, int maxVisibleSize, Vector3f scale, TerrainGridTileLoader terrainQuadGrid, Vector2f offset, float offsetAmount) { this.name = name; this.patchSize = patchSize; this.size = maxVisibleSize; this.stepScale = scale; this.offset = offset; this.offsetAmount = offsetAmount; initData(); this.gridTileLoader = terrainQuadGrid; terrainQuadGrid.setPatchSize(this.patchSize); terrainQuadGrid.setQuadSize(this.quadSize); addControl(new UpdateControl()); fixNormalEdges(new BoundingBox(new Vector3f(0,0,0), size*2, Float.MAX_VALUE, size*2)); addControl(new NormalRecalcControl(this)); }
public Control cloneForSpatial(Spatial spatial) { NormalRecalcControl control = new NormalRecalcControl(terrain); control.setSpatial(spatial); control.setEnabled(true); return control; }
/** * Creates a terrain with: * <ul> * <li>the total, real-world, size of the terrain</li> * <li>the patchSize, or the size of each geometry tile of the terrain</li> * <li>the heightmap that defines the height of the terrain</li> * </ul> * <p> * A TerrainQuad of totalSize 513x513 will be 513 units wide and 513 units long. * PatchSize is just used to subdivide the terrain into tiles that can be culled. * </p> * @param name the name of the scene element. This is required for * identification and comparison purposes. * @param patchSize size of the individual patches (geometry). Power of 2 plus 1, * must be smaller than totalSize. (eg. 33, 65...) * @param totalSize the size of this entire terrain (on one side). Power of 2 plus 1 * (eg. 513, 1025, 2049...) * @param heightMap The height map to generate the terrain from (a flat * height map will be generated if this is null). The size of one side of the heightmap * must match the totalSize. So a 513x513 heightmap is needed for a terrain with totalSize of 513. */ public TerrainQuad(String name, int patchSize, int totalSize, float[] heightMap) { this(name, patchSize, totalSize, Vector3f.UNIT_XYZ, heightMap); affectedAreaBBox = new BoundingBox(new Vector3f(0,0,0), size*2, Float.MAX_VALUE, size*2); fixNormalEdges(affectedAreaBBox); addControl(new NormalRecalcControl(this)); }
public TerrainGrid(String name, int patchSize, int maxVisibleSize, Vector3f scale, TerrainGridTileLoader terrainQuadGrid, Vector2f offset, float offsetAmount) { this.name = name; this.patchSize = patchSize; this.size = maxVisibleSize; this.stepScale = scale; this.offset = offset; this.offsetAmount = offsetAmount; initData(); this.gridTileLoader = terrainQuadGrid; terrainQuadGrid.setPatchSize(this.patchSize); terrainQuadGrid.setQuadSize(this.quadSize); addControl(new UpdateControl()); fixNormalEdges(new BoundingBox(new Vector3f(0,0,0), size*2, Float.MAX_VALUE, size*2)); addControl(new NormalRecalcControl(this)); }