Aviatrix3D
2.1.0

org.j3d.renderer.aviatrix3d.nodes
Class BufferGeometry

java.lang.Object
  extended by org.j3d.aviatrix3d.SceneGraphObject
      extended by org.j3d.aviatrix3d.NodeComponent
          extended by org.j3d.aviatrix3d.Geometry
              extended by org.j3d.renderer.aviatrix3d.nodes.BufferGeometry
All Implemented Interfaces:
java.lang.Comparable, LeafPickTarget, PickableObject, PickTarget, GeometryRenderable, Renderable
Direct Known Subclasses:
IndexedBufferGeometry, LineArray, LineStripArray, PointArray, QuadArray, QuadStripArray, SortedPointArray, TriangleArray, TriangleFanArray, TriangleStripArray

public abstract class BufferGeometry
extends Geometry
implements GeometryRenderable

Base, unsafe, representation of geometry that uses NIO buffers directly from the user.

The code in this class is inherently unsafe in a multithreaded environment because the data structures used by the user are the references that the internal rendering also uses. That means a user can easily replace the values in the arrays without ever needing to go through the callback mechanism. The tradeoff this gives is reduced memory consumption and somewhat faster speed due to no longer needing to copy arrays into buffers every frame.

Version:
$Revision: 1.15 $
Author:
Justin Couch

Field Summary
protected static int ATTRIB_CLEAR
          Mask to clear the shader vertex attributes setting
protected static int ATTRIB_MASK
          Mask to work out if shader vertex attributes are used
protected  int[] attribIds
          Listing of the valid attribute IDs for rendering
protected static int ATTRIBS
          Edge values are shader vertex attributes in the data
protected  org.j3d.util.IntHashMap attributes
          Map of the attribute Ids to their data (ref to user array).
protected static int COLOR_3
          RGB colour values are supplied in the data
protected static int COLOR_4
          RGBA colour values are supplied in the data
protected static int COLOR_CLEAR
          Mask to clear the per-vertex colour setting
protected static int COLOR_MASK
          Mask to work out if colours are used
protected static int COLOR2
          Secondary color values are supplied in the data
protected static int COLOR2_CLEAR
          Mask to clear the per-vertex secondary colour setting
protected static int COLOR2_MASK
          Mask to work out if secondary colours are used
protected  java.nio.FloatBuffer color2Buffer
          Buffer for holding secondary color data
protected  java.nio.FloatBuffer colorBuffer
          Buffer for holding colour data
static int COORDINATE_2
          2D Coordinate information is included in the vertex values
static int COORDINATE_3
          3D Coordinate information is included in the vertex values
static int COORDINATE_4
          4D Coordinate information is included in the vertex values
protected static int COORDINATE_CLEAR
          Mask to clear the coordinate setting
protected static int COORDINATE_MASK
          Mask to work out what coordinates are used
protected static int EDGE_CLEAR
          Mask to clear the edge flag setting
protected static int EDGE_MASK
          Mask to work out if edge flags are used
protected static int EDGES
          Edge values are supplied in the data
protected static int FOG
          Fog coordinate values are supplied in the data
protected static int FOG_CLEAR
          Mask to clear the fog coordinate setting
protected static int FOG_MASK
          Mask to work out if fog coordinates are used
protected  java.nio.FloatBuffer fogBuffer
          Buffer for holding fog coordinate data
protected static int NORMAL_CLEAR
          Mask to clear the normal setting
protected  java.nio.FloatBuffer normalBuffer
          Buffer for holding normal data
protected static int NORMALS
          Normal information is included in the vertex values
protected  int numCoords
          Number of valid entries in the coordinate array
protected  int numTextureArrays
          The number of valid texture arrays in the textures variable
protected  int numTextureSets
          List of offsets into the texture array /** The number of texture sets to use from the textureSet array
protected static int TEXTURE_CLEAR
          Mask to clear the texture coordinate setting
static int TEXTURE_COORDINATE_1
          1D texture coordinates are included in the vertex values
static int TEXTURE_COORDINATE_2
          2D texture coordinates are included in the vertex values
static int TEXTURE_COORDINATE_3
          3D texture coordinates are included in the vertex values
static int TEXTURE_COORDINATE_4
          4D texture coordinates are included in the vertex values
protected static int TEXTURE_COORDINATE_MULTI
          Multiple sets of texture coordinates are included in the vertex values
protected static int TEXTURE_COORDINATE_SINGLE
          Single set of texture coordinates are included in the vertex values
protected static int TEXTURE_MASK
          Mask to work out if texture coordinates are used
protected static int TEXTURE_SET_AVAILABLE
          Has a valid texture set provided
protected static int TEXTURE_SET_CLEAR
          Has a valid texture set provided
protected  java.nio.FloatBuffer[] textureBuffer
          Buffer for holding texture coordinate data
protected  int[] textureSets
          The texture set map array that describes how to map the arrays
protected  int[] textureTypes
          Flags for the texture type for each array.
protected  java.nio.FloatBuffer vertexBuffer
          Buffer for holding vertex data
protected  int vertexFormat
          The format of the geometry used
protected  float[] wkPolygon
          Working places for a single quad/triangle
 
Fields inherited from class org.j3d.aviatrix3d.Geometry
bounds, implicitBounds, internalUpdater, INVALID_BOUNDS, lastParentList, parentList, pickFlags, validAlpha
 
Fields inherited from class org.j3d.aviatrix3d.NodeComponent
lastParent, liveCount
 
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
protected BufferGeometry()
          /** Constructs an instance with pre-defined values with default values.
 
Method Summary
protected  void clearVertexState(javax.media.opengl.GL gl)
          Convenience method to clear the previously set state in the rendering pipeline.
 void getColors(java.nio.FloatBuffer col)
          Retrieve the colours that are currently set.
 void getFogCoordinates(java.nio.FloatBuffer fogs)
          Retrieve the fog coordinates that are currently set.
 void getNormals(java.nio.FloatBuffer n)
          Retrieve the normals that are currently set.
 void getSecondaryColors(java.nio.FloatBuffer cols)
          Retrieve the secondary colors that are currently set.
 void getTextureCoordinates(java.nio.FloatBuffer[] coords)
          Retrieve the texture coordinates that are currently set.
 int getValidVertexCount()
          Get the number of vertices that are valid in the geometry arrays.
 int getVertexType()
          Get the current vertex format type - 2D, 3D, or 4D.
 void getVertices(java.nio.FloatBuffer vertices)
          Retrieve the vertices that are currently set.
protected  void initPolygonDetails(int numCoords)
          Initialize the internal arrays to a given size for the picking.
 boolean is2D()
          Check to see whether this shape is something that represents 2D or 3D geometry.
protected  boolean isVisible()
          Check to see if this geometry is making the geometry visible or not.
protected  boolean ray3DQuadChecked(float[] origin, float[] direction, float length, float[] dataOut)
          Private version of the ray - Polygon intersection test that does not do any bounds checking on arrays and assumes everything is correct.
protected  boolean ray3DTriangleChecked(float[] origin, float[] direction, float length, float[] dataOut)
          Private version of the ray - Polygon intersection test that does not do any bounds checking on arrays and assumes everything is correct.
protected  void recomputeBounds()
          Internal method to recalculate the implicit bounds of this Node.
 void setAttributes(int index, int size, java.nio.ByteBuffer attribs, boolean normalise, boolean signed)
          Set the attribute values at the given index to a new value.
 void setAttributes(int index, int size, java.nio.DoubleBuffer attribs, boolean normalise)
          Set the attribute values at the given index to a new value.
 void setAttributes(int index, int size, java.nio.FloatBuffer attribs, boolean normalise)
          Set the attribute values at the given index to a new value.
 void setAttributes(int index, int size, java.nio.IntBuffer attribs, boolean normalise, boolean signed)
          Set the attribute values at the given index to a new value.
 void setAttributes(int index, int size, java.nio.ShortBuffer attribs, boolean normalise, boolean signed)
          Set the attribute values at the given index to a new value.
 void setColors(boolean hasAlpha, java.nio.FloatBuffer colors)
          Set the color array reference to the new array.
 void setFogCoordinates(java.nio.FloatBuffer coords)
          Set the fog coordinate reference to the new array.
protected  void setLive(boolean state)
          Notification that this object is live now.
 void setNormals(java.nio.FloatBuffer normals)
          Set the normal array reference to the new array.
 void setSecondaryColors(java.nio.FloatBuffer colors)
          Set the secondary color reference to the new array.
 void setTextureCoordinates(int[] types, java.nio.FloatBuffer[] texCoords)
          Replace all the texture array reference with the new array.
 void setTextureCoordinates(int[] types, java.nio.FloatBuffer[] texCoords, int numSets)
          Replace all the texture array reference to the new array.
 void setTextureCoordinates(int type, int textureSet, java.nio.FloatBuffer texCoords)
          Set a single texture array reference to the new array.
 void setTextureSetMap(int[] set)
          Set the texture set map to the new mapping.
 void setTextureSetMap(int[] set, int numValid)
          Set the texture set map to the new mapping.
 void setValidVertexCount(int count)
          Set the number of vertices to the new number.
protected  void setVertexState(javax.media.opengl.GL gl)
          Convenience method to pass everything to the rendering pipeline.
 void setVertices(int type, java.nio.FloatBuffer vertices)
          Set the vertex array reference to the new array.
 void setVertices(int type, java.nio.FloatBuffer vertices, int numValid)
          Set the vertex array reference to the new array.
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.Geometry
addParent, boundsChanged, checkPickMask, getBounds, getPickableBounds, getPickMask, getPickTargetType, hasTransparency, markBoundsDirty, pickBatch, pickLineRay, pickLineSegment, pickSingle, removeParent, setBounds, setPickMask
 
Methods inherited from class org.j3d.aviatrix3d.NodeComponent
addParent, getParents, numParents, removeParent
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, checkForCyclicParent, dataChanged, getAppUpdateWriteTimingMessage, getBoundsWriteTimingMessage, getDataWriteTimingMessage, 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.GeometryRenderable
hasTransparency, render
 
Methods inherited from interface org.j3d.aviatrix3d.rendering.Renderable
equals
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

COORDINATE_2

public static final int COORDINATE_2
2D Coordinate information is included in the vertex values

See Also:
Constant Field Values

COORDINATE_3

public static final int COORDINATE_3
3D Coordinate information is included in the vertex values

See Also:
Constant Field Values

COORDINATE_4

public static final int COORDINATE_4
4D Coordinate information is included in the vertex values

See Also:
Constant Field Values

COORDINATE_MASK

protected static final int COORDINATE_MASK
Mask to work out what coordinates are used

See Also:
Constant Field Values

COORDINATE_CLEAR

protected static final int COORDINATE_CLEAR
Mask to clear the coordinate setting

See Also:
Constant Field Values

NORMALS

protected static final int NORMALS
Normal information is included in the vertex values

See Also:
Constant Field Values

NORMAL_CLEAR

protected static final int NORMAL_CLEAR
Mask to clear the normal setting

See Also:
Constant Field Values

TEXTURE_MASK

protected static final int TEXTURE_MASK
Mask to work out if texture coordinates are used

See Also:
Constant Field Values

TEXTURE_CLEAR

protected static final int TEXTURE_CLEAR
Mask to clear the texture coordinate setting

See Also:
Constant Field Values

TEXTURE_COORDINATE_SINGLE

protected static final int TEXTURE_COORDINATE_SINGLE
Single set of texture coordinates are included in the vertex values

See Also:
Constant Field Values

TEXTURE_COORDINATE_MULTI

protected static final int TEXTURE_COORDINATE_MULTI
Multiple sets of texture coordinates are included in the vertex values

See Also:
Constant Field Values

TEXTURE_SET_AVAILABLE

protected static final int TEXTURE_SET_AVAILABLE
Has a valid texture set provided

See Also:
Constant Field Values

TEXTURE_SET_CLEAR

protected static final int TEXTURE_SET_CLEAR
Has a valid texture set provided

See Also:
Constant Field Values

COLOR_MASK

protected static final int COLOR_MASK
Mask to work out if colours are used

See Also:
Constant Field Values

COLOR_CLEAR

protected static final int COLOR_CLEAR
Mask to clear the per-vertex colour setting

See Also:
Constant Field Values

COLOR_3

protected static final int COLOR_3
RGB colour values are supplied in the data

See Also:
Constant Field Values

COLOR_4

protected static final int COLOR_4
RGBA colour values are supplied in the data

See Also:
Constant Field Values

EDGE_MASK

protected static final int EDGE_MASK
Mask to work out if edge flags are used

See Also:
Constant Field Values

EDGE_CLEAR

protected static final int EDGE_CLEAR
Mask to clear the edge flag setting

See Also:
Constant Field Values

EDGES

protected static final int EDGES
Edge values are supplied in the data

See Also:
Constant Field Values

COLOR2_MASK

protected static final int COLOR2_MASK
Mask to work out if secondary colours are used

See Also:
Constant Field Values

COLOR2_CLEAR

protected static final int COLOR2_CLEAR
Mask to clear the per-vertex secondary colour setting

See Also:
Constant Field Values

COLOR2

protected static final int COLOR2
Secondary color values are supplied in the data

See Also:
Constant Field Values

FOG_MASK

protected static final int FOG_MASK
Mask to work out if fog coordinates are used

See Also:
Constant Field Values

FOG_CLEAR

protected static final int FOG_CLEAR
Mask to clear the fog coordinate setting

See Also:
Constant Field Values

FOG

protected static final int FOG
Fog coordinate values are supplied in the data

See Also:
Constant Field Values

ATTRIB_MASK

protected static final int ATTRIB_MASK
Mask to work out if shader vertex attributes are used

See Also:
Constant Field Values

ATTRIB_CLEAR

protected static final int ATTRIB_CLEAR
Mask to clear the shader vertex attributes setting

See Also:
Constant Field Values

ATTRIBS

protected static final int ATTRIBS
Edge values are shader vertex attributes in the data

See Also:
Constant Field Values

TEXTURE_COORDINATE_1

public static final int TEXTURE_COORDINATE_1
1D texture coordinates are included in the vertex values

See Also:
Constant Field Values

TEXTURE_COORDINATE_2

public static final int TEXTURE_COORDINATE_2
2D texture coordinates are included in the vertex values

See Also:
Constant Field Values

TEXTURE_COORDINATE_3

public static final int TEXTURE_COORDINATE_3
3D texture coordinates are included in the vertex values

See Also:
Constant Field Values

TEXTURE_COORDINATE_4

public static final int TEXTURE_COORDINATE_4
4D texture coordinates are included in the vertex values

See Also:
Constant Field Values

wkPolygon

protected float[] wkPolygon
Working places for a single quad/triangle


vertexBuffer

protected java.nio.FloatBuffer vertexBuffer
Buffer for holding vertex data


colorBuffer

protected java.nio.FloatBuffer colorBuffer
Buffer for holding colour data


normalBuffer

protected java.nio.FloatBuffer normalBuffer
Buffer for holding normal data


fogBuffer

protected java.nio.FloatBuffer fogBuffer
Buffer for holding fog coordinate data


color2Buffer

protected java.nio.FloatBuffer color2Buffer
Buffer for holding secondary color data


textureBuffer

protected java.nio.FloatBuffer[] textureBuffer
Buffer for holding texture coordinate data


numCoords

protected int numCoords
Number of valid entries in the coordinate array


numTextureArrays

protected int numTextureArrays
The number of valid texture arrays in the textures variable


textureSets

protected int[] textureSets
The texture set map array that describes how to map the arrays


textureTypes

protected int[] textureTypes
Flags for the texture type for each array.


numTextureSets

protected int numTextureSets
List of offsets into the texture array /** The number of texture sets to use from the textureSet array


attributes

protected org.j3d.util.IntHashMap attributes
Map of the attribute Ids to their data (ref to user array). Not allocated unless needed to save on memory footprint as this is a relatively rare usage - only when shaders are in use too.


attribIds

protected int[] attribIds
Listing of the valid attribute IDs for rendering


vertexFormat

protected int vertexFormat
The format of the geometry used

Constructor Detail

BufferGeometry

protected BufferGeometry()
/** Constructs an instance with pre-defined values with default values.

Method Detail

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 SceneGraphObject
Parameters:
state - true if this should be marked as live now

isVisible

protected boolean isVisible()
Check to see if this geometry is making the geometry visible or not. Returns true if the defined number of coordinates is non-zero.

Overrides:
isVisible in class Geometry
Returns:
true when the geometry is visible

is2D

public boolean is2D()
Check to see whether this shape is something that represents 2D or 3D geometry. Pure 2D geometry is not effected by any EffectRenderable, while 3D is. Note that this can be changed depending on the type of geometry itself. A Shape3D node with an IndexedLineArray that only has 2D coordinates is as much a 2D geometry as a raster object.

Specified by:
is2D in class Geometry
Returns:
True if this is 2D geometry, false if this is 3D

getVertexType

public int getVertexType()
Get the current vertex format type - 2D, 3D, or 4D.

Returns:
The number of dimensions to the coordinates - 2D, 3D or 4D

getValidVertexCount

public int getValidVertexCount()
Get the number of vertices that are valid in the geometry arrays.

Returns:
a number >= 0

setValidVertexCount

public void setValidVertexCount(int count)
                         throws java.lang.IllegalArgumentException,
                                InvalidWriteTimingException
Set the number of vertices to the new number.

In a live scene graph, can only be called during the bounds changed callback.

Parameters:
count - The new number, must be >= 0
Throws:
java.lang.IllegalArgumentException - The number is negative
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener bounds changed callback method

setVertices

public void setVertices(int type,
                        java.nio.FloatBuffer vertices)
                 throws InvalidWriteTimingException
Set the vertex array reference to the new array. The number of valid items is taken to be the length of the array divided by three. This replaces the existing vertex list array reference with the new reference.

In a live scene graph, can only be called during the bounds changed callback.

Parameters:
type - The number of dimensions to the coordinates - 2D, 3D or 4D
vertices - The new array reference to use for vertex information
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener bounds changed callback method

getVertices

public void getVertices(java.nio.FloatBuffer vertices)
Retrieve the vertices that are currently set. The array must be at least as long as the valid vertex count, times 3. If none are set currently or have been cleared, the provided array is untouched.

Parameters:
vertices - The array to copy the values into
Throws:
java.lang.ArrayIndexOutOfBoundsException - The provided array is too short

setVertices

public void setVertices(int type,
                        java.nio.FloatBuffer vertices,
                        int numValid)
                 throws java.lang.IllegalArgumentException,
                        InvalidWriteTimingException
Set the vertex array reference to the new array. The number of valid items is taken from the second parameter. This replaces the existing vertex list array reference with the new reference.

In a live scene graph, can only be called during the bounds changed callback.

Parameters:
type - The number of dimensions to the coordinates - 2D, 3D or 4D
vertices - The new array reference to use for vertex information
numValid - The number of valid values to use in the array
Throws:
java.lang.IllegalArgumentException - The number is negative
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener bounds changed callback method

setColors

public void setColors(boolean hasAlpha,
                      java.nio.FloatBuffer colors)
               throws java.lang.IllegalArgumentException,
                      InvalidWriteTimingException
Set the color array reference to the new array. The number of valid items is taken to be the length of the array divided by three. This replaces the existing vertex list array reference with the new reference.

In a live scene graph, can only be called during the data changed callback.

Parameters:
hasAlpha - true if this is 4 component colour, false for 3 component
colors - The new array reference to use for color information
Throws:
java.lang.IllegalArgumentException - The length of the colors array is less than the number of declared vertices
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method

getColors

public void getColors(java.nio.FloatBuffer col)
Retrieve the colours that are currently set. The array must be at least as long as the valid vertex count, times 3 or 4, depending on whether alpha values are currently set. If none are set currently or have been cleared, the provided array is untouched.

Parameters:
col - The array to copy the values into
Throws:
java.lang.ArrayIndexOutOfBoundsException - The provided array is too short

setNormals

public void setNormals(java.nio.FloatBuffer normals)
                throws java.lang.IllegalArgumentException,
                       InvalidWriteTimingException
Set the normal array reference to the new array. The number of valid items is taken to be the length of the array divided by three. This replaces the existing normal list array reference with the new reference.

In a live scene graph, can only be called during the data changed callback.

Parameters:
normals - The new array reference to use for normal information
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method
java.lang.IllegalArgumentException

getNormals

public void getNormals(java.nio.FloatBuffer n)
Retrieve the normals that are currently set. The array must be at least as long as the valid vertex count, times 3. If none are set currently or have been cleared, the provided array is untouched.

Parameters:
n - The array to copy the values into
Throws:
java.lang.ArrayIndexOutOfBoundsException - The provided array is too short

setTextureSetMap

public void setTextureSetMap(int[] set)
                      throws InvalidWriteTimingException
Set the texture set map to the new mapping. The number of sets defined is the length of the array.

In a live scene graph, can only be called during the data changed callback.

Parameters:
set - The new set to use
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method

setTextureSetMap

public void setTextureSetMap(int[] set,
                             int numValid)
                      throws InvalidWriteTimingException
Set the texture set map to the new mapping. The number of sets defined is the numValid parameter.

In a live scene graph, can only be called during the data changed callback.

Parameters:
set - The new set to use
numValid - The length of the set to use
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method

setTextureCoordinates

public void setTextureCoordinates(int type,
                                  int textureSet,
                                  java.nio.FloatBuffer texCoords)
                           throws java.lang.IllegalArgumentException,
                                  InvalidWriteTimingException
Set a single texture array reference to the new array. The number of valid items is taken to be the length of the array divided by three. This replaces the existing tex coord list array reference with the new reference.

In a live scene graph, can only be called during the data changed callback.

Parameters:
type - The texture type - 1D, 2D, 3D, 4D.
textureSet - The set to update with these arrays
texCoords - The new array reference to use for vertex information
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method
java.lang.IllegalArgumentException

setTextureCoordinates

public void setTextureCoordinates(int[] types,
                                  java.nio.FloatBuffer[] texCoords)
                           throws java.lang.IllegalArgumentException,
                                  InvalidWriteTimingException
Replace all the texture array reference with the new array. The number of valid items is taken to be the length of the array divided by the vertex format defined for this instance. This replaces the existing tex coord list array reference with the new reference.

In a live scene graph, can only be called during the data changed callback.

Parameters:
types - The sets of texture coordinate types that match each array
texCoords - The new array reference to use for vertex information
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method
java.lang.IllegalArgumentException

setTextureCoordinates

public void setTextureCoordinates(int[] types,
                                  java.nio.FloatBuffer[] texCoords,
                                  int numSets)
                           throws java.lang.IllegalArgumentException,
                                  InvalidWriteTimingException
Replace all the texture array reference to the new array. The number of valid texture coordinates is taken from the numValid parameter. The number of available sets is defined by numSets parameter.

In a live scene graph, can only be called during the data changed callback.

Parameters:
types - The sets of texture coordinate types that match each array
texCoords - The new array reference to use for vertex information
numSets - The number of texture sets that are valid
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method
java.lang.IllegalArgumentException

getTextureCoordinates

public void getTextureCoordinates(java.nio.FloatBuffer[] coords)
Retrieve the texture coordinates that are currently set. The array must be at least as long as the valid vertex count, times 3. If none are set currently or have been cleared, the provided array is untouched.

Parameters:
coords - The array to copy the values into
Throws:
java.lang.ArrayIndexOutOfBoundsException - The provided array is too short

setFogCoordinates

public void setFogCoordinates(java.nio.FloatBuffer coords)
                       throws java.lang.IllegalArgumentException,
                              InvalidWriteTimingException
Set the fog coordinate reference to the new array. The number of valid items is taken to be the length of the array (there's only one coord per vertex). This replaces the existing fog coordinate array reference with the new reference. If set to null, will clear the use of fog coordinates. Setting this value will also cause the system to automatically make use of them rather than the fragment depth (it will inherently call glFogi(GL_FOG_COORDINATE_SOURCE, GL_FOG_COORDINATE) before setting these values and then clear it afterwards.

In a live scene graph, can only be called during the data changed callback.

Parameters:
coords - The new array reference to use for z depth values
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method
java.lang.IllegalArgumentException

getFogCoordinates

public void getFogCoordinates(java.nio.FloatBuffer fogs)
Retrieve the fog coordinates that are currently set. The array must be at least as long as the valid vertex count, times 3. If none are set currently or have been cleared, the provided array is untouched.

Parameters:
fogs - The array to copy the values into
Throws:
java.lang.ArrayIndexOutOfBoundsException - The provided array is too short

setSecondaryColors

public void setSecondaryColors(java.nio.FloatBuffer colors)
                        throws java.lang.IllegalArgumentException,
                               InvalidWriteTimingException
Set the secondary color reference to the new array. The number of valid items is taken to be the length of the array divided by three as secondary color values cannot have an alpha value specified. This replaces the existing secondary color array reference with the new reference.

In a live scene graph, can only be called during the data changed callback.

Parameters:
colors - The new array reference to use for secondary color information
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method
java.lang.IllegalArgumentException

getSecondaryColors

public void getSecondaryColors(java.nio.FloatBuffer cols)
Retrieve the secondary colors that are currently set. The array must be at least as long as the valid vertex count, times 3. If none are set currently or have been cleared, the provided array is untouched.

Parameters:
cols - The array to copy the values into
Throws:
java.lang.ArrayIndexOutOfBoundsException - The provided array is too short

setAttributes

public void setAttributes(int index,
                          int size,
                          java.nio.FloatBuffer attribs,
                          boolean normalise)
                   throws java.lang.IllegalArgumentException,
                          InvalidWriteTimingException
Set the attribute values at the given index to a new value. The array provided must have a length of the number of coordinates times the size. Setting a size of -1 means to clear this attribute index from being used in future geometry updates. The size parameter must be one of -1, 1, 2, 3 or 4.

No checks are made on the index value and it is assumed the user provides valid values for this after binding the index in the ShaderProgram class.

Note: If the index provided is zero, then this attribute will replace the vertex values (eg a glVertex() call) with the attribute value, as per the OpenGL specification.

In a live scene graph, can only be called during the data changed callback.

Parameters:
index - The attribute index to set these values for
size - The number of components: -1, 1, 2, 3 or 4
attribs - The new array reference to use for attribute information
normalise - true if the values should be normalised [-1.0, 1.0]
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method
java.lang.IllegalArgumentException

setAttributes

public void setAttributes(int index,
                          int size,
                          java.nio.DoubleBuffer attribs,
                          boolean normalise)
                   throws java.lang.IllegalArgumentException,
                          InvalidWriteTimingException
Set the attribute values at the given index to a new value. The array provided must have a length of the number of coordinates times the size. Setting a size of -1 means to clear this attribute index from being used in future geometry updates. The size parameter must be one of -1, 1, 2, 3 or 4.

No checks are made on the index value and it is assumed the user provides valid values for this after binding the index in the ShaderProgram class.

Note: If the index provided is zero, then this attribute will replace the vertex values (eg a glVertex() call) with the attribute value, as per the OpenGL specification.

In a live scene graph, can only be called during the data changed callback.

Parameters:
index - The attribute index to set these values for
size - The number of components: -1, 1, 2, 3 or 4
attribs - The new array reference to use for attribute information
normalise - true if the values should be normalised [-1.0, 1.0]
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method
java.lang.IllegalArgumentException

setAttributes

public void setAttributes(int index,
                          int size,
                          java.nio.IntBuffer attribs,
                          boolean normalise,
                          boolean signed)
                   throws java.lang.IllegalArgumentException,
                          InvalidWriteTimingException
Set the attribute values at the given index to a new value. The array provided must have a length of the number of coordinates times the size. Setting a size of -1 means to clear this attribute index from being used in future geometry updates. The size parameter must be one of -1, 1, 2, 3 or 4.

No checks are made on the index value and it is assumed the user provides valid values for this after binding the index in the ShaderProgram class.

Note: If the index provided is zero, then this attribute will replace the vertex values (eg a glVertex() call) with the attribute value, as per the OpenGL specification.

In a live scene graph, can only be called during the data changed callback.

Parameters:
index - The attribute index to set these values for
size - The number of components: -1, 1, 2, 3 or 4
attribs - The new array reference to use for attribute information
normalise - true if the values should be normalised [-1.0, 1.0]
signed - false if this is unsigned ints, true for signed values
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method
java.lang.IllegalArgumentException

setAttributes

public void setAttributes(int index,
                          int size,
                          java.nio.ShortBuffer attribs,
                          boolean normalise,
                          boolean signed)
                   throws java.lang.IllegalArgumentException,
                          InvalidWriteTimingException
Set the attribute values at the given index to a new value. The array provided must have a length of the number of coordinates times the size. Setting a size of -1 means to clear this attribute index from being used in future geometry updates. The size parameter must be one of -1, 1, 2, 3 or 4.

No checks are made on the index value and it is assumed the user provides valid values for this after binding the index in the ShaderProgram class.

Note: If the index provided is zero, then this attribute will replace the vertex values (eg a glVertex() call) with the attribute value, as per the OpenGL specification.

In a live scene graph, can only be called during the data changed callback.

Parameters:
index - The attribute index to set these values for
size - The number of components: -1, 1, 2, 3 or 4
attribs - The new array reference to use for attribute information
normalise - true if the values should be normalised [-1.0, 1.0]
signed - false if this is unsigned shorts, true for signed values
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method
java.lang.IllegalArgumentException

setAttributes

public void setAttributes(int index,
                          int size,
                          java.nio.ByteBuffer attribs,
                          boolean normalise,
                          boolean signed)
                   throws java.lang.IllegalArgumentException,
                          InvalidWriteTimingException
Set the attribute values at the given index to a new value. The array provided must have a length of the number of coordinates times the size. Setting a size of -1 means to clear this attribute index from being used in future geometry updates. The size parameter must be one of -1, 1, 2, 3 or 4.

No checks are made on the index value and it is assumed the user provides valid values for this after binding the index in the ShaderProgram class.

Note: If the index provided is zero, then this attribute will replace the vertex values (eg a glVertex() call) with the attribute value, as per the OpenGL specification.

In a live scene graph, can only be called during the data changed callback.

Parameters:
index - The attribute index to set these values for
size - The number of components: -1, 1, 2, 3 or 4
attribs - The new array reference to use for attribute information
normalise - true if the values should be normalised [-1.0, 1.0]
signed - false if this is unsigned shorts, true for signed values
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method
java.lang.IllegalArgumentException

setVertexState

protected void setVertexState(javax.media.opengl.GL gl)
Convenience method to pass everything to the rendering pipeline. Will check for the various masks being set and only send the needed data. The only call not made here is the glDrawArrays() or equivalent.

Parameters:
gl - The gl context to draw with

clearVertexState

protected void clearVertexState(javax.media.opengl.GL gl)
Convenience method to clear the previously set state in the rendering pipeline. Should be called just after the derived class calls glDrawArrays() or equivalent.

Parameters:
gl - The gl context to draw with

updateBounds

protected void updateBounds()
Update this node's bounds and then call the parent to update it's bounds. Used to propogate bounds changes from the leaves of the tree to the root. A node implementation may decide when and where to tell the parent(s)s that updates are ready.

Overrides:
updateBounds in class Geometry

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.

Specified by:
recomputeBounds in class Geometry

initPolygonDetails

protected void initPolygonDetails(int numCoords)
Initialize the internal arrays to a given size for the picking.

Parameters:
numCoords - The number of coordinates in the polygon

ray3DTriangleChecked

protected boolean ray3DTriangleChecked(float[] origin,
                                       float[] direction,
                                       float length,
                                       float[] dataOut)
Private version of the ray - Polygon intersection test that does not do any bounds checking on arrays and assumes everything is correct. Allows fast calls to this method for internal use as well as more expensive calls with checks for the public interfaces.

This method does not use wkPoint.

Parameters:
origin - The origin of the ray
direction - The direction of the ray
length - An optional length for to make the ray a segment. If the value is zero, it is ignored
dataOut - The intersection coordinates and more
Returns:
true if there was an intersection, false if not

ray3DQuadChecked

protected boolean ray3DQuadChecked(float[] origin,
                                   float[] direction,
                                   float length,
                                   float[] dataOut)
Private version of the ray - Polygon intersection test that does not do any bounds checking on arrays and assumes everything is correct. Allows fast calls to this method for internal use as well as more expensive calls with checks for the public interfaces.

This method does not use wkPoint.

Parameters:
origin - The origin of the ray
direction - The direction of the ray
length - An optional length for to make the ray a segment. If the value is zero, it is ignored
dataOut - The intersection coordinates and more
Returns:
true if there was an intersection, false if not

Aviatrix3D
2.1.0

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