| java.lang.Object javax.media.j3d.SceneGraphObject javax.media.j3d.Node javax.media.j3d.Group com.sun.j3d.utils.geometry.Primitive com.sun.j3d.utils.geometry.Box
Box | public class Box extends Primitive (Code) | | Box is a geometry primitive created with a given length, width, and height.
It is centered at the origin. By default, it lies within the bounding
box, [-1,-1,-1] and [1,1,1].
When a texture is applied to a box, it is map CCW like on a Cylinder.
A texture is mapped CCW from the back of the
body. The top and bottom faces are mapped such that the texture appears
front facing when the faces are rotated 90 toward the viewer.
By default all primitives with the same parameters share their
geometry (e.g., you can have 50 shperes in your scene, but the
geometry is stored only once). A change to one primitive will
effect all shared nodes. Another implication of this
implementation is that the capabilities of the geometry are shared,
and once one of the shared nodes is live, the capabilities cannot
be set. Use the GEOMETRY_NOT_SHARED flag if you do not wish to
share geometry among primitives with the same parameters.
|
Field Summary | |
final public static int | BACK Used to designate the back side of the box when using
getShape(). | final public static int | BOTTOM Used to designate the bottom side of the box when using
getShape(). | final public static int | FRONT Used to designate the front side of the box when using
getShape(). | final public static int | LEFT Used to designate the left side of the box when using
getShape(). | final public static int | RIGHT Used to designate the right side of the box when using
getShape(). | final public static int | TOP Used to designate the top side of the box when using
getShape(). | int | numTexUnit | float | xDimyDimzDim |
Constructor Summary | |
public | Box() Constructs a default box of 1.0 in all dimensions. | public | Box(float xdim, float ydim, float zdim, Appearance ap) Constructs a box of a given dimension and appearance. | public | Box(float xdim, float ydim, float zdim, int primflags, Appearance ap, int numTexUnit) Constructs a box of a given dimension, flags, and appearance. | public | Box(float xdim, float ydim, float zdim, int primflags, Appearance ap) |
Method Summary | |
public Node | cloneNode(boolean forceDuplicate) Used to create a new instance of the node. | public void | duplicateNode(Node originalNode, boolean forceDuplicate) Copies all node information from originalNode into
the current node. | public Appearance | getAppearance(int partId) Gets the appearance of the specified part of the box.
Parameters: partId - identifier for a given subpart of the box The appearance object associated with the partID. | public Shape3D | getShape(int partId) Gets one of the faces (Shape3D) from the box that contains the
geometry and appearance. | public float | getXdimension() | public float | getYdimension() | public float | getZdimension() | public void | setAppearance(Appearance ap) Sets appearance of the box. |
BACK | final public static int BACK(Code) | | Used to designate the back side of the box when using
getShape().
See Also: Box.getShape |
BOTTOM | final public static int BOTTOM(Code) | | Used to designate the bottom side of the box when using
getShape().
See Also: Box.getShape |
FRONT | final public static int FRONT(Code) | | Used to designate the front side of the box when using
getShape().
See Also: Box.getShape |
LEFT | final public static int LEFT(Code) | | Used to designate the left side of the box when using
getShape().
See Also: Box.getShape |
RIGHT | final public static int RIGHT(Code) | | Used to designate the right side of the box when using
getShape().
See Also: Box.getShape |
TOP | final public static int TOP(Code) | | Used to designate the top side of the box when using
getShape().
See Also: Box.getShape |
numTexUnit | int numTexUnit(Code) | | |
xDimyDimzDim | float xDimyDimzDim(Code) | | |
Box | public Box()(Code) | | Constructs a default box of 1.0 in all dimensions.
Normals are generated by default, texture coordinates are not.
|
Box | public Box(float xdim, float ydim, float zdim, Appearance ap)(Code) | | Constructs a box of a given dimension and appearance.
Normals are generated by default, texture coordinates are not.
Parameters: xdim - X-dimension size. Parameters: ydim - Y-dimension size. Parameters: zdim - Z-dimension size. Parameters: ap - Appearance |
Box | public Box(float xdim, float ydim, float zdim, int primflags, Appearance ap, int numTexUnit)(Code) | | Constructs a box of a given dimension, flags, and appearance.
Parameters: xdim - X-dimension size. Parameters: ydim - Y-dimension size. Parameters: zdim - Z-dimension size. Parameters: primflags - primitive flags. Parameters: ap - Appearance |
Box | public Box(float xdim, float ydim, float zdim, int primflags, Appearance ap)(Code) | | |
cloneNode | public Node cloneNode(boolean forceDuplicate)(Code) | | Used to create a new instance of the node. This routine is called
by cloneTree to duplicate the current node.
cloneNode should be overridden by any user subclassed
objects. All subclasses must have their cloneNode
method consist of the following lines:
public Node cloneNode(boolean forceDuplicate) {
UserSubClass usc = new UserSubClass();
usc.duplicateNode(this, forceDuplicate);
return usc;
}
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.duplicateNode 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 .
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. See Also: Node.cloneTree See Also: Node.cloneNode See Also: NodeComponent.setDuplicateOnCloneTree |
getAppearance | public Appearance getAppearance(int partId)(Code) | | Gets the appearance of the specified part of the box.
Parameters: partId - identifier for a given subpart of the box The appearance object associated with the partID. If aninvalid partId is passed in, null is returned. since: Java 3D 1.2.1 |
getShape | public Shape3D getShape(int partId)(Code) | | Gets one of the faces (Shape3D) from the box that contains the
geometry and appearance. This allows users to modify the
appearance or geometry of individual parts.
Parameters: partId - The part to return. The Shape3D object associated with the partID. If aninvalid partId is passed in, null is returned. |
getXdimension | public float getXdimension()(Code) | | Returns the X-dimension size of the Box
since: Java 3D 1.2.1 |
getYdimension | public float getYdimension()(Code) | | Returns the Y-dimension size of the Box
since: Java 3D 1.2.1 |
getZdimension | public float getZdimension()(Code) | | Returns the Z-dimension size of the Box
since: Java 3D 1.2.1 |
setAppearance | public void setAppearance(Appearance ap)(Code) | | Sets appearance of the box. This will set each face of the
box to the same appearance. To set each face's appearance
separately, use getShape(partId) to get the
individual shape and call shape.setAppearance(ap).
|
Methods inherited from com.sun.j3d.utils.geometry.Primitive | protected void cacheGeometry(int kind, float a, float b, float c, int d, int e, int flags, GeomBuffer geo)(Code)(Java Doc) public static void clearGeometryCache()(Code)(Java Doc) public Appearance getAppearance()(Code)(Java Doc) abstract public Appearance getAppearance(int partId)(Code)(Java Doc) protected GeomBuffer getCachedGeometry(int kind, float a, float b, float c, int d, int e, int flags)(Code)(Java Doc) public int getNumTriangles()(Code)(Java Doc) public int getNumVertices()(Code)(Java Doc) public int getPrimitiveFlags()(Code)(Java Doc) abstract public Shape3D getShape(int partid)(Code)(Java Doc) public void setAppearance(int partid, Appearance ap)(Code)(Java Doc) abstract public void setAppearance(Appearance ap)(Code)(Java Doc) public void setAppearance()(Code)(Java Doc) public void setNumTriangles(int num)(Code)(Java Doc) public void setNumVertices(int num)(Code)(Java Doc) public void setPrimitiveFlags(int fl)(Code)(Java Doc) String strfloat(float x)(Code)(Java Doc)
|
|
|