j3d.org Aviatrix3D

org.j3d.aviatrix3d
Class Shape3D

java.lang.Object
  extended byorg.j3d.aviatrix3d.SceneGraphObject
      extended byorg.j3d.aviatrix3d.Node
          extended byorg.j3d.aviatrix3d.Leaf
              extended byorg.j3d.aviatrix3d.Shape3D
All Implemented Interfaces:
PickableObject

public class Shape3D
extends Leaf
implements PickableObject

A Shape3D class wraps all geometry and appearance information.

By default, all shapes are pickable.

Version:
$Revision: 1.14 $
Author:
Justin Couch, Alan Hudson

Field Summary
 
Fields inherited from class org.j3d.aviatrix3d.Node
bounds, implicitBounds, INVALID_BOUNDS, parent
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, updateHandler, WRITE_TIMING_MSG
 
Constructor Summary
Shape3D()
          Creates a shape with no geometry or appearance set.
 
Method Summary
protected  void checkForCyclicChild(SceneGraphObject parent)
          Check to see if this node is the same reference as the passed node that is a parent of this node.
 Appearance getAppearance()
          Get the current appearance associated with this shape.
 Geometry getGeometry()
          Get the current geometry associated with this shape.
 boolean isPickable()
          Get the current pickable state of this object
 boolean isVisible()
          State check to see whether the geometry in it's current setup is visible.
protected  void markBoundsDirty()
          Mark this node as having dirty bounds due to one of it's children having their bounds changed.
 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.
 void postRender(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
           
protected  void recomputeBounds()
          Internal method to recalculate the implicit bounds of this Node.
 void render(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
          This method is called to render this node.
 void setAppearance(Appearance newApp)
          Set the appearance for this shape.
 void setGeometry(Geometry newGeom)
          Set the geometry for this shape.
protected  void setLive(boolean state)
          Notification that this object is live now.
 void setPickable(boolean state)
          Set the node as being pickable currently.
protected  void setUpdateHandler(NodeUpdateHandler handler)
          Set the scenegraph update handler for this node.
 
Methods inherited from class org.j3d.aviatrix3d.Node
boundsChanged, checkForCyclicParent, getBounds, getParent, removeParent, setBounds, setParent, updateBounds
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
dataChanged, getUserData, isLive, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Shape3D

public Shape3D()
Creates a shape with no geometry or appearance set.

Method Detail

markBoundsDirty

protected void markBoundsDirty()
Mark this node as having dirty bounds due to one of it's children having their bounds changed.

Overrides:
markBoundsDirty in class Node

recomputeBounds

protected void recomputeBounds()
Internal method to recalculate the implicit bounds of this Node. By default the bounds are a point sphere, so derived classes should override this method with something better.

Overrides:
recomputeBounds in class Node

isVisible

public boolean isVisible()
State check to see whether the geometry in it's current setup is visible. To be visible, the shape must have geometry and the appearance node must also return isVisible() true. If not appearance is set, then only geometry is needed to return true.

Returns:
true if the shape has something to render

getGeometry

public Geometry getGeometry()
Get the current geometry associated with this shape.

Returns:
the current instance

setGeometry

public void setGeometry(Geometry newGeom)
                 throws InvalidWriteTimingException
Set the geometry for this shape. A null value will clear the geometry.

Parameters:
newGeom - The geometry
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getAppearance

public Appearance getAppearance()
Get the current appearance associated with this shape.

Returns:
the current instance

setAppearance

public void setAppearance(Appearance newApp)
                   throws InvalidWriteTimingException
Set the appearance for this shape.

Parameters:
newApp - The appearance
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

setUpdateHandler

protected void setUpdateHandler(NodeUpdateHandler handler)
Set the scenegraph update handler for this node. It will notify all its children of the value. A null value will clear the current handler.

Overrides:
setUpdateHandler in class SceneGraphObject
Parameters:
handler - The instance to use as a handler

render

public void render(net.java.games.jogl.GL gl,
                   net.java.games.jogl.GLU glu)
This method is called to render this node. All openGL commands needed to render the node should be executed. Any transformations needed should be added to the transformation stack premultiplied. This method must be re-entrant as it can be called from multiple places at once.

Overrides:
render in class Node
Parameters:
gl - The gl context to draw with
glu - The utility context to draw with

postRender

public void postRender(net.java.games.jogl.GL gl,
                       net.java.games.jogl.GLU glu)
Overrides:
postRender in class Node

setLive

protected void setLive(boolean state)
Notification that this object is live now. Overridden to make sure that the live state of the nodes represents the same state as the parent scene graph.

Overrides:
setLive in class Node
Parameters:
state - true if this should be marked as live now

checkForCyclicChild

protected void checkForCyclicChild(SceneGraphObject parent)
                            throws CyclicSceneGraphStructureException
Check to see if this node is the same reference as the passed node that is a parent of this node. This is the downwards check to ensure that there is no cyclic scene graph structures at the point where someone adds a node to the scenegraph. When the reference and this are the same, an exception is generated. Since each class may have different lists of child node setups, this should be overriden by any class that can take children, and have the call passed along to the children.

Overrides:
checkForCyclicChild in class SceneGraphObject
Parameters:
parent - The reference to check against this class
Throws:
CyclicSceneGraphStructureException - Equal parent and child

setPickable

public void setPickable(boolean state)
Set the node as being pickable currently.

Specified by:
setPickable in interface PickableObject
Parameters:
state - true to make this node pickable

isPickable

public boolean isPickable()
Get the current pickable state of this object

Specified by:
isPickable in interface PickableObject
Returns:
true if this node is currently pickable

pickBatch

public void pickBatch(PickRequest[] reqs,
                      int numRequests)
               throws NotPickableException,
                      InvalidPickTimingException
Check for all intersections against this geometry and it's children to see if there is an intersection with the given set of requests.

Specified by:
pickBatch in interface PickableObject
Parameters:
reqs - The list of picks to be made, starting at this object
numRequests - The number of valid pick requests to process
Throws:
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 method

pickSingle

public void pickSingle(PickRequest req)
                throws NotPickableException,
                       InvalidPickTimingException
Check for all intersections against this geometry and it's children to see if there is an intersection with the given set of requests.

Specified by:
pickSingle in interface PickableObject
Parameters:
req - The details of the pick to be made
Throws:
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 method

j3d.org Aviatrix3D

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - j3d.org