|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jmex.terrain.util.ProceduralTextureGenerator
public class ProceduralTextureGenerator
ProceduralTexture
generates an ImageIcon
using an AbstractHeightMap
and one or more ImageIcon
s
as input textures. The final texture is built based on a pixel's current
height and the values associated with each input image. When adding
an input texture, a low, optimal and high value is given to denote how much
of the RGB value to use for a given output pixel. For example, if a
texture is added with (0, 10, 20), and a pixel is denoted as having a height
of 5 50% of the texture will be used for the output texture. When combining
multiple input textures with overlapping values, you can create a smooth
blending for the output texture.
Currently, the output texture will have the same dimensions as the input
heightmap.
Field Summary | |
---|---|
protected javax.swing.ImageIcon |
proceduralTexture
|
protected int |
size
|
Constructor Summary | |
---|---|
ProceduralTextureGenerator(AbstractHeightMap heightMap)
Constructor instantiates a new ProceduralTexture object
initializing the list for textures and the height map. |
Method Summary | |
---|---|
void |
addTexture(javax.swing.ImageIcon image,
int low,
int optimal,
int high)
addTexture adds an additional texture to the list of
input textures. |
void |
clearTextures()
|
void |
createTexture(int textureSize)
createTexture takes the current height map and
the current loaded textures and produces an ImageIcon
which can be retrieved with a call to getImageIcon . |
javax.swing.ImageIcon |
getImageIcon()
getImageIcon retrieves the procedural texture that
has been created. |
boolean |
saveTexture(java.lang.String filename)
Saves the final texture this class has created to the given filename as a png. |
void |
setHeightMap(AbstractHeightMap hm)
setHeightMap sets the input heightmap to use
for the texture generation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected javax.swing.ImageIcon proceduralTexture
protected int size
Constructor Detail |
---|
public ProceduralTextureGenerator(AbstractHeightMap heightMap)
ProceduralTexture
object
initializing the list for textures and the height map.
heightMap
- the height map to use for the texture generation.Method Detail |
---|
public void createTexture(int textureSize)
createTexture
takes the current height map and
the current loaded textures and produces an ImageIcon
which can be retrieved with a call to getImageIcon
.
public boolean saveTexture(java.lang.String filename)
filename
- The filename to save the texture too.
createTexture(int)
public void addTexture(javax.swing.ImageIcon image, int low, int optimal, int high)
addTexture
adds an additional texture to the list of
input textures. Each texture has a low, optimal and high value
associated with it. This determines how much of the texture color
to use for a particular pixel. Where optimal is 100% of the color,
less than low is 0% and higher than high is 0%. For example if the
values are (0, 10, 20), and the height is 5, then 50% of the
color will be used.
image
- the input texture.low
- the low color value for this texture.optimal
- the optimal color value for this texture.high
- the high color value for this texture.public void clearTextures()
public void setHeightMap(AbstractHeightMap hm)
setHeightMap
sets the input heightmap to use
for the texture generation.
hm
- the new heightmap.
JmeException
- if hm is null.public javax.swing.ImageIcon getImageIcon()
getImageIcon
retrieves the procedural texture that
has been created. Note that this will return null until
createTexture
has been called.
ImageIcon
of the output texture.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |