Class ModelClip
A ModelClip node also contains a list of Group nodes that specifies the hierarchical scope of this ModelClip. If the scope list is empty, then the ModelClip node has universe scope: all nodes within the region of influence are affected by this ModelClip 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 ModelClip node (subject to the influencing bounds).
If the regions of influence of multiple ModelClip nodes overlap, the Java 3D system will choose a single set of model clip planes for those objects that lie in the intersection. This is done in an implementation-dependent manner, but in general, the ModelClip node that is "closest" to the object is chosen.
The individual planes specify a half-space defined by the equation:
-
Ax + By + Cz + D <= 0
- Since:
- Java 3D 1.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Specifies that the ModelClip node allows read access to its enable flags at runtime.static final int
Specifies that the ModelClip node allows write access to its enable flags at runtime.static final int
Specifies that the ModelClip node allows read access to its influencing bounds and bounding leaf at runtime.static final int
Specifies that the ModelClip node allows write access to its influencing bounds and bounding leaf at runtime.static final int
Specifies that the ModelClip node allows read access to its planes at runtime.static final int
Specifies that the ModelClip node allows write access to its planes at runtime.static final int
Specifies that this ModelClip node allows read access to its scope information at runtime.static final int
Specifies that this ModelClip 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
ConstructorsConstructorDescriptionConstructs a ModelClip node with default parameters.ModelClip
(javax.vecmath.Vector4d[] planes) Constructs a ModelClip node using the specified planes.ModelClip
(javax.vecmath.Vector4d[] planes, boolean[] enables) Constructs a ModelClip node using the specified planes and enable flags. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Appends the specified Group node to this ModelClip node's list of scopes.cloneNode
(boolean forceDuplicate) Used to create a new instance of the node.Returns an enumeration of this ModelClip node's list of scopes.boolean
getEnable
(int planeNum) Retrieves the specified enable flag from this ModelClip node.void
getEnables
(boolean[] enables) Retrieves the per-plane enable flags from this ModelClip node.Retrieves the ModelClip node's influencing bounding leaf.Retrieves the ModelClip node's influencing bounds.void
getPlane
(int planeNum, javax.vecmath.Vector4d plane) Retrieves the specified clipping plane from this ModelClip node.void
getPlanes
(javax.vecmath.Vector4d[] planes) Retrieves the clipping planes from this ModelClip node.getScope
(int index) Retrieves the Group node at the specified index from this ModelClip node's list of scopes.int
indexOfScope
(Group scope) Retrieves the index of the specified Group node in this ModelClip node's list of scopes.void
insertScope
(Group scope, int index) Inserts the specified Group node into this ModelClip node's list of scopes at the specified index.int
Returns the number of nodes in this ModelClip node's list of scopes.void
Removes all Group nodes from this ModelClip node's list of scopes.void
removeScope
(int index) Removes the node at the specified index from this ModelClip node's list of scopes.void
removeScope
(Group scope) Removes the specified Group node from this ModelClip node's list of scopes.void
setEnable
(int planeNum, boolean enable) Sets the specified enable flag of this ModelClip node.void
setEnables
(boolean[] enables) Sets the per-plane enable flags of this ModelClip node to the specified values.void
Set the ModelClip node's influencing region to the specified bounding leaf.void
setInfluencingBounds
(Bounds region) Set the ModelClip node's influencing region to the specified bounds.void
setPlane
(int planeNum, javax.vecmath.Vector4d plane) Sets the specified clipping plane of this ModelClip node.void
setPlanes
(javax.vecmath.Vector4d[] planes) Sets the clipping planes of this ModelClip node to the specified planes.void
Replaces the node at the specified index in this ModelClip node's list of scopes with the specified Group node.void
updateNodeReferences
(NodeReferenceTable referenceTable) Callback used to allow a node to check if any scene graph objects referenced by that node have been duplicated via a call tocloneTree
.Methods inherited from class javax.media.j3d.Node
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 the ModelClip node allows read access to its influencing bounds and bounding leaf at runtime.- See Also:
-
ALLOW_INFLUENCING_BOUNDS_WRITE
public static final int ALLOW_INFLUENCING_BOUNDS_WRITESpecifies that the ModelClip node allows write access to its influencing bounds and bounding leaf at runtime.- See Also:
-
ALLOW_PLANE_READ
public static final int ALLOW_PLANE_READSpecifies that the ModelClip node allows read access to its planes at runtime.- See Also:
-
ALLOW_PLANE_WRITE
public static final int ALLOW_PLANE_WRITESpecifies that the ModelClip node allows write access to its planes at runtime.- See Also:
-
ALLOW_ENABLE_READ
public static final int ALLOW_ENABLE_READSpecifies that the ModelClip node allows read access to its enable flags at runtime.- See Also:
-
ALLOW_ENABLE_WRITE
public static final int ALLOW_ENABLE_WRITESpecifies that the ModelClip node allows write access to its enable flags at runtime.- See Also:
-
ALLOW_SCOPE_READ
public static final int ALLOW_SCOPE_READSpecifies that this ModelClip node allows read access to its scope information at runtime.- See Also:
-
ALLOW_SCOPE_WRITE
public static final int ALLOW_SCOPE_WRITESpecifies that this ModelClip node allows write access to its scope information at runtime.- See Also:
-
-
Constructor Details
-
ModelClip
public ModelClip()Constructs a ModelClip node with default parameters. The default values are as follows:-
planes[0] : x <= 1 (1,0,0,-1)
planes[1] : -x <= 1 (-1,0,0,-1)
planes[2] : y <= 1 (0,1,0,-1)
planes[3] : -y <= 1 (0,-1,0,-1)
planes[4] : z <= 1 (0,0,1,-1)
planes[5] : -z <= 1 (0,0,-1,-1)
enables : all planes enabled
scope : empty (universe scope)
influencing bounds : null
influencing bounding leaf : null
-
ModelClip
public ModelClip(javax.vecmath.Vector4d[] planes) Constructs a ModelClip node using the specified planes. The individual planes are copied into this node. All planes are enabled.- Parameters:
planes
- an array of 6 model clipping planes
-
ModelClip
public ModelClip(javax.vecmath.Vector4d[] planes, boolean[] enables) Constructs a ModelClip node using the specified planes and enable flags. The individual planes and enable flags are copied into this node.- Parameters:
planes
- an array of 6 model clipping planesenables
- an array of 6 enable flags
-
-
Method Details
-
setInfluencingBounds
Set the ModelClip node'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 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 ModelClip node's influencing bounds.- Returns:
- this node's influencing bounds information
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
setInfluencingBoundingLeaf
Set the ModelClip node'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 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 ModelClip node's influencing bounding leaf.- Returns:
- this node'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 ModelClip node's list of scopes with the specified Group node. By default, ModelClip 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 ModelClip 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 ModelClip node's list of scopes at the specified index. By default, ModelClip 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 ModelClip node's list of scopes. If this operation causes the list of scopes to become empty, then this ModelClip will have universe scope: all nodes within the region of influence will be affected by this ModelClip 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 ModelClip node's list of scopes.- Returns:
- an Enumeration object containing all nodes in this ModelClip 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 ModelClip node's list of scopes. By default, ModelClip 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 ModelClip node's list of scopes. If this number is 0, then the list of scopes is empty and this ModelClip node has universe scope: all nodes within the region of influence are affected by this ModelClip node.- Returns:
- the number of nodes in this ModelClip 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 ModelClip 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 ModelClip 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 ModelClip will have universe scope: all nodes within the region of influence will be affected by this ModelClip 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 ModelClip node's list of scopes. The ModelClip node will then have universe scope: all nodes within the region of influence will be affected by this ModelClip 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
-
setPlanes
public void setPlanes(javax.vecmath.Vector4d[] planes) Sets the clipping planes of this ModelClip node to the specified planes. The individual planes are copied into this node.- Parameters:
planes
- an array of 6 model clipping planes
-
getPlanes
public void getPlanes(javax.vecmath.Vector4d[] planes) Retrieves the clipping planes from this ModelClip node. The individual planes are copied into the specified planes, which must be allocated by the caller. The array must be large enough to hold all of the vectors.- Parameters:
planes
- an array of 6 vectors that will receive the model clipping planes from this node
-
setPlane
public void setPlane(int planeNum, javax.vecmath.Vector4d plane) Sets the specified clipping plane of this ModelClip node. The specified plane is copied into this node.- Parameters:
planeNum
- specifies which model clipping plane (0-5) is replacedplane
- new model clipping plane
-
getPlane
public void getPlane(int planeNum, javax.vecmath.Vector4d plane) Retrieves the specified clipping plane from this ModelClip node. The plane is copied into the specified plane, which must be allocated by the caller.- Parameters:
planeNum
- specifies which model clipping plane (0-5) is retrievedplane
- a vector that will receive the specified model clipping plane from this node
-
setEnables
public void setEnables(boolean[] enables) Sets the per-plane enable flags of this ModelClip node to the specified values.- Parameters:
enables
- an array of 6 enable flags
-
getEnables
public void getEnables(boolean[] enables) Retrieves the per-plane enable flags from this ModelClip node. The enable flags are copied into the specified array. The array must be large enough to hold all of the enables.- Parameters:
enables
- an array of 6 booleans that will receive the enable flags from this node
-
setEnable
public void setEnable(int planeNum, boolean enable) Sets the specified enable flag of this ModelClip node.- Parameters:
planeNum
- specifies which enable flag (0-5) is setenable
- new enable flag
-
getEnable
public boolean getEnable(int planeNum) Retrieves the specified enable flag from this ModelClip node.- Parameters:
planeNum
- specifies which enable flag (0-5) is retrieved- Returns:
- the specified enable flag
-
cloneNode
Used to create a new instance of the node. This routine is called bycloneTree
to duplicate the current node. -
updateNodeReferences
Callback used to allow a node to check if any scene graph objects 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 object references by using thegetNewObjectReference
method found in theNodeReferenceTable
object. If a match is found, a reference to the corresponding object 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 object 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:
-