|
j3d.org Aviatrix3D | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.j3d.aviatrix3d.SceneGraphObject
org.j3d.aviatrix3d.Node
org.j3d.aviatrix3d.Leaf
org.j3d.aviatrix3d.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.
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, updateHandler, WRITE_TIMING_MSG |
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 |
float |
getDensityRate()
Get the current decay rate. |
void |
getLinearDistance(float[] values)
Get the two distance values for the linear fog settings. |
int |
getMode()
Get the current decay rate. |
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(net.java.games.jogl.GL gl,
net.java.games.jogl.GLU glu)
Restore all openGL state to the given drawable. |
void |
render(net.java.games.jogl.GL gl,
net.java.games.jogl.GLU glu)
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 |
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, setBounds, setLive, setParent, updateBounds |
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject |
checkForCyclicChild, dataChanged, getUserData, isLive, setUpdateHandler, setUserData |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 void render(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
render
in interface RenderableObject
gl
- The gl context to draw withglu
- The utility context to draw withpublic void postRender(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
postRender
in interface RenderableObject
gl
- The gl context to draw withglu
- The utility context to draw withprotected void markBoundsDirty()
markBoundsDirty
in class Node
public int compareTo(java.lang.Object o) throws java.lang.ClassCastException
Derived classes should extend this one to add the extra comparisons needed.
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)
o
- The object to be compared
public void setEnabled(boolean state) throws InvalidWriteTimingException
state
- The new state of the light
InvalidWriteTimingException
public boolean isEnabled()
public void setColor(float[] c) throws InvalidWriteTimingException
c
- The colour to copy in
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener 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 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 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 callback methodpublic int getMode()
public 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 callback methodpublic boolean isGlobalOnly()
public int compareTo(Fog fog)
Derived classes should extend this one to add the extra comparisons needed.
fog
- The program instance to be compared
public boolean equals(Fog fog)
fog
- The program instance to be compared
|
j3d.org Aviatrix3D | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |