|
JSR-184 Public Review Draft - Apr. 30, 2003. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.microedition.m3d.Object3D | +--javax.microedition.m3d.Fog
An Appearance component encapsulating attributes for fogging.
Field Summary | |
static int |
FOG_EXPONENTIAL
Specifies exponential fog. |
static int |
FOG_LINEAR
Specifies linear fog. |
Fields inherited from class javax.microedition.m3d.Object3D |
userObject |
Constructor Summary | |
Fog()
Constructs a new Fog object with default values. |
Method Summary | |
int |
getColor()
Returns the current fog color. |
float |
getDensity()
Returns the fog density of exponential fog. |
float |
getFarDistance()
Returns the linear fog end distance. |
int |
getMode()
Retrieves the current fog mode. |
float |
getNearDistance()
Returns the linear fog near distance. |
void |
setColor(int RGB)
Sets the fog folor. |
void |
setDensity(float density)
Sets the fog density for exponential fog. |
void |
setLinear(float near,
float far)
Sets the near and far distances for linear fog. |
void |
setMode(int mode)
Sets the fog mode to either linear or exponential. |
Methods inherited from class javax.microedition.m3d.Object3D |
addAnimationTrack, animate, clone, find, getAnimationTrack, getAnimationTrackCount, getReferences, getUserID, removeAnimationTrack, setUserID |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int FOG_LINEAR
Specifies linear fog. The fog blending factor f is calculated according to the formula:
f = (far - z) / (far - near),where z is the distance, in camera coordinates, from the camera origin to the fragment center; and near and far are the distances set in
setLinear
.
public static final int FOG_EXPONENTIAL
Specifies exponential fog. The fog blending factor f is calculated according to the formula:
f = exp(-dz),where z is the distance, in camera coordinates, from the camera origin to the fragment center; and d is the fog density set in
setDensity
.
Constructor Detail |
public Fog()
Constructs a new Fog object with default values. The default values are:
FOG_LINEAR
Method Detail |
public void setMode(int mode)
Sets the fog mode to either linear or exponential.
mode
- either FOG_LINEAR
or FOG_EXPONENTIAL
java.lang.IllegalArgumentException
- if mode
is not
one of the constant values listed abovegetMode
public int getMode()
Retrieves the current fog mode.
FOG_LINEAR
or FOG_EXPONENTIAL
setMode
public void setLinear(float near, float far)
Sets the near and far distances for linear fog. Note that the near distance does not have to be smaller than the far distance, although that is usually the case. The distances are not allowed to be equal, however.
near
- distance to the linear fog near planefar
- distance to the linear fog far plane
java.lang.IllegalArgumentException
- if near = far
public float getNearDistance()
Returns the linear fog near distance.
setLinear
public float getFarDistance()
Returns the linear fog end distance.
setLinear
public void setDensity(float density)
Sets the fog density for exponential fog.
density
- the fog density in floating pointgetDensity
public float getDensity()
Returns the fog density of exponential fog.
setDensity
public void setColor(int RGB)
Sets the fog folor. The high order byte of the color value (that is, the alpha component) is ignored.
RGB
- the new fog color in 0x00RRGGBB formatgetColor
public int getColor()
Returns the current fog color.
setColor
|
JSR-184 Public Review Draft - Apr. 30, 2003. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |