Aviatrix3D
2.1.0

org.j3d.aviatrix3d
Class TriangleFanArray

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.aviatrix3d.VertexGeometry
                  extended by org.j3d.aviatrix3d.TriangleFanArray
All Implemented Interfaces:
java.lang.Comparable, LeafPickTarget, PickableObject, PickTarget, DeletableRenderable, GeometryRenderable, Renderable

public class TriangleFanArray
extends VertexGeometry

An OpenGL TriangleFanArray.

Setting geometry

Part of the optimisation we make is to only copy into the underlying structures the exact number of coordinates, normals etc that are needed. To know this number, we need to know how many coordinates exist before attempting to set anything else. When constructing, or updating, geometry, you should always make sure that you first set the vertex list, then the sizing information for the strip or fan counts, and then set normals as needed.

Internationalisation Resource Names

Version:
$Revision: 1.37 $
Author:
Justin Couch

Field Summary
 
Fields inherited from class org.j3d.aviatrix3d.VertexGeometry
ATTRIB_CLEAR, ATTRIB_MASK, attribIds, ATTRIBS, attributes, COLOR_3, COLOR_4, COLOR_CLEAR, COLOR_MASK, COLOR_SINGLE, COLOR2, COLOR2_CLEAR, COLOR2_MASK, color2Buffer, color2s, colorBuffer, colors, COORDINATE_2, COORDINATE_3, COORDINATE_4, COORDINATE_CLEAR, COORDINATE_MASK, coordinates, dataChanged, EDGE_CLEAR, EDGE_MASK, EDGES, FOG, FOG_CLEAR, FOG_MASK, fogBuffer, fogCoords, hasMultiTextureAPI, INTERSECT_ALL, INTERSECT_COLOR, INTERSECT_COORDS, INTERSECT_NORMAL, INTERSECT_TEXCOORDS_MULTI, INTERSECT_TEXCOORDS_SINGLE, maxTextureUnits, NORMAL_CLEAR, normalBuffer, normals, NORMALS, numCoords, numRenderedTextureSets, numRequiredCoords, numTextureArrays, numTextureSets, TEXTURE_CLEAR, TEXTURE_COORDINATE_1, TEXTURE_COORDINATE_2, TEXTURE_COORDINATE_3, TEXTURE_COORDINATE_4, TEXTURE_COORDINATE_MULTI, TEXTURE_COORDINATE_SINGLE, TEXTURE_MASK, TEXTURE_SET_AVAILABLE, TEXTURE_SET_CLEAR, textureBuffer, textures, textureSets, textureTypes, useVbo, VBO_HINT_DYNAMIC, VBO_HINT_STATIC, VBO_HINT_STREAM, vboAvailable, vboHint, vboIdMap, vboQueryComplete, vertexBuffer, vertexFormat, wkPolygon
 
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
TriangleFanArray()
          Constructs a TriangleFanArray with default values.
TriangleFanArray(boolean useVbo, int vboHint)
          Constructs an instance.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 int compareTo(TriangleFanArray ta)
          Compares this object with the specified object for order.
 boolean equals(java.lang.Object o)
          Compare this object for equality to the given object.
 boolean equals(TriangleFanArray ta)
          Compares this object with the specified object to check for equivalence.
 void getFanCount(int[] values)
          Get the sizes of the valid fans.
 int getValidFanCount()
          Get the number of valid fans that are defined for this geometry.
protected  boolean isVisible()
          Check to see if this geometry is making the geometry visible or not.
 boolean pickLineRay(float[] origin, float[] direction, boolean findAny, float[] dataOut, int dataOutFlags)
          Check for all intersections against this geometry using a line ray and return the exact distance away of the closest picking point.
 boolean pickLineSegment(float[] start, float[] end, boolean findAny, float[] dataOut, int dataOutFlags)
          Check for all intersections against this geometry using a line segment and return the exact distance away of the closest picking point.
 void render(javax.media.opengl.GL gl)
          Issue ogl commands needed for this renderable object.
 void setFanCount(int[] counts, int num)
          Set the number of valid fans to use.
 
Methods inherited from class org.j3d.aviatrix3d.VertexGeometry
cleanup, clearVertexState, computeBufferSize, fillBufferData, getColor, getColors, getFogCoordinates, getFogCoordinates, getNormal, getNormals, getSecondaryColors, getSecondaryColors, getTextureCoordinate, getTextureCoordinates, getValidVertexCount, getVBOEnabled, getVBOHint, getVertex, getVertexType, getVertices, initPolygonDetails, is2D, isMultiTextureAllowed, numTextureUnits, ray3DQuadChecked, ray3DTriangleChecked, recomputeBounds, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setColors, setFogCoordinates, setLive, setNormals, setSecondaryColors, setSingleColor, setTextureCoordinates, setTextureCoordinates, setTextureCoordinates, setTextureSetMap, setTextureSetMap, setValidVertexCount, setVBOEnabled, setVBOHint, setVertexState, setVertexStateVBO, setVertices, setVertices, updateBounds
 
Methods inherited from class org.j3d.aviatrix3d.Geometry
addParent, boundsChanged, checkPickMask, getBounds, getPickableBounds, getPickMask, getPickTargetType, hasTransparency, markBoundsDirty, pickBatch, 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, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.j3d.aviatrix3d.rendering.GeometryRenderable
hasTransparency
 

Constructor Detail

TriangleFanArray

public TriangleFanArray()
Constructs a TriangleFanArray with default values.


TriangleFanArray

public TriangleFanArray(boolean useVbo,
                        int vboHint)
Constructs an instance.

Parameters:
useVbo - Should we use vertex buffer objects
vboHint - Hints for how to setup VBO. Valid values are VBO_HINT_*.
Method Detail

render

public void render(javax.media.opengl.GL gl)
Issue ogl commands needed for this renderable object.

Parameters:
gl - The gl context to draw with

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 and strips are both non-zero.

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

pickLineSegment

public boolean pickLineSegment(float[] start,
                               float[] end,
                               boolean findAny,
                               float[] dataOut,
                               int dataOutFlags)
                        throws NotPickableException
Check for all intersections against this geometry using a line segment and return the exact distance away of the closest picking point.

Specified by:
pickLineSegment in interface LeafPickTarget
Overrides:
pickLineSegment in class Geometry
Parameters:
start - The start point of the segment
end - The end point of the segment
findAny - True if it only has to find a single intersection and can exit as soon as it finds the first intersection. False if it must find the closest polygon
dataOut - An array to put the data in for the intersection. Exact format is described by the flags
dataOutFlags - A set of derived-class specific flags describing what data should be included in the output array
Returns:
True if an intersection was found according to the input request
Throws:
NotPickableException - This object has been marked as non pickable, but you decided to try to call the method anyway

pickLineRay

public boolean pickLineRay(float[] origin,
                           float[] direction,
                           boolean findAny,
                           float[] dataOut,
                           int dataOutFlags)
                    throws NotPickableException
Check for all intersections against this geometry using a line ray and return the exact distance away of the closest picking point.

Specified by:
pickLineRay in interface LeafPickTarget
Overrides:
pickLineRay in class Geometry
Parameters:
origin - The start point of the ray
direction - The direction vector of the ray
findAny - True if it only has to find a single intersection and can exit as soon as it finds the first intersection. False if it must find the closest polygon
dataOut - An array to put the data in for the intersection. Exact format is described by the flags
dataOutFlags - A set of derived-class specific flags describing what data should be included in the output array
Returns:
True if an intersection was found according to the input request
Throws:
NotPickableException - This object has been marked as non pickable, but you decided to try to call the method anyway

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.

Parameters:
o - The objec 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

equals

public boolean equals(java.lang.Object o)
Compare this object for equality to the given object.

Specified by:
equals in interface Renderable
Overrides:
equals in class java.lang.Object
Parameters:
o - The object to be compared
Returns:
True if these represent the same values

setFanCount

public void setFanCount(int[] counts,
                        int num)
                 throws InvalidWriteTimingException
Set the number of valid fans to use. A check is performed to make sure that the number of vertices high enough to support the total of all the fan counts so make sure to call setVertex() with the required array length before calling this method. Each fan must be a minumum length of three.

Parameters:
counts - The array of counts
num - The number of valid items to read from the array
Throws:
java.lang.IllegalArgumentException - Invalid total fan count or individual fan count < 3
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method

getValidFanCount

public int getValidFanCount()
Get the number of valid fans that are defined for this geometry.

Returns:
a positive number

getFanCount

public void getFanCount(int[] values)
Get the sizes of the valid fans. The passed array must be big enough to contain all the fan counts.

Parameters:
values - An array to copy the strip values into

compareTo

public int compareTo(TriangleFanArray ta)
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:
ta - The argument instance to be compared
Returns:
-1, 0 or 1 depending on order

equals

public boolean equals(TriangleFanArray ta)
Compares this object with the specified object to check for equivalence.

Parameters:
ta - The geometry instance to be compared
Returns:
true if the objects represent identical values

Aviatrix3D
2.1.0

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