Aviatrix3D 1.0

org.j3d.aviatrix3d
Class ClipPlane

java.lang.Object
  extended byorg.j3d.aviatrix3d.SceneGraphObject
      extended byorg.j3d.aviatrix3d.Node
          extended byorg.j3d.aviatrix3d.Leaf
              extended byorg.j3d.aviatrix3d.ClipPlane
All Implemented Interfaces:
java.lang.Comparable, Renderable, RenderableComponent

public class ClipPlane
extends Leaf
implements RenderableComponent, java.lang.Comparable

Representation of a single clip plane that can be used to clip a model in addition to the normal view volume clipping.

ClipPlane objects may be placed at any point in the scene graph heirarchy and is effected by all parent transforms. Each clip plane is accumulated and pushed to the leaf node, in a similar manner that lights are. As such, there is no requirement to provide the clip plane index as this will be assigned automatically at rendering time. A benefit of this feature is that it allows you to specify several different clip planes at different locations in the heirarchy and have them apply to the local coordinate system.

The external data passed to the RenderableComponent calls shall be an Integer instance that represents the GL identifier of the clip plane (GL_CLIPPLANE0 + i) this instance is working with.

Version:
$Revision: 1.7 $
Author:
Justin Couch

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_NOT_LIVE_MESSAGE, updateHandler, WRITE_TIMING_MSG
 
Constructor Summary
ClipPlane()
          Creates a new clip plane using the default plane equation.
 
Method Summary
 int compareTo(ClipPlane cp)
          Compares this object with the specified object for order.
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 void getPlaneEquation(double[] eq)
          Retrieve the current plane equation values.
 boolean isEnabled()
          Get the current enabled state of the light.
 void postRender(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu, java.lang.Object planeId)
          Overloaded form of the postRender() method to render the clip details given the specific clip plane ID used by OpenGL.
 void render(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu, java.lang.Object planeId)
          Overloaded form of the render() method to render the clip details given the specific clip plane ID used by OpenGL.
 void setEnabled(boolean state)
          Set the enabled state of the light.
 void setPlaneEquation(double[] eq)
          Set the plane equation to the new value.
 
Methods inherited from class org.j3d.aviatrix3d.Node
boundsChanged, checkForCyclicParent, getBounds, getParent, markBoundsDirty, recomputeBounds, removeParent, setBounds, setLive, setParent, updateBounds, updateParentBounds
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, dataChanged, getUserData, isLive, setUpdateHandler, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClipPlane

public ClipPlane()
Creates a new clip plane using the default plane equation.

Method Detail

compareTo

public int compareTo(java.lang.Object o)
              throws java.lang.ClassCastException
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Derived classes should extend this one to add the extra comparisons needed.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - The object to be compared
Returns:
-1, 0 or 1 depending on order
Throws:
java.lang.ClassCastException - The specified object's type prevents it from being compared to this Object

render

public void render(net.java.games.jogl.GL gl,
                   net.java.games.jogl.GLU glu,
                   java.lang.Object planeId)
Overloaded form of the render() method to render the clip details given the specific clip plane ID used by OpenGL. Since the active plane ID for this node may vary over time, a fixed ID cannot be used by OpenGL. The renderer will always call this method rather than the normal render() method.

Specified by:
render in interface RenderableComponent
Parameters:
gl - The GL context to render with
glu - The GL utility context to render with
planeId - the ID of the plane to make GL calls with

postRender

public void postRender(net.java.games.jogl.GL gl,
                       net.java.games.jogl.GLU glu,
                       java.lang.Object planeId)
Overloaded form of the postRender() method to render the clip details given the specific clip plane ID used by OpenGL. Since the active plane ID for this node may vary over time, a fixed ID cannot be used by OpenGL. The renderer will always call this method rather than the normal postRender() method.

Specified by:
postRender in interface RenderableComponent
Parameters:
gl - The GL context to render with
glu - The GL utility context to render with
planeId - the ID of the plane to make GL calls with

setEnabled

public void setEnabled(boolean state)
                throws InvalidWriteTimingException
Set the enabled state of the light. Can use this to turn it on and off in a general fashion.

Parameters:
state - The new state of the light
Throws:
InvalidWriteTimingException

isEnabled

public boolean isEnabled()
Get the current enabled state of the light.

Returns:
The current state

setPlaneEquation

public void setPlaneEquation(double[] eq)
                      throws java.lang.IllegalArgumentException,
                             InvalidWriteTimingException
Set the plane equation to the new value. The equation is defined by the standard 4-component representation of Ax + By + Cz + D = 0. The length of provided array must have at least 4 components.

Parameters:
eq - The new equation values to use
Throws:
java.lang.IllegalArgumentException - The array is not at least 4 items long
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getPlaneEquation

public void getPlaneEquation(double[] eq)
Retrieve the current plane equation values. The array needs to be at least length 4.

Parameters:
eq - An array to copy the equation values into

compareTo

public int compareTo(ClipPlane cp)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Parameters:
cp - The plane instance to be compared
Returns:
-1, 0 or 1 depending on order

Aviatrix3D 1.0

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