Aviatrix3D
2.0 Beta 2

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, ComponentRenderable, Cullable, EffectRenderable, LeafCullable, Renderable

public class ClipPlane
extends Leaf
implements LeafCullable, ComponentRenderable, EffectRenderable, 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.

Rendering Implementation Tips

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

See the EffectRenderable interface for definition of the scoping and effects bounds.

Version:
$Revision: 1.12 $
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
 
Fields inherited from interface org.j3d.aviatrix3d.rendering.LeafCullable
CLIP_CULLABLE, FOG_CULLABLE, GEOMETRY_CULLABLE, LIGHT_CULLABLE
 
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.
 int getCullableType()
          Get the type that this cullable represents.
 BoundingVolume getEffectBounds()
          Get the current bounding volume that this light effects.
 void getPlaneEquation(double[] eq)
          Retrieve the current plane equation values.
 Renderable getRenderable()
          Get the child renderable of this object.
 boolean isEnabled()
          Get the current enabled state of the light.
 boolean isGlobalOnly()
          Get the current setting of the global-only flag.
 void postRender(javax.media.opengl.GL gl, 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(javax.media.opengl.GL gl, 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 setEffectBounds(BoundingVolume bounds)
          Set the bounds that will effect the range of this light.
 void setEnabled(boolean state)
          Set the enabled state of the light.
 void setGlobalOnly(boolean state)
          Set the global scope 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, requestBoundsUpdate, 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
 
Methods inherited from interface org.j3d.aviatrix3d.rendering.LeafCullable
getBounds
 
Methods inherited from interface org.j3d.aviatrix3d.rendering.Renderable
equals
 

Constructor Detail

ClipPlane

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

Method Detail

getCullableType

public int getCullableType()
Get the type that this cullable represents.

Specified by:
getCullableType in interface LeafCullable
Returns:
One of the _CULLABLE constants

getRenderable

public Renderable getRenderable()
Get the child renderable of this object.

Specified by:
getRenderable in interface LeafCullable
Returns:
an array of nodes

isEnabled

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

Specified by:
isEnabled in interface EffectRenderable
Returns:
The current state

isGlobalOnly

public boolean isGlobalOnly()
Get the current setting of the global-only flag.

Specified by:
isGlobalOnly in interface EffectRenderable
Returns:
true if for global use only, false otherwise

getEffectBounds

public BoundingVolume getEffectBounds()
Get the current bounding volume that this light effects. If the light is to effect everything for infinite distance, then this will return null.

Specified by:
getEffectBounds in interface EffectRenderable
Returns:
A bounding volume if there is to be bounds, null for none.

render

public void render(javax.media.opengl.GL gl,
                   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 ComponentRenderable
Parameters:
gl - The GL context to render with
planeId - the ID of the plane to make GL calls with

postRender

public void postRender(javax.media.opengl.GL gl,
                       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 ComponentRenderable
Parameters:
gl - The GL context to render with
planeId - the ID of the plane to make GL calls with

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.

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

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

setGlobalOnly

public void setGlobalOnly(boolean state)
                   throws InvalidWriteTimingException
Set the global scope state of the light. We can use this to turn define whether this light should effect everything or just those scoped to the same group as the parent of this light.

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

setEffectBounds

public void setEffectBounds(BoundingVolume bounds)
                     throws InvalidWriteTimingException
Set the bounds that will effect the range of this light. The bounds are used as a secondary scoping capability to define which objects should or should not be effected based on whether their bounding volumes intersect with this volume. If the light is to effect everything then this value should be set to null, otherwise it defines the bounds in the local coordinate system of the light.

Parameters:
bounds - A volume to use or null to clear
Throws:
InvalidWriteTimingException

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
2.0 Beta 2

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