|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjme.locale.external.Terrain
Terrain
defines an abstract class for rendering height map
data. The subclass is responsible for setting the height data as well as
updating and rendering.
Field Summary | |
protected int |
detailId
detailId is the texture id for the detail map. |
protected GL |
gl
gl the OpenGL context. |
protected AbstractHeightMap |
heightData
heightData the height map used to represent the terrain. |
protected boolean |
isDetailed
isDetailed denotes if multitextured detail mapping is
to be used. |
protected boolean |
isLit
isLit denotes if a light map is to be used. |
protected boolean |
isTextured
isTextured denotes if a texture map is to be applied
to the terrain. |
protected AbstractLightMap |
lightMap
lightMap the map used to contain shade values. |
protected int |
repeatDetailMap
repeatDetailMap the number of times to repeat the
detail texture across the terrain. |
protected int |
terrainSize
terrainSize contains the size of the terrain where the
area is terrainSize x terrainSize. |
protected int |
terrainTexture
terrainTexture is the texture id for the terrain map. |
protected boolean |
useDistanceFog
useDistanceFog denotes if distance fog is being used or not. |
protected boolean |
useVolumeFog
useVolumeFog denotes if volumetric fog is being used or not. |
protected float |
xScale
xScale is the scale of the terrain in the x-axis. |
protected float |
zScale
zScale is the scale of the terrain in the z-axis. |
Constructor Summary | |
Terrain()
|
Method Summary | |
abstract void |
render()
Abstract method to be implemented by the subclass. |
void |
setDetailTexture(java.lang.String detailTexture,
int repeat)
setDetailTexture sets texture to use for detail texturing. |
void |
setDistanceFog(boolean value)
useDistanceFog determines if distance-based fog
will be used. |
void |
setFogAttributes(int mode,
float[] color,
float density,
float start,
float end)
setFogAttributes sets the attributes for how
fog will be used. |
void |
setHeightData(AbstractHeightMap heightData)
setHeightData takes a AbstractHeightMap
to allow the change of data to render. |
void |
setLightMap(AbstractLightMap lightMap)
setLightMap |
void |
setTexture(javax.swing.ImageIcon texture)
setTexture sets the texture used to render the terrain. |
void |
setTexture(java.lang.String texture)
setTexture sets the texture used to render the terrain. |
void |
setVolumetricFog(boolean value)
setVolumetricFog determines if vertex-based fog will
be used. |
protected void |
setVolumetricFogCoord(float height)
setVolumetricFogCoord sets the level of the fog coordinate. |
void |
setVolumetricFogDepth(float depth)
setVolumetricFogDepth sets the depth of the volumetric
fog. |
void |
setXScale(float scale)
setXScale sets the scale of the terrain along the x-axis. |
void |
setZScale(float scale)
setZScale sets the scale of the terrain along the z-axis. |
abstract void |
update(float time)
Abstract method to be implemented by the subclass. |
boolean |
useDistanceFog()
useDistanceFog returns true if distance fog is turned on,
false otherwise. |
boolean |
useVolumetricFog()
useVolumetricFog returns true if volumetric fog is turned on,
false otherwise. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int terrainTexture
terrainTexture
is the texture id for the terrain map.
protected int detailId
detailId
is the texture id for the detail map.
protected int terrainSize
terrainSize
contains the size of the terrain where the
area is terrainSize x terrainSize.
protected boolean isTextured
isTextured
denotes if a texture map is to be applied
to the terrain.
protected boolean isLit
isLit
denotes if a light map is to be used.
protected boolean isDetailed
isDetailed
denotes if multitextured detail mapping is
to be used.
protected int repeatDetailMap
repeatDetailMap
the number of times to repeat the
detail texture across the terrain.
protected AbstractLightMap lightMap
lightMap
the map used to contain shade values.
protected AbstractHeightMap heightData
heightData
the height map used to represent the terrain.
protected GL gl
gl
the OpenGL context.
protected float xScale
xScale
is the scale of the terrain in the x-axis. Default
is 1.0f.
protected float zScale
zScale
is the scale of the terrain in the z-axis. Default
is 1.0f.
protected boolean useVolumeFog
useVolumeFog
denotes if volumetric fog is being used or not.
protected boolean useDistanceFog
useDistanceFog
denotes if distance fog is being used or not.
Constructor Detail |
public Terrain()
Method Detail |
public void setXScale(float scale)
setXScale
sets the scale of the terrain along the x-axis.
scale
- the new x scale.public void setZScale(float scale)
setZScale
sets the scale of the terrain along the z-axis.
scale
- the new z scale.public void setFogAttributes(int mode, float[] color, float density, float start, float end)
setFogAttributes
sets the attributes for how
fog will be used.
mode
- what GL mode to render the fog as (GL.EXP, GL.EXP2, GL.LINEAR).color
- the color of the fog.density
- how thick the fog will be.start
- what distance to start the fog.end
- what distance the fog will be at full capacity.public boolean useDistanceFog()
useDistanceFog
returns true if distance fog is turned on,
false otherwise.
useDistanceFog
in interface Locale
public boolean useVolumetricFog()
useVolumetricFog
returns true if volumetric fog is turned on,
false otherwise.
useVolumetricFog
in interface Locale
public void setDistanceFog(boolean value)
useDistanceFog
determines if distance-based fog
will be used. If true is passed it is enabled otherwise, it is
disabled.
value
- true if distance fog is to be used, false otherwise.public void setVolumetricFogDepth(float depth)
setVolumetricFogDepth
sets the depth of the volumetric
fog.
depth
- the depth of the volumetric fog.public void setVolumetricFog(boolean value)
setVolumetricFog
determines if vertex-based fog will
be used. If true is passed it is enabled, otherwise it is disabled.
value
- true if volumetric fog is to be used, false otherwise.protected void setVolumetricFogCoord(float height)
setVolumetricFogCoord
sets the level of the fog coordinate.
This is dependant on the fogDepth and the height of the terrain.
height
- the height of the terrain.public void setDetailTexture(java.lang.String detailTexture, int repeat)
setDetailTexture
sets texture to use for detail texturing.
setDetailTexture
takes care of determining if the graphics
card can support multitexturing and will turn if off it it doesn't.
detailTexture
- the image file to use for detail texturing.repeat
- the number of times to repeat the detail texture.public void setTexture(java.lang.String texture)
setTexture
sets the texture used to render the terrain.
The texture can be null with will turn off texturing.
texture
- the texture to use for the terrain.public void setTexture(javax.swing.ImageIcon texture)
setTexture
sets the texture used to render the terrain.
The texture can be null with will turn off texturing.
texture
- the texture to use for the terrain.public void setLightMap(AbstractLightMap lightMap)
setLightMap
lightMap
- public void setHeightData(AbstractHeightMap heightData)
setHeightData
takes a AbstractHeightMap
to allow the change of data to render.
heightData
- the new terrain data.
MonkeyRuntimeException
- if heightData is null.public abstract void update(float time)
update
in interface Locale
Locale.update(float)
public abstract void render()
render
in interface Locale
Locale.render()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |