|
Aviatrix3D 2.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.j3d.aviatrix3d.SceneGraphObject org.j3d.aviatrix3d.Node org.j3d.aviatrix3d.Leaf org.j3d.aviatrix3d.Fog
public class Fog
Describes a fog rendering effect.
All types of fog are reprensented in a single class. If the parameter type is not useful for the fog mode, it is ignored.
Fog may act either locally or globally. If an instance of the fog node is registered with the ViewEnvironment, then it shall act as a global fog effect for the world. If it is not, then may act as a local effect, scoped the group node that contains it (like lights). Local fog effects must be explicitly enabled, otherwise only the global is used. If, during a traversal from the root of the tree down to a leaf, multiple Fog node instances are encountered, then only the closest to the Leaf is used. If multiple instances are provided in the same Group node instance, the chosen one is implementation independent.
When combined with fog coordinates on the geometry, local fog provides volumetric fog effects.
By default, fog is not enabled and global only.
Rendering Implementation Tips
See the EffectRenderable
interface for definition of the scoping
and effects bounds.
Internationalisation Resource Names
Field Summary | |
---|---|
static int |
EXPONENTIAL
Set the fog mode to exponential curve |
static int |
EXPONENTIAL_2
Set the fog mode to exponential-squared curve |
static int |
LINEAR
Set the fog mode to linear |
Fields inherited from class org.j3d.aviatrix3d.Node |
---|
bounds, implicitBounds, INVALID_BOUNDS, parent |
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject |
---|
alive, LISTENER_SET_TIMING_ERR_PROP, updateHandler |
Fields inherited from interface org.j3d.aviatrix3d.rendering.LeafCullable |
---|
AUDIO_CULLABLE, CLIP_CULLABLE, FOG_CULLABLE, GEOMETRY_CULLABLE, LIGHT_CULLABLE, OVERRIDE_CULLABLE |
Constructor Summary | |
---|---|
Fog()
Constructs a fog node with the default mode set to linear the colour set to white and global only. |
|
Fog(float[] c)
Construct a fog using the given colour and assumes a linear mode. |
|
Fog(float[] c,
boolean global)
Construct a fog using the given colour and choice of gloval effect, assuming a linear mode. |
|
Fog(int mode)
Construct a fog using the given mode and with the colour set to white. |
|
Fog(int mode,
boolean global)
Construct a fog using the given mode and the option of selecting local or global effects. |
|
Fog(int mode,
float[] c)
Construct a fog using the given mode and colour. |
|
Fog(int mode,
float[] c,
boolean global)
Construct a fog using the given mode and colour and selection of global state. |
Method Summary | |
---|---|
int |
compareTo(Fog fog)
Compares this object with the specified object for order. |
int |
compareTo(java.lang.Object o)
Compares this object with the specified object for order. |
boolean |
equals(Fog fog)
Compares this object with the specified object to check for equivalence. |
boolean |
equals(java.lang.Object o)
Compare this object for equality to the given object. |
void |
getColor(float[] c)
Get the current drawing colour |
int |
getCullableType()
Get the type that this cullable represents. |
float |
getDensityRate()
Get the current decay rate. |
BoundingVolume |
getEffectBounds()
Get the current bounding volume that this light effects. |
void |
getLinearDistance(float[] values)
Get the two distance values for the linear fog settings. |
int |
getMode()
Get the current decay rate. |
Renderable |
getRenderable()
Get the child renderable of this object. |
boolean |
isEnabled()
Get the current enabled state of the light. |
boolean |
isGlobalOnly()
Get the current setting of the global-only flag. |
protected void |
markBoundsDirty()
Mark this node as having dirty bounds due to one of it's children having their bounds changed. |
void |
postRender(javax.media.opengl.GL gl)
Restore all openGL state to the given drawable. |
void |
render(javax.media.opengl.GL gl)
Issue ogl commands needed for this component |
void |
setColor(float[] c)
Change the fog colour to the new colour. |
void |
setDensityRate(float rate)
Set the exponential decay factor. |
void |
setEffectBounds(BoundingVolume bounds)
Set the bounds that will effect the range of this light. |
void |
setEnabled(boolean state)
Set the enabled state of the light. |
void |
setGlobalOnly(boolean enable)
Set whether the fog should act in local or global mode. |
void |
setLinearDistance(float start,
float end)
Set the distance functions for the fog when in linear mode. |
void |
setMode(int type)
Set the type of fog to be rendered. |
Methods inherited from class org.j3d.aviatrix3d.Node |
---|
boundsChanged, checkForCyclicParent, getBounds, getParent, recomputeBounds, removeParent, requestBoundsUpdate, setBounds, setParent, updateBounds, updateParentBounds |
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject |
---|
checkForCyclicChild, dataChanged, getAppUpdateWriteTimingMessage, getBoundsWriteTimingMessage, getDataWriteTimingMessage, getUserData, isLive, setLive, setUpdateHandler, setUserData |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.j3d.aviatrix3d.rendering.LeafCullable |
---|
getBounds |
Field Detail |
---|
public static final int EXPONENTIAL
public static final int EXPONENTIAL_2
public static final int LINEAR
Constructor Detail |
---|
public Fog()
public Fog(int mode)
mode
- One of LINEAR, EXPONENTIAL or EXPONENTIAL_2public Fog(int mode, boolean global)
mode
- One of LINEAR, EXPONENTIAL or EXPONENTIAL_2global
- true if this is a global-only fog effectpublic Fog(int mode, float[] c)
mode
- One of LINEAR, EXPONENTIAL or EXPONENTIAL_2c
- The initial colour to use for the fogpublic Fog(float[] c)
c
- The initial colour to use for the fogpublic Fog(float[] c, boolean global)
c
- The initial colour to use for the fogglobal
- true if this is a global-only fog effectpublic Fog(int mode, float[] c, boolean global)
mode
- One of LINEAR, EXPONENTIAL or EXPONENTIAL_2c
- The initial colour to use for the fogglobal
- true if this is a global-only fog effectMethod Detail |
---|
public int getCullableType()
getCullableType
in interface LeafCullable
public Renderable getRenderable()
getRenderable
in interface LeafCullable
public boolean isEnabled()
isEnabled
in interface CascadeRenderable
public boolean isGlobalOnly()
isGlobalOnly
in interface EffectRenderable
public BoundingVolume getEffectBounds()
getEffectBounds
in interface EffectRenderable
public void render(javax.media.opengl.GL gl)
render
in interface ObjectRenderable
gl
- The gl context to draw withpublic void postRender(javax.media.opengl.GL gl)
postRender
in interface ObjectRenderable
gl
- The gl context to draw withprotected void markBoundsDirty()
markBoundsDirty
in class Node
public int compareTo(java.lang.Object o) throws java.lang.ClassCastException
compareTo
in interface java.lang.Comparable
o
- The objec to be compared
java.lang.ClassCastException
- The specified object's type prevents it from
being compared to this Objectpublic boolean equals(java.lang.Object o)
equals
in interface Renderable
equals
in class java.lang.Object
o
- The object to be compared
public void setEnabled(boolean state) throws InvalidWriteTimingException
state
- The new state of the light
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener data changed callback methodpublic void setGlobalOnly(boolean enable) throws InvalidWriteTimingException
enable
- true to force this fog to be used for global rendering only
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener data changed callback methodpublic void setEffectBounds(BoundingVolume bounds) throws InvalidWriteTimingException
bounds
- A volume to use or null to clear
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener data changed callback methodpublic void setColor(float[] c) throws InvalidWriteTimingException
c
- The colour to copy in
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener data changed callback methodpublic void getColor(float[] c)
c
- An array of length 3 or more to copy the colour topublic void setLinearDistance(float start, float end) throws InvalidWriteTimingException
start
- The closest distance that fog starts atend
- The distance that the fog is fully opaque at
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener data changed callback methodpublic void getLinearDistance(float[] values)
values
- An array to copy the values intopublic void setDensityRate(float rate) throws InvalidWriteTimingException
rate
- A value that should be greater than zero
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener data changed callback methodpublic float getDensityRate()
public void setMode(int type) throws InvalidWriteTimingException
type
- One of EXPONENTIAL, EXPONENTIAL_2, or LINEAR
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener data changed callback methodpublic int getMode()
public int compareTo(Fog fog)
fog
- The program instance to be compared
public boolean equals(Fog fog)
fog
- The program instance to be compared
|
Aviatrix3D 2.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |