|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.j3d.geom.GeometryGenerator org.j3d.geom.terrain.ElevationGridGenerator
public class ElevationGridGenerator
A generator that takes a set of height values as a grid and turns it into geometry.
The grid can be created either as absolute or relative height values. This
setting is controlled as one of the auxillary flags in the
GeometryData
class at construction time. In order for
this to work, you will also need to provide a base height when setting
the terrain.
Points are defined in the height arrays in width first order. Normals, are always smooth blended. Alan: There are some cases where texture generation is not complete. Especially in regards to 3D textures.
Field Summary | |
---|---|
static int |
ABSOLUTE_HEIGHTS
Auxillary flag to say to generate points as absolute values |
static int |
RELATIVE_HEIGHTS
Auxillary flag to say to generate points as relative values |
Constructor Summary | |
---|---|
ElevationGridGenerator()
Construct a default terrain with the following properties: Size: 100x100 Points: 2x2 |
|
ElevationGridGenerator(float w,
float d,
int wPnts,
int dPnts)
Construct a default terrain with the given dimensions and points in each direction. |
|
ElevationGridGenerator(float w,
float d,
int wPnts,
int dPnts,
boolean centerOrigin)
Construct a default terrain with the given dimensions and points in each direction. |
|
ElevationGridGenerator(float w,
float d,
int wPnts,
int dPnts,
float[][] heights,
float baseHeight)
Construct a default cylinder with the option of having end caps and selectable number of faces around the radius. |
|
ElevationGridGenerator(float w,
float d,
int wPnts,
int dPnts,
float[][] heights,
float baseHeight,
boolean centerOrigin)
Construct a default cylinder with the option of having end caps and selectable number of faces around the radius. |
|
ElevationGridGenerator(float w,
float d,
int wPnts,
int dPnts,
float[] heights,
float baseHeight)
Construct a customised terrain according to the full set of configurable data. |
|
ElevationGridGenerator(float w,
float d,
int wPnts,
int dPnts,
float[] heights,
float baseHeight,
boolean centerOrigin)
Construct a customised terrain according to the full set of configurable data. |
Method Summary | |
---|---|
void |
generate(GeometryData data)
Generate a new set of geometry items based on the passed data. |
float[] |
getDimensions()
Get the dimensions of the terrain. |
int |
getVertexCount(GeometryData data)
Get the number of vertices that this generator will create for the shape given in the definition based on the current width and height information. |
void |
setDimensions(float w,
float d,
int wPnts,
int dPnts)
Change the dimensions of the cone to be generated. |
void |
setTerrainDetail(float[][] heights,
float baseHeight)
Set the details of the terrain height to use a 2D array of values. |
void |
setTerrainDetail(float[] heights,
float baseHeight)
Set the details of the terrain height to use a flat array of values. |
Methods inherited from class org.j3d.geom.GeometryGenerator |
---|
createFaceNormal, createFaceNormal, createRadialNormal, createRadialNormal |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int RELATIVE_HEIGHTS
public static final int ABSOLUTE_HEIGHTS
Constructor Detail |
---|
public ElevationGridGenerator()
public ElevationGridGenerator(float w, float d, int wPnts, int dPnts)
w
- The width of the terraind
- The depth of the terrainwPnts
- The number of heights in the widthdPnts
- The number of heights in the depth
java.lang.IllegalArgumentException
- One of the points were <= 1 or the
dimensions are non-positivepublic ElevationGridGenerator(float w, float d, int wPnts, int dPnts, boolean centerOrigin)
w
- The width of the terraind
- The depth of the terrainwPnts
- The number of heights in the widthdPnts
- The number of heights in the depthcenterOrigin
- Whether to use a center origin or a left corner origin. By default it will be center.
java.lang.IllegalArgumentException
- One of the points were <= 1 or the
dimensions are non-positivepublic ElevationGridGenerator(float w, float d, int wPnts, int dPnts, float[] heights, float baseHeight)
w
- The width of the terraind
- The depth of the terrainwPnts
- The number of heights in the widthdPnts
- The number of heights in the depthheights
- The array of height values to usebaseHeight
- The base height for relative calcs. May be zero
java.lang.IllegalArgumentException
- One of the points were <= 1 or the
dimensions are non-positivepublic ElevationGridGenerator(float w, float d, int wPnts, int dPnts, float[][] heights, float baseHeight)
w
- The width of the terraind
- The depth of the terrainwPnts
- The number of heights in the widthdPnts
- The number of heights in the depthheights
- The array of height values to usebaseHeight
- The base height for relative calcs. May be zero
java.lang.IllegalArgumentException
- One of the points were <= 1 or the
dimensions are non-positivepublic ElevationGridGenerator(float w, float d, int wPnts, int dPnts, float[] heights, float baseHeight, boolean centerOrigin)
w
- The width of the terraind
- The depth of the terrainwPnts
- The number of heights in the widthdPnts
- The number of heights in the depthheights
- The array of height values to usebaseHeight
- The base height for relative calcs. May be zerocenterOrigin
- Whether to use a center origin or a left corner origin
java.lang.IllegalArgumentException
- One of the points were <= 1 or the
dimensions are non-positivepublic ElevationGridGenerator(float w, float d, int wPnts, int dPnts, float[][] heights, float baseHeight, boolean centerOrigin)
w
- The width of the terraind
- The depth of the terrainwPnts
- The number of heights in the widthdPnts
- The number of heights in the depthheights
- The array of height values to usebaseHeight
- The base height for relative calcs. May be zerocenterOrigin
- Whether to use a center origin or a left corner origin
java.lang.IllegalArgumentException
- One of the points were <= 1 or the
dimensions are non-positiveMethod Detail |
---|
public float[] getDimensions()
public void setDimensions(float w, float d, int wPnts, int dPnts)
w
- The width of the terraind
- The depth of the terrainwPnts
- The number of heights in the widthdPnts
- The number of heights in the depth
java.lang.IllegalArgumentException
- One of the points were <= 1 or the
dimensions are non-positivepublic void setTerrainDetail(float[] heights, float baseHeight)
heights
- The array of height values to usebaseHeight
- The base height for relative calcs. May be zeropublic void setTerrainDetail(float[][] heights, float baseHeight)
heights
- The array of height values to usebaseHeight
- The base height for relative calcs. May be zeropublic int getVertexCount(GeometryData data) throws UnsupportedTypeException
getVertexCount
in class GeometryGenerator
data
- The data to base the calculations on
UnsupportedTypeException
- The generator cannot handle the type
of geometry you have requested.public void generate(GeometryData data) throws UnsupportedTypeException, InvalidArraySizeException
generate
in class GeometryGenerator
data
- The data to base the calculations on
InvalidArraySizeException
- The array is not big enough to contain
the requested geometry
UnsupportedTypeException
- The generator cannot handle the type
of geometry you have requested
|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |