|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.media.j3d.SceneGraphObject javax.media.j3d.Node javax.media.j3d.Leaf javax.media.j3d.Shape3D edu.d.umn.geometry.ElevationSegment
public class ElevationSegment
ElevationSegment is a specialization of Shape3d. It creates a 3D map of terrain data using an interleaved triangle strip array. Terrain data is passed into ElevationSegment as a two dimensional array of elevations. These are converted into a series of triangle strips to represent their geometry.
Field Summary | |
---|---|
protected static int |
COORD_OFFSET
|
protected static int |
FLOATSPERVERTEX
|
protected javax.vecmath.Color3f |
matColor
|
protected static int |
NORMAL_OFFSET
|
protected static int |
TEXT_OFFSET
|
protected InterleavedTriangleStripArray |
tstrip
|
protected float[] |
vertexData
|
Fields inherited from class javax.media.j3d.Shape3D |
---|
ALLOW_APPEARANCE_OVERRIDE_READ, ALLOW_APPEARANCE_OVERRIDE_WRITE, ALLOW_APPEARANCE_READ, ALLOW_APPEARANCE_WRITE, ALLOW_COLLISION_BOUNDS_READ, ALLOW_COLLISION_BOUNDS_WRITE, ALLOW_GEOMETRY_READ, ALLOW_GEOMETRY_WRITE |
Fields inherited from class javax.media.j3d.Node |
---|
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_LOCALE_READ, ALLOW_PARENT_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING |
Constructor Summary | |
---|---|
ElevationSegment(int[][] elevations,
int startRow,
int startColumn,
int stopRow,
int stopColumn,
int minEl,
int maxEl,
float exageration,
float lowX,
float highX,
float lowZ,
float highZ,
int resolution,
float modelWidth,
float modelLength)
Constructor is reponsible for setting up the appearance/material, computing the triangle strip values (colors, normals, coordinates) stored in vertexData, then creating the actual JAVA 3D geometry. |
Method Summary | |
---|---|
void |
changeExageration(float oldAmount,
float newAmount)
Method to get at the triangle strip's change exageration method. |
float |
getElevationAt(float x,
float z)
Fetches the elevation at a particular location on the terrain map given the x,z coordinates. |
void |
recalcNormals()
Recalculates the normal values so that the lighting effects change when the elevation exageration change. |
void |
setColor(java.awt.Color color)
|
void |
setColor(int i)
store color data into vertex data array. |
void |
setColor(int i,
int elevation,
int minElevation,
int maxElevation)
store color data into vertex data array, compute color based on the elevation's distance between min and max elevations |
void |
setCoordinate(int[][] elevations,
int i,
int row,
int col,
int startRow,
int startColumn,
float exageration)
store coordinate data into vertex data array |
void |
setTexture(javax.media.j3d.Texture2D texture)
Change the texture currently being used. |
protected void |
setTextureCoordinates(int i,
double x,
double y)
Stores texture coordinates into vertex data array. |
protected void |
setupAppearance()
setup the material properties and coloring attributes |
void |
stitchRight(ElevationSegment other)
stitch right of this segment to left of other segment, stitching consists of averaging the normals on the common boundary vertices between segments. |
void |
stitchTop(ElevationSegment other)
stitch top of this segment to bottom of other segment, stitching consists of averaging the normals on the common boundary vertices between segments. |
Methods inherited from class javax.media.j3d.Shape3D |
---|
addGeometry, cloneNode, duplicateNode, getAllGeometries, getAppearance, getAppearanceOverrideEnable, getBounds, getCollisionBounds, getGeometry, getGeometry, indexOfGeometry, insertGeometry, intersect, intersect, intersect, numGeometries, removeAllGeometries, removeGeometry, removeGeometry, setAppearance, setAppearanceOverrideEnable, setCollisionBounds, setGeometry, setGeometry |
Methods inherited from class javax.media.j3d.Node |
---|
cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, getBoundsAutoCompute, getCollidable, getLocale, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable |
Methods inherited from class javax.media.j3d.SceneGraphObject |
---|
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString, updateNodeReferences |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected InterleavedTriangleStripArray tstrip
protected static final int FLOATSPERVERTEX
protected static final int TEXT_OFFSET
protected static final int NORMAL_OFFSET
protected static final int COORD_OFFSET
protected float[] vertexData
protected javax.vecmath.Color3f matColor
Constructor Detail |
---|
public ElevationSegment(int[][] elevations, int startRow, int startColumn, int stopRow, int stopColumn, int minEl, int maxEl, float exageration, float lowX, float highX, float lowZ, float highZ, int resolution, float modelWidth, float modelLength)
modelWidth
- the width of the ElevationModel that this segment belongs to.modelLength
- The Length of the ElevationModel to which this segment belongs.elevations
- two dimensional array of terrain elevation data in metersstartRow
- first row of data to use from elevationsstartColumn
- first column of data to use from elevationsstopRow
- last row of data to use from elevationsstopColumn
- last column of data to use from elevationsminEl
- minimum elevation in elevationsmaxEl
- maximum elevation in elevationsexageration
- amount to exagerate(multiply) elevations bylowX
- starting x coordinate in metershighX
- stopping x coordinate in meterslowZ
- starting z coordinate in metershighZ
- stopping z coordinate in metersresolution
- number of rows/columns of elevation data to skip when mapping. A resolution
of 1 implies mapping every elevation point, a resolution of 10 implies mapping every 10th point.Method Detail |
---|
protected void setupAppearance()
public void setCoordinate(int[][] elevations, int i, int row, int col, int startRow, int startColumn, float exageration)
startColumn
- first column used in elevationselevations
- array of elevationsi
- index into vertexData to store coordinaterow
- elevation rowcol
- elevation columnstartRow
- first row used in elevationsexageration
- elevation exageration factorpublic void setColor(int i, int elevation, int minElevation, int maxElevation)
i
- index into vertexData to store coordinateelevation
- vertex elevation (no exageration)minElevation
- minimum elevation in modelmaxElevation
- maximum elevation in modelpublic void setColor(int i)
i
- The index into the vertexData array.public void setColor(java.awt.Color color)
public void stitchRight(ElevationSegment other)
other
- reference to the segment to the right of this onepublic void stitchTop(ElevationSegment other)
other
- reference to the segment to the right of this onepublic float getElevationAt(float x, float z)
x
- x coordinatez
- z coordinate
public void changeExageration(float oldAmount, float newAmount)
oldAmount
- The old value of the exageration. Used to reset to natural elevation.newAmount
- The new exageration to change to.protected void setTextureCoordinates(int i, double x, double y)
i
- index into vertexData to store coordinatex
- x component of the texture coordinatesy
- y component of the texture coordinatespublic void setTexture(javax.media.j3d.Texture2D texture)
texture
- The new Texture2D to use.public void recalcNormals()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |