Package javax.media.j3d
Class Fog
java.lang.Object
javax.media.j3d.SceneGraphObject
javax.media.j3d.Node
javax.media.j3d.Leaf
javax.media.j3d.Fog
- Direct Known Subclasses:
ExponentialFog
,LinearFog
The Fog leaf node defines a set of fog parameters common to all
types of fog. These parameters include the fog color and a region
of influence in which this Fog node is active.
A Fog node also contains a list of Group nodes that specifies the
hierarchical scope of this Fog. If the scope list is empty, then
the Fog node has universe scope: all nodes within the region of
influence are affected by this Fog node. If the scope list is
non-empty, then only those Leaf nodes under the Group nodes in the
scope list are affected by this Fog node (subject to the
influencing bounds).
If the regions of influence of multiple Fog nodes overlap, the Java 3D system will choose a single set of fog parameters for those objects that lie in the intersection. This is done in an implementation-dependent manner, but in general, the Fog node that is "closest" to the object is chosen.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Specifies that this Fog node allows read access to its color information.static final int
Specifies that this Fog node allows write access to its color information.static final int
Specifies that this Fog node allows read access to its influencing bounds and bounds leaf information.static final int
Specifies that this Fog node allows write access to its influencing bounds and bounds leaf information.static final int
Specifies that this Fog node allows read access to its scope information at runtime.static final int
Specifies that this Fog node allows write access to its scope information at runtime.Fields inherited from class javax.media.j3d.Node
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_LOCALE_READ, ALLOW_PARENT_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Appends the specified Group node to this Fog node's list of scopes.Returns an enumeration of this Fog node's list of scopes.void
getColor
(javax.vecmath.Color3f color) Retrieves the fog color.Retrieves the Fog node's influencing bounding leaf.Retrieves the Fog node's influencing bounds.getScope
(int index) Retrieves the Group node at the specified index from this Fog node's list of scopes.int
indexOfScope
(Group scope) Retrieves the index of the specified Group node in this Fog node's list of scopes.void
insertScope
(Group scope, int index) Inserts the specified Group node into this Fog node's list of scopes at the specified index.int
Returns the number of nodes in this Fog node's list of scopes.void
Removes all Group nodes from this Fog node's list of scopes.void
removeScope
(int index) Removes the node at the specified index from this Fog node's list of scopes.void
removeScope
(Group scope) Removes the specified Group node from this Fog node's list of scopes.void
setColor
(float r, float g, float b) Sets the fog color to the specified color.void
setColor
(javax.vecmath.Color3f color) Sets the fog color to the specified color.void
Sets the Fog's influencing region to the specified bounding leaf.void
setInfluencingBounds
(Bounds region) Sets the Fog's influencing region to the specified bounds.void
Replaces the node at the specified index in this Fog node's list of scopes with the specified Group node.void
updateNodeReferences
(NodeReferenceTable referenceTable) Callback used to allow a node to check if any nodes referenced by that node have been duplicated via a call tocloneTree
.Methods inherited from class javax.media.j3d.Node
cloneNode, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, duplicateNode, getBounds, getBoundsAutoCompute, getCollidable, getLocale, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString
-
Field Details
-
ALLOW_INFLUENCING_BOUNDS_READ
public static final int ALLOW_INFLUENCING_BOUNDS_READSpecifies that this Fog node allows read access to its influencing bounds and bounds leaf information.- See Also:
-
ALLOW_INFLUENCING_BOUNDS_WRITE
public static final int ALLOW_INFLUENCING_BOUNDS_WRITESpecifies that this Fog node allows write access to its influencing bounds and bounds leaf information.- See Also:
-
ALLOW_COLOR_READ
public static final int ALLOW_COLOR_READSpecifies that this Fog node allows read access to its color information.- See Also:
-
ALLOW_COLOR_WRITE
public static final int ALLOW_COLOR_WRITESpecifies that this Fog node allows write access to its color information.- See Also:
-
ALLOW_SCOPE_READ
public static final int ALLOW_SCOPE_READSpecifies that this Fog node allows read access to its scope information at runtime.- See Also:
-
ALLOW_SCOPE_WRITE
public static final int ALLOW_SCOPE_WRITESpecifies that this Fog node allows write access to its scope information at runtime.- See Also:
-
-
Constructor Details
-
Fog
public Fog()Constructs a Fog node with default parameters. The default values are as follows:-
color : black (0,0,0)
scope : empty (universe scope)
influencing bounds : null
influencing bounding leaf : null
-
Fog
public Fog(javax.vecmath.Color3f color) Constructs a Fog node with the specified fog color.- Parameters:
color
- the fog color
-
Fog
public Fog(float r, float g, float b) Constructs a Fog node with the specified fog color.- Parameters:
r
- the red component of the fog colorg
- the green component of the fog colorb
- the blue component of the fog color
-
-
Method Details
-
setColor
public void setColor(javax.vecmath.Color3f color) Sets the fog color to the specified color.- Parameters:
color
- the new fog color- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
setColor
public void setColor(float r, float g, float b) Sets the fog color to the specified color.- Parameters:
r
- the red component of the fog colorg
- the green component of the fog colorb
- the blue component of the fog color- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
getColor
public void getColor(javax.vecmath.Color3f color) Retrieves the fog color.- Parameters:
color
- the vector that will receive the current fog color- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
setInfluencingBounds
Sets the Fog's influencing region to the specified bounds. This is used when the influencing bounding leaf is set to null.- Parameters:
region
- the bounds that contains the Fog's new influencing region.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
getInfluencingBounds
Retrieves the Fog node's influencing bounds.- Returns:
- this Fog's influencing bounds information
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
setInfluencingBoundingLeaf
Sets the Fog's influencing region to the specified bounding leaf. When set to a value other than null, this overrides the influencing bounds object.- Parameters:
region
- the bounding leaf node used to specify the Fog node's new influencing region.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
getInfluencingBoundingLeaf
Retrieves the Fog node's influencing bounding leaf.- Returns:
- this Fog's influencing bounding leaf information
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
setScope
Replaces the node at the specified index in this Fog node's list of scopes with the specified Group node. By default, Fog nodes are scoped only by their influencing bounds. This allows them to be further scoped by a list of nodes in the hierarchy.- Parameters:
scope
- the Group node to be stored at the specified index.index
- the index of the Group node to be replaced.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graphRestrictedAccessException
- if the specified group node is part of a compiled scene graph
-
getScope
Retrieves the Group node at the specified index from this Fog node's list of scopes.- Parameters:
index
- the index of the Group node to be returned.- Returns:
- the Group node at the specified index.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
insertScope
Inserts the specified Group node into this Fog node's list of scopes at the specified index. By default, Fog nodes are scoped only by their influencing bounds. This allows them to be further scoped by a list of nodes in the hierarchy.- Parameters:
scope
- the Group node to be inserted at the specified index.index
- the index at which the Group node is inserted.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graphRestrictedAccessException
- if the specified group node is part of a compiled scene graph
-
removeScope
public void removeScope(int index) Removes the node at the specified index from this Fog node's list of scopes. If this operation causes the list of scopes to become empty, then this Fog will have universe scope: all nodes within the region of influence will be affected by this Fog node.- Parameters:
index
- the index of the Group node to be removed.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graphRestrictedAccessException
- if the group node at the specified index is part of a compiled scene graph
-
getAllScopes
Returns an enumeration of this Fog node's list of scopes.- Returns:
- an Enumeration object containing all nodes in this Fog node's list of scopes.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
addScope
Appends the specified Group node to this Fog node's list of scopes. By default, Fog nodes are scoped only by their influencing bounds. This allows them to be further scoped by a list of nodes in the hierarchy.- Parameters:
scope
- the Group node to be appended.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graphRestrictedAccessException
- if the specified group node is part of a compiled scene graph
-
numScopes
public int numScopes()Returns the number of nodes in this Fog node's list of scopes. If this number is 0, then the list of scopes is empty and this Fog node has universe scope: all nodes within the region of influence are affected by this Fog node.- Returns:
- the number of nodes in this Fog node's list of scopes.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
indexOfScope
Retrieves the index of the specified Group node in this Fog node's list of scopes.- Parameters:
scope
- the Group node to be looked up.- Returns:
- the index of the specified Group node; returns -1 if the object is not in the list.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
removeScope
Removes the specified Group node from this Fog node's list of scopes. If the specified object is not in the list, the list is not modified. If this operation causes the list of scopes to become empty, then this Fog will have universe scope: all nodes within the region of influence will be affected by this Fog node.- Parameters:
scope
- the Group node to be removed.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graphRestrictedAccessException
- if the specified group node is part of a compiled scene graph- Since:
- Java 3D 1.3
-
removeAllScopes
public void removeAllScopes()Removes all Group nodes from this Fog node's list of scopes. The Fog node will then have universe scope: all nodes within the region of influence will be affected by this Fog node.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graphRestrictedAccessException
- if any group node in this node's list of scopes is part of a compiled scene graph- Since:
- Java 3D 1.3
-
updateNodeReferences
Callback used to allow a node to check if any nodes referenced by that node have been duplicated via a call tocloneTree
. This method is called bycloneTree
after all nodes in the sub-graph have been duplicated. The cloned Leaf node's method will be called and the Leaf node can then look up any node references by using thegetNewObjectReference
method found in theNodeReferenceTable
object. If a match is found, a reference to the corresponding Node in the newly cloned sub-graph is returned. If no corresponding reference is found, either a DanglingReferenceException is thrown or a reference to the original node is returned depending on the value of theallowDanglingReferences
parameter passed in thecloneTree
call.NOTE: Applications should not call this method directly. It should only be called by the cloneTree method.
- Overrides:
updateNodeReferences
in classSceneGraphObject
- Parameters:
referenceTable
- a NodeReferenceTableObject that contains thegetNewObjectReference
method needed to search for new object instances.- See Also:
-