|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xith3d.terrain.legacy.heightmap.HeightMap
public class HeightMap
Storage and conversion for height maps (two dimentional arrays of height data). The height maps can be created in many ways such as a random generator, or reading an image. This class allows the 2D height map to be exported to ASCII (for debuggin), 2D images (for terrain detailing and cloud textures) and 3D geometry (for intereactive terrain).
| Field Summary | |
|---|---|
static int |
FLIP_STARTING
Changes starting |
protected float[][] |
heightmap
|
static int |
ZIGZAG_COLS
Alternate collumns when exporting 3D triangular geometry. |
static int |
ZIGZAG_ROWS
Alternate rows when exporting 3D triangular geometry (default) |
| Constructor Summary | |
|---|---|
protected |
HeightMap()
Empty Constructor |
|
HeightMap(float[][] heightmap)
Initialises using the given two dimentional array as the hight map. |
|
HeightMap(float[] heights,
int nodesPerSide)
Initialises using the given one dimentional array, unfolded using the given node count per side. |
| Method Summary | |
|---|---|
org.openmali.vecmath2.Point3f[][] |
calculateCoords(float startX,
float startY,
float stepX,
float stepY)
Calculates vertex points using given offsets and spacing. |
static int[] |
calculateIndicies(int width,
int height,
int flags)
Converts the two dimentional table of points into 3D geometry by calculating the connecting edges between the verticies by using Triangular primitives. |
static org.openmali.vecmath2.Point3f[] |
flatten2DArray(org.openmali.vecmath2.Point3f[][] vertices)
|
java.awt.image.BufferedImage |
generate2D()
|
GeometryArray |
generate3D(float startX,
float startY,
float stepX,
float stepY)
Builds 3D geometrical representation of this height map using the given offsets and spacing. |
IndexedTriangleArray |
generate3D(float startX,
float startY,
float stepX,
float stepY,
int flags)
Builds 3D geometrical representation of this height map using the given offsets and spacing. |
java.lang.String |
generateUTF()
|
static float[] |
point2float(org.openmali.vecmath2.Point3f[] coords)
|
static org.openmali.vecmath2.Point3f[] |
unIndex(org.openmali.vecmath2.Point3f[] vertices,
int[] indices)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int ZIGZAG_ROWS
public static final int ZIGZAG_COLS
public static final int FLIP_STARTING
protected float[][] heightmap
| Constructor Detail |
|---|
protected HeightMap()
public HeightMap(float[][] heightmap)
heightmap - the heightmap to be used
public HeightMap(float[] heights,
int nodesPerSide)
heights - the table of heights to be usednodesPerSide - width of table in number of cells.| Method Detail |
|---|
public java.lang.String generateUTF()
public java.awt.image.BufferedImage generate2D()
public GeometryArray generate3D(float startX,
float startY,
float stepX,
float stepY)
startX - starting X value (used to offset the geometry)startY - starting Y value (used to offset the geometry)stepX - distance along the X-axis between vertexesstepY - distance along the Y-axis between vertexes
public IndexedTriangleArray generate3D(float startX,
float startY,
float stepX,
float stepY,
int flags)
startX - starting X value (used to offset the geometry)startY - starting Y value (used to offset the geometry)stepX - distance along the X-axis between vertexesstepY - distance along the Y-axis between vertexesflags - modifiers including using Triangles instead of Quads to generate the geom.
public org.openmali.vecmath2.Point3f[][] calculateCoords(float startX,
float startY,
float stepX,
float stepY)
startX - starting X value (used to offset the geometry)startY - starting Y value (used to offset the geometry)stepX - distance along the X-axis between vertexesstepY - distance along the Y-axis between vertexes
public static org.openmali.vecmath2.Point3f[] unIndex(org.openmali.vecmath2.Point3f[] vertices,
int[] indices)
public static int[] calculateIndicies(int width,
int height,
int flags)
width - height - flags - modifiers
ZIGZAG_ROWS,
ZIGZAG_COLS,
(float startX, float startY, float stepX, float stepY, int flags)public static org.openmali.vecmath2.Point3f[] flatten2DArray(org.openmali.vecmath2.Point3f[][] vertices)
public static float[] point2float(org.openmali.vecmath2.Point3f[] coords)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||