| java.lang.Object javax.media.j3d.SceneGraphObject javax.media.j3d.Node javax.media.j3d.Leaf javax.media.j3d.Morph
Morph | public class Morph extends Leaf (Code) | | The Morph leaf node permits an application to morph between
multiple GeometryArrays. The Morph node contains a single
Appearance node, an array of GeometryArray objects, and an array of
corresponding weights. The Morph node combines these GeometryArrays
into an aggregate shape based on each GeometryArray's corresponding
weight. Typically, Behavior nodes will modify the weights to
achieve various morphing effects.
The following restrictions apply to each GeometryArray object
in the specified array of GeometryArray objects:
-
All N geometry arrays must be of the
same type (that is, the same subclass of GeometryArray).
-
The vertexFormat, texCoordSetCount, and validVertexCount must be
the same for all N geometry arrays.
-
The texCoordSetMap array must be identical (element-by-element) for
all N geometry arrays.
-
For IndexedGeometryArray objects, the validIndexCount must be the same
for all N geometry arrays.
-
For GeometryStripArray objects, the stripVertexCounts array must
be identical (element-by-element) for all N geometry arrays.
-
For IndexedGeometryStripArray objects, the stripIndexCounts array must
be identical (element-by-element) for all N geometry arrays.
-
For indexed geometry by-reference, the array lengths of each
enabled vertex component (coord, color, normal, texcoord)
must be the same for all N geometry arrays.
For IndexedGeometryArray objects, the vertex arrays are morphed
before the indexes are applied. Only the indexes in the
first geometry array (geometry[0]) are used when rendering the
geometry.
|
Constructor Summary | |
| Morph() | public | Morph(GeometryArray geometryArrays) Constructs and initializes a Morph node with the specified array
of GeometryArray objects. | public | Morph(GeometryArray geometryArrays, Appearance appearance) Constructs and initializes a Morph node with the specified array
of GeometryArray objects and the specified appearance object.
Parameters: geometryArrays - the geometry components of the Morph nodea null or zero-length array of GeometryArray objects ispermitted, and specifies that no geometry is drawn. |
Method Summary | |
public Node | cloneNode(boolean forceDuplicate) Creates a new instance of the node. | void | createRetained() Creates the retained mode MorphRetained object that this
Morph object will point to. | void | duplicateAttributes(Node originalNode, boolean forceDuplicate) Copies all Morph information from
originalNode into
the current node. | public void | duplicateNode(Node originalNode, boolean forceDuplicate) Copies all node information from originalNode into
the current node. | public Appearance | getAppearance() Retrieves the appearance component of this morph node. | public boolean | getAppearanceOverrideEnable() Retrieves the appearanceOverrideEnable flag for this node. | public Bounds | getCollisionBounds() Returns the collision bounding object of this node. | public GeometryArray | getGeometryArray(int index) Retrieves the geometryArray component of this Morph node. | public double[] | getWeights() Retrieves the Morph node's morph weight vector. | public boolean | intersect(SceneGraphPath path, PickShape pickShape) Checks whether the geometry in this morph node intersects with
the specified pickShape. | public boolean | intersect(SceneGraphPath path, PickRay pickRay, double[] dist) Checks whether the geometry in this morph node intersects with
the specified pickRay.
Parameters: path - the SceneGraphPath to this morph node Parameters: pickRay - the PickRay to be intersected Parameters: dist - the closest distance of the intersection true if the pick shape intersects this node; falseotherwise. | public boolean | intersect(SceneGraphPath path, PickShape pickShape, double[] dist) Checks whether the geometry in this morph node intersects with
the specified pickShape.
Parameters: path - the SceneGraphPath to this morph node Parameters: pickShape - the PickShape to be intersected Parameters: dist - the closest distance of the intersection true if the pick shape intersects this node; falseotherwise. | public void | setAppearance(Appearance appearance) Sets the appearance component of this Morph node. | public void | setAppearanceOverrideEnable(boolean flag) Sets a flag that indicates whether this node's appearance can
be overridden. | public void | setCollisionBounds(Bounds bounds) Sets the collision bounds of a node. | public void | setGeometryArrays(GeometryArray geometryArrays) Sets the geometryArrays component of the Morph node.
If the current array of GeometryArrays in this Morph object is
non-null with a length greater than 0, the specified array of
GeometryArrays must be the same length as the current array.
If the current array of GeometryArrays in this Morph object is
null or has a length of 0, and the specified array of
GeometryArrays is non-null with a length greater than 0, the
length of the incoming array defines the number of the geometry
objects that will be morphed. | public void | setWeights(double weights) Sets this Morph node's morph weight vector. |
ALLOW_APPEARANCE_OVERRIDE_READ | final public static int ALLOW_APPEARANCE_OVERRIDE_READ(Code) | | Specifies that this node allows reading its appearance override
enable flag.
since: Java 3D 1.2 |
ALLOW_APPEARANCE_OVERRIDE_WRITE | final public static int ALLOW_APPEARANCE_OVERRIDE_WRITE(Code) | | Specifies that this node allows writing its appearance override
enable flag.
since: Java 3D 1.2 |
ALLOW_APPEARANCE_READ | final public static int ALLOW_APPEARANCE_READ(Code) | | Specifies that the node allows read access to its appearance information.
|
ALLOW_APPEARANCE_WRITE | final public static int ALLOW_APPEARANCE_WRITE(Code) | | Specifies that the node allows write access to its appearance information.
|
ALLOW_COLLISION_BOUNDS_READ | final public static int ALLOW_COLLISION_BOUNDS_READ(Code) | | Specifies that the node allows reading its collision Bounds.
|
ALLOW_COLLISION_BOUNDS_WRITE | final public static int ALLOW_COLLISION_BOUNDS_WRITE(Code) | | Specifies the node allows writing its collision Bounds.
|
ALLOW_GEOMETRY_ARRAY_READ | final public static int ALLOW_GEOMETRY_ARRAY_READ(Code) | | Specifies that the node allows read access to its geometry information.
|
ALLOW_GEOMETRY_ARRAY_WRITE | final public static int ALLOW_GEOMETRY_ARRAY_WRITE(Code) | | Specifies that the node allows write access to its geometry information.
|
ALLOW_WEIGHTS_READ | final public static int ALLOW_WEIGHTS_READ(Code) | | Specifies that the node allows read access to its morph
weight vector.
|
ALLOW_WEIGHTS_WRITE | final public static int ALLOW_WEIGHTS_WRITE(Code) | | Specifies that the node allows write access to its morph
weight vector.
|
Morph | public Morph(GeometryArray geometryArrays)(Code) | | Constructs and initializes a Morph node with the specified array
of GeometryArray objects. Default values are used for all other
parameters as follows:
appearance : null
weights : [1, 0, 0, 0, ...]
collision bounds : null
appearance override enable : false
A null appearance object specifies that default values are used
for all appearance attributes.
Parameters: geometryArrays - the geometry components of the morph;a null or zero-length array of GeometryArray objects ispermitted, and specifies that no geometry is drawn. In this case,the array of weights is initialized to a zero-length array. exception: IllegalArgumentException - if any of the specifiedgeometry array objects differ from each other in any of thefollowing ways: - Type of geometry array object (subclass of GeometryArray)
- vertexFormat
- texCoordSetCount
- texCoordSetMap
- validVertexCount
- validIndexCount, for IndexedGeometryArray objects
- stripVertexCounts array, for GeometryStripArray objects
- stripIndexCounts array, for IndexedGeometryStripArray objects
- the array lengths of each enabled vertex component(coord, color, normal, texcoord),for indexed geometry by-reference
exception: UnsupportedOperationException - if the specifiedgeometry arrays contain vertex attributes (that is, if theirvertexFormat includes the VERTEX_ATTRIBUTES flag). |
Morph | public Morph(GeometryArray geometryArrays, Appearance appearance)(Code) | | Constructs and initializes a Morph node with the specified array
of GeometryArray objects and the specified appearance object.
Parameters: geometryArrays - the geometry components of the Morph nodea null or zero-length array of GeometryArray objects ispermitted, and specifies that no geometry is drawn. In this case,the array of weights is initialized to a zero-length array. Parameters: appearance - the appearance component of the Morph node exception: IllegalArgumentException - if any of the specifiedgeometry array objects differ from each other in any of thefollowing ways:- Type of geometry array object (subclass of GeometryArray)
- vertexFormat
- texCoordSetCount
- texCoordSetMap
- validVertexCount
- validIndexCount, for IndexedGeometryArray objects
- stripVertexCounts array, for GeometryStripArray objects
- stripIndexCounts array, for IndexedGeometryStripArray objects
- the array lengths of each enabled vertex component(coord, color, normal, texcoord),for indexed geometry by-reference
exception: UnsupportedOperationException - if the specifiedgeometry arrays contain vertex attributes (that is, if theirvertexFormat includes the VERTEX_ATTRIBUTES flag). |
cloneNode | public Node cloneNode(boolean forceDuplicate)(Code) | | Creates a new instance of the node. This routine is called
by cloneTree to duplicate the current node.
Parameters: forceDuplicate - when set to true , causes theduplicateOnCloneTree flag to be ignored. Whenfalse , the value of each node'sduplicateOnCloneTree variable determines whetherNodeComponent data is duplicated or copied. See Also: Node.cloneTree See Also: Node.cloneNode See Also: Node.duplicateNode See Also: NodeComponent.setDuplicateOnCloneTree |
createRetained | void createRetained()(Code) | | Creates the retained mode MorphRetained object that this
Morph object will point to.
|
duplicateAttributes | void duplicateAttributes(Node originalNode, boolean forceDuplicate)(Code) | | Copies all Morph information from
originalNode into
the current node. This method is called from the
cloneNode method which is, in turn, called by the
cloneTree method.
Parameters: originalNode - the original node to duplicate. Parameters: forceDuplicate - when set to true , causes theduplicateOnCloneTree flag to be ignored. Whenfalse , the value of each node'sduplicateOnCloneTree variable determines whetherNodeComponent data is duplicated or copied. exception: RestrictedAccessException - if this object is part of a liveor compiled scenegraph. See Also: Node.duplicateNode See Also: Node.cloneTree See Also: NodeComponent.setDuplicateOnCloneTree |
duplicateNode | public void duplicateNode(Node originalNode, boolean forceDuplicate)(Code) | | Copies all node information from originalNode into
the current node. This method is called from the
cloneNode method which is, in turn, called by the
cloneTree method.
For any NodeComponent objects
contained by the object being duplicated, each NodeComponent
object's duplicateOnCloneTree value is used to determine
whether the NodeComponent should be duplicated in the new node
or if just a reference to the current node should be placed in the
new node. This flag can be overridden by setting the
forceDuplicate parameter in the cloneTree
method to true .
NOTE: Applications should not call this method directly.
It should only be called by the cloneNode method.
Parameters: originalNode - the original node to duplicate. Parameters: forceDuplicate - when set to true , causes theduplicateOnCloneTree flag to be ignored. Whenfalse , the value of each node'sduplicateOnCloneTree variable determines whetherNodeComponent data is duplicated or copied. exception: ClassCastException - if originalNode is not an instance of Morph See Also: Node.cloneTree See Also: Node.cloneNode See Also: NodeComponent.setDuplicateOnCloneTree |
getAppearance | public Appearance getAppearance()(Code) | | Retrieves the appearance component of this morph node.
the appearance component of this morph node exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph |
getAppearanceOverrideEnable | public boolean getAppearanceOverrideEnable()(Code) | | Retrieves the appearanceOverrideEnable flag for this node.
true if the appearance can be overridden; falseotherwise. exception: CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph since: Java 3D 1.2 |
getCollisionBounds | public Bounds getCollisionBounds()(Code) | | Returns the collision bounding object of this node.
the node's collision bounding object exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph |
getGeometryArray | public GeometryArray getGeometryArray(int index)(Code) | | Retrieves the geometryArray component of this Morph node.
Parameters: index - the index of GeometryArray to be returned the geometryArray component of this Morph node exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph |
getWeights | public double[] getWeights()(Code) | | Retrieves the Morph node's morph weight vector.
the morph weight vector component of this morph node exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph |
intersect | public boolean intersect(SceneGraphPath path, PickShape pickShape)(Code) | | Checks whether the geometry in this morph node intersects with
the specified pickShape.
Parameters: path - the SceneGraphPath to this morph node Parameters: pickShape - the PickShape to be intersected true if the pick shape intersects this node; falseotherwise. exception: IllegalArgumentException - if pickShape is a PickPoint.Java 3D doesn't have spatial information of the surface.Use PickBounds with BoundingSphere and a small radius, instead. exception: CapabilityNotSetException - if the Geometry.ALLOW_INTERSECTcapability bit is not set in all of the Geometry objectsreferred to by this morph node. |
intersect | public boolean intersect(SceneGraphPath path, PickRay pickRay, double[] dist)(Code) | | Checks whether the geometry in this morph node intersects with
the specified pickRay.
Parameters: path - the SceneGraphPath to this morph node Parameters: pickRay - the PickRay to be intersected Parameters: dist - the closest distance of the intersection true if the pick shape intersects this node; falseotherwise. If true, dist contains the closest distance ofintersection. exception: CapabilityNotSetException - if the Geometry.ALLOW_INTERSECTcapability bit is not set in all of the Geometry objectsreferred to by this morph node. |
intersect | public boolean intersect(SceneGraphPath path, PickShape pickShape, double[] dist)(Code) | | Checks whether the geometry in this morph node intersects with
the specified pickShape.
Parameters: path - the SceneGraphPath to this morph node Parameters: pickShape - the PickShape to be intersected Parameters: dist - the closest distance of the intersection true if the pick shape intersects this node; falseotherwise. If true, dist contains the closest distance ofintersection. exception: IllegalArgumentException - if pickShape is a PickPoint.Java 3D doesn't have spatial information of the surface.Use PickBounds with BoundingSphere and a small radius, instead. exception: CapabilityNotSetException - if the Geometry.ALLOW_INTERSECTcapability bit is not set in all of the Geometry objectsreferred to by this morph node. since: Java 3D 1.3 |
setAppearance | public void setAppearance(Appearance appearance)(Code) | | Sets the appearance component of this Morph node. A null
appearance component specifies that default values are used for all
appearance attributes.
Parameters: appearance - the new appearance component for this Morph node exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph |
setAppearanceOverrideEnable | public void setAppearanceOverrideEnable(boolean flag)(Code) | | Sets a flag that indicates whether this node's appearance can
be overridden. If the flag is true, this node's
appearance may be overridden by an AlternateAppearance leaf
node, regardless of the value of the ALLOW_APPEARANCE_WRITE
capability bit.
The default value is false.
Parameters: flag - the apperance override enable flag exception: CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph See Also: AlternateAppearance since: Java 3D 1.2 |
setCollisionBounds | public void setCollisionBounds(Bounds bounds)(Code) | | Sets the collision bounds of a node.
Parameters: bounds - the collision bounding object for a node exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph |
setGeometryArrays | public void setGeometryArrays(GeometryArray geometryArrays)(Code) | | Sets the geometryArrays component of the Morph node.
If the current array of GeometryArrays in this Morph object is
non-null with a length greater than 0, the specified array of
GeometryArrays must be the same length as the current array.
If the current array of GeometryArrays in this Morph object is
null or has a length of 0, and the specified array of
GeometryArrays is non-null with a length greater than 0, the
length of the incoming array defines the number of the geometry
objects that will be morphed. In this case, the weights array
is allocated to be of the same length as the geometry array;
the first element (weights[0]) is initialized to 1.0 and all of
the other weights are initialized to 0.0.
Parameters: geometryArrays - the new geometryArrays componentfor the Morph node. exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph exception: IllegalArgumentException - if the length of thespecified array of geometry arrays is not equal to the lengthof this Morph node's current array of geometry arrays (and thecurrent array's length is non-zero), or if any of the specifiedgeometry array objects differ from each other in any of thefollowing ways:
- Type of geometry array object (subclass of GeometryArray)
- vertexFormat
- texCoordSetCount
- texCoordSetMap
- validVertexCount
- validIndexCount, for IndexedGeometryArray objects
- stripVertexCounts array, for GeometryStripArray objects
- stripIndexCounts array, for IndexedGeometryStripArray objects
- the array lengths of each enabled vertex component(coord, color, normal, texcoord),for indexed geometry by-reference
exception: UnsupportedOperationException - if the specifiedgeometry arrays contain vertex attributes (that is, if theirvertexFormat includes the VERTEX_ATTRIBUTES flag). |
setWeights | public void setWeights(double weights)(Code) | | Sets this Morph node's morph weight vector. The Morph node "weights"
the corresponding GeometryArray by the amount specified.
The weights apply a morph weight vector component that creates
the desired morphing effect.
The length
of the weights parameter must be equal to the length
of the array with which this Morph node was created, otherwise
an IllegalArgumentException is thown.
Parameters: weights - the morph weight vector that the morph node willuse in combining the node's geometryArrays. The morph node will "weight"the corresponding GeometryArray by the amount specified.N.B.: the sum of the weights should equal 1.0 exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph exception: IllegalArgumentException - if sum of all 'weights' is NOT 1.0 or number of weights is NOT exqual to number of GeometryArrays. |
|
|