|
Aviatrix3D 2.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.j3d.aviatrix3d.SceneGraphObject org.j3d.aviatrix3d.Node org.j3d.aviatrix3d.Node2D org.j3d.aviatrix3d.SharedNode2D
public class SharedNode2D
A 2D node that can have multiple parents, thus allowing a graph structure to the scene graph.
Normal nodes cannot have more than one parent, so this class provides the ability to have more than one. In doing so, it overrides the normal methods provided by Node2D to provide the shared functionality. It provides a compliment to the SharedGroup2D for parts of the scene graph where you want to share a common piece, but really don't need the grouping functionality.
Using this node in preference to SharedGroup has several performance benefits. For example, when performing picking, the picking implementation can just ignore this node altogether as it knows the bounds are identical to it's child.
Internationalisation Resource Names
Field Summary |
---|
Fields inherited from class org.j3d.aviatrix3d.Node |
---|
bounds, implicitBounds, INVALID_BOUNDS, parent |
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject |
---|
alive, LISTENER_SET_TIMING_ERR_PROP, updateHandler |
Fields inherited from interface org.j3d.aviatrix3d.picking.PickableObject |
---|
COLLIDABLE_OBJECT, GENERAL_OBJECT, PROXIMITY_OBJECT, VISIBLE_OBJECT |
Fields inherited from interface org.j3d.aviatrix3d.picking.PickTarget |
---|
CUSTOM_PICK_TYPE, GROUP_PICK_TYPE, LEAF_PICK_TYPE, SINGLE_PICK_TYPE |
Constructor Summary | |
---|---|
SharedNode2D()
The default constructor |
Method Summary | |
---|---|
protected void |
checkForCyclicParent(SceneGraphObject child)
Check to see if this node is the same reference as the passed node. |
boolean |
checkPickMask(int mask)
Check the given pick mask against the node's internal pick mask representation. |
Node2D |
getChild()
Get the currently set child of this node. |
Cullable |
getCullableChild()
Get the child renderable of this object. |
Cullable |
getCullableParent()
Get the parent cullable of this instance. |
Node |
getParent()
Overridden to always return the current first parent in the list. |
void |
getParents(Node2D[] parents)
Get the listing of the number of parents that this node currently has. |
BoundingVolume |
getPickableBounds()
Get the bounds of this picking target so that testing can be performed on the object. |
PickTarget |
getPickableChild()
Return the child that is pickable of from this target. |
int |
getPickMask()
Get the current pickable state mask of this object. |
int |
getPickTargetType()
Return the type constant that represents the type of pick target this is. |
boolean |
hasMultipleParents()
Check to see if this cullable is mulitparented. |
protected void |
markBoundsDirty()
Mark this node as having dirty bounds due to one of it's children having their bounds changed. |
int |
numParents()
Request the number of parents this node currently contains |
void |
pickBatch(PickRequest[] reqs,
int numRequests)
Check for all intersections against this geometry and it's children to see if there is an intersection with the given set of requests. |
void |
pickSingle(PickRequest req)
Check for all intersections against this geometry and it's children to see if there is an intersection with the given set of requests. |
protected void |
recomputeBounds()
Internal method to recalculate the implicit bounds of this Node2D. |
protected void |
removeParent(Node p)
Remove a parent from this shared group. |
void |
requestBoundsUpdate()
Request a recomputation of the bounds of this object. |
void |
setChild(Node2D child)
Set the child to be the new value. |
protected void |
setLive(boolean state)
Notification that this object is live now. |
void |
setLive(Node caller,
boolean state)
Overloaded version of the notification that this object's liveness state has changed. |
protected void |
setParent(Node p)
Specify this nodes parent, overridden to provide behaviour that appends the node to the list rather than replacing it. |
void |
setPickMask(int state)
Set the node as being pickable currently using the given bit mask. |
protected void |
setUpdateHandler(NodeUpdateHandler handler)
Set the scenegraph update handler for this node. |
protected void |
updateBounds()
Update this node's bounds and then call the parent to update it's bounds. |
Methods inherited from class org.j3d.aviatrix3d.Node |
---|
boundsChanged, getBounds, setBounds, updateParentBounds |
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject |
---|
checkForCyclicChild, dataChanged, getAppUpdateWriteTimingMessage, getBoundsWriteTimingMessage, getDataWriteTimingMessage, getUserData, isLive, setUserData |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.j3d.aviatrix3d.rendering.SingleCullable |
---|
getBounds |
Constructor Detail |
---|
public SharedNode2D()
Method Detail |
---|
public Cullable getCullableChild()
getCullableChild
in interface SingleCullable
public boolean hasMultipleParents()
hasMultipleParents
in interface SingleCullable
public Cullable getCullableParent()
getCullableParent
in interface SingleCullable
public void setLive(Node caller, boolean state)
caller
- The node calling us with the state changesstate
- true if this should be marked as live nowprotected void markBoundsDirty()
markBoundsDirty
in class Node
protected void recomputeBounds()
recomputeBounds
in class Node
public void requestBoundsUpdate()
This will recurse down the children asking all of them to recompute the bounds. If a child is found to be during this process, that branch will not update, and thus the value used will be the last updated (ie from the previous frame it was processed).
requestBoundsUpdate
in class Node
protected void updateBounds()
updateBounds
in class Node
protected void setParent(Node p) throws AlreadyParentedException, InvalidNodeTypeException, CyclicSceneGraphStructureException
setParent
in class Node
p
- The new parent instance to add to the list
AlreadyParentedException
- There is a valid parent already set
InvalidNodeTypeException
- Not a group node
CyclicSceneGraphStructureException
- Equal parent and child causing
a cycle in the scene graph structureprotected void removeParent(Node p)
removeParent
in class Node
p
- The new parent instance to remove from the listpublic Node getParent()
getParent
in class Node
protected void setLive(boolean state)
setLive
in class SceneGraphObject
state
- true if this should be marked as live nowprotected void setUpdateHandler(NodeUpdateHandler handler)
setUpdateHandler
in class SceneGraphObject
handler
- The instance to use as a handlerprotected void checkForCyclicParent(SceneGraphObject child) throws CyclicSceneGraphStructureException
checkForCyclicParent
in class Node
child
- The reference to check against this class
CyclicSceneGraphStructureException
- Equal parent and childpublic void setPickMask(int state)
setPickMask
in interface PickableObject
state
- A bit mask of available options to pick forpublic int getPickMask()
getPickMask
in interface PickableObject
public void pickBatch(PickRequest[] reqs, int numRequests) throws NotPickableException, InvalidPickTimingException
pickBatch
in interface PickableObject
reqs
- The list of picks to be made, starting at this objectnumRequests
- The number of valid pick requests to process
NotPickableException
- This object has been marked as non pickable,
but you decided to try to call the method anyway
InvalidPickTimingException
- An attempt was made to pick outside
of the ApplicationUpdateObserver callback methodpublic void pickSingle(PickRequest req) throws NotPickableException, InvalidPickTimingException
pickSingle
in interface PickableObject
req
- The details of the pick to be made
NotPickableException
- This object has been marked as non pickable,
but you decided to try to call the method anyway
InvalidPickTimingException
- An attempt was made to pick outside
of the ApplicationUpdateObserver callback methodpublic PickTarget getPickableChild()
getPickableChild
in interface SinglePickTarget
public final int getPickTargetType()
getPickTargetType
in interface PickTarget
public boolean checkPickMask(int mask)
checkPickMask
in interface PickTarget
mask
- The bit mask to check against
public BoundingVolume getPickableBounds()
getPickableBounds
in interface PickTarget
public int numParents()
public void getParents(Node2D[] parents)
parents
- An array to copy the parent listing intopublic void setChild(Node2D child) throws CyclicSceneGraphStructureException
child
- The new instance to set or null
CyclicSceneGraphStructureException
- Equal parent and child causing
a cycle in the scene graph structure
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener bounds callback methodpublic Node2D getChild()
|
Aviatrix3D 2.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |