|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.j3d.SceneGraphObject | +--javax.media.j3d.Node | +--javax.media.j3d.Leaf | +--javax.media.j3d.Background
The Background leaf node defines either a solid background color or a background image that is used to fill the window at the beginning of each new frame. It optionally allows background geometry---which is pre-tessellated onto a unit sphere and is drawn at infinity---to be referenced. It also specifies an application region in which this background is active. A Background node is active when its application region intersects the ViewPlatform's activation volume. If multiple Background nodes are active, the Background node that is "closest" to the eye will be used. If no Background nodes are active, then the window is cleared to black.
The set of nodes that can be added to a BranchGroup associated with a Background node is limited. All Group nodes (except SharedGroup, which must not have any parents) are legal in a background geometry branch graph. The only Leaf nodes that are legal are Shape3D and Morph. The presence of any other Leaf nodes will cause an IllegalSharingException to be thrown. Note that Link nodes are not allowed; a background geometry branch graph must not reference shared subgraphs.
Field Summary | |
static int |
ALLOW_APPLICATION_BOUNDS_READ
Specifies that the Background allows read access to its application bounds and bounding leaf at runtime. |
static int |
ALLOW_APPLICATION_BOUNDS_WRITE
Specifies that the Background allows write access to its application bounds and bounding leaf at runtime. |
static int |
ALLOW_COLOR_READ
Specifies that the Background allows read access to its color at runtime. |
static int |
ALLOW_COLOR_WRITE
Specifies that the Background allows write access to its color at runtime. |
static int |
ALLOW_GEOMETRY_READ
Specifies that the Background allows read access to its background geometry at runtime. |
static int |
ALLOW_GEOMETRY_WRITE
Specifies that the Background allows write access to its background geometry at runtime. |
static int |
ALLOW_IMAGE_READ
Specifies that the Background allows read access to its image at runtime. |
static int |
ALLOW_IMAGE_WRITE
Specifies that the Background allows write access to its image 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_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING |
Constructor Summary | |
Background()
Constructs a Background node with default parameters. |
|
Background(BranchGroup branch)
Constructs a Background node with the specified geometry. |
|
Background(Color3f color)
Constructs a Background node with the specified color. |
|
Background(float r,
float g,
float b)
Constructs a Background node with the specified color. |
|
Background(ImageComponent2D image)
Constructs a Background node with the specified image. |
Method Summary | |
Node |
cloneNode(boolean forceDuplicate)
Creates a new instance of the node. |
void |
duplicateNode(Node originalNode,
boolean forceDuplicate)
Copies all node information from originalNode into
the current node. |
BoundingLeaf |
getApplicationBoundingLeaf()
Retrieves the Background node's application bounding leaf. |
Bounds |
getApplicationBounds()
Retrieves the Background node's application bounds. |
void |
getColor(Color3f color)
Retrieves the background color. |
BranchGroup |
getGeometry()
Retrieves the background geometry. |
ImageComponent2D |
getImage()
Retrieves the background image. |
void |
setApplicationBoundingLeaf(BoundingLeaf region)
Set the Background's application region to the specified bounding leaf. |
void |
setApplicationBounds(Bounds region)
Set the Background's application region to the specified bounds. |
void |
setColor(Color3f color)
Sets the background color to the specified color. |
void |
setColor(float r,
float g,
float b)
Sets the background color to the specified color. |
void |
setGeometry(BranchGroup branch)
Sets the background geometry to the specified BranchGroup node. |
void |
setImage(ImageComponent2D image)
Sets the background image to the specified image. |
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 to cloneTree . |
Methods inherited from class javax.media.j3d.Node |
cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, getBounds, getBoundsAutoCompute, getCollidable, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable |
Methods inherited from class javax.media.j3d.SceneGraphObject |
clearCapability, duplicateSceneGraphObject, getCapability, getUserData, isCompiled, isLive, setCapability, setUserData |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int ALLOW_APPLICATION_BOUNDS_READ
public static final int ALLOW_APPLICATION_BOUNDS_WRITE
public static final int ALLOW_IMAGE_READ
public static final int ALLOW_IMAGE_WRITE
public static final int ALLOW_COLOR_READ
public static final int ALLOW_COLOR_WRITE
public static final int ALLOW_GEOMETRY_READ
public static final int ALLOW_GEOMETRY_WRITE
Constructor Detail |
public Background()
public Background(Color3f color)
public Background(float r, float g, float b)
public Background(ImageComponent2D image)
image
- pixel array object used as the background imagepublic Background(BranchGroup branch)
branch
- the root of the background geometryIllegalSharingException
- if the BranchGroup node
is a child of any Group node, or is already attached to a Locale,
or is already referenced by another Background node.Method Detail |
public void setColor(Color3f color)
color
- the new background colorCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setColor(float r, float g, float b)
r
- the red component of the background colorg
- the green component of the background colorb
- the blue component of the background colorCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void getColor(Color3f color)
color
- the vector that will receive the current background colorCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setImage(ImageComponent2D image)
image
- new pixel array object used as the background imageCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic ImageComponent2D getImage()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setGeometry(BranchGroup branch)
branch
- the root of the background geometryCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphIllegalSharingException
- if the BranchGroup node
is a child of any Group node, or is already attached to a Locale,
or is already referenced by another Background node.public BranchGroup getGeometry()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setApplicationBounds(Bounds region)
region
- the bounds that contains the Background's new application
region.CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic Bounds getApplicationBounds()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setApplicationBoundingLeaf(BoundingLeaf region)
region
- the bounding leaf node used to specify the Background
node's new application region.CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic BoundingLeaf getApplicationBoundingLeaf()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic Node cloneNode(boolean forceDuplicate)
cloneTree
to duplicate the current node.cloneNode
in class Node
forceDuplicate
- when set to true
, causes the
duplicateOnCloneTree
flag to be ignored. When
false
, the value of each node's
duplicateOnCloneTree
variable determines whether
NodeComponent data is duplicated or copied.cloneTree
on that branchGroup.Node.cloneTree()
,
Node.cloneNode(boolean)
,
Node.duplicateNode(javax.media.j3d.Node, boolean)
,
NodeComponent.setDuplicateOnCloneTree(boolean)
public void duplicateNode(Node originalNode, boolean forceDuplicate)
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.
duplicateNode
in class Node
originalNode
- the original node to duplicate.forceDuplicate
- when set to true
, causes the
duplicateOnCloneTree
flag to be ignored. When
false
, the value of each node's
duplicateOnCloneTree
variable determines whether
NodeComponent data is duplicated or copied.ClassCastException
- if originalNode is not an instance of
Background
Node.cloneTree()
,
Node.cloneNode(boolean)
,
NodeComponent.setDuplicateOnCloneTree(boolean)
public void updateNodeReferences(NodeReferenceTable referenceTable)
cloneTree
.
This method is called by cloneTree
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 the getNewObjectReference
method found in the
NodeReferenceTable
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 the
allowDanglingReferences
parameter passed in the
cloneTree
call.
NOTE: Applications should not call this method directly. It should only be called by the cloneTree method.
updateNodeReferences
in class SceneGraphObject
referenceTable
- a NodeReferenceTableObject that contains the
getNewObjectReference
method needed to search for
new object instancesNodeReferenceTable
,
Node.cloneTree()
,
DanglingReferenceException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |