javax.media.j3d
Class GeneralizedVertexList

java.lang.Object
  extended by javax.media.j3d.GeneralizedVertexList
All Implemented Interfaces:
GeneralizedStripFlags

 class GeneralizedVertexList
extends java.lang.Object
implements GeneralizedStripFlags

The GeneralizedVertexList class is a variable-size list used to collect the vertices for a generalized strip of points, lines, or triangles. This is used by the GeometryDecompressor. This class implements the GeneralizedStripFlags interface and provides methods for copying instance vertex data into various fixed-size GeometryArray representations.

See Also:
GeneralizedStrip, GeometryDecompressor

Nested Class Summary
(package private)  class GeneralizedVertexList.Vertex
          A class with fields corresponding to all the data that can be bundled with the vertices of generalized strips.
 
Field Summary
private  int frontFace
           
private  boolean hasColor3
           
private  boolean hasColor4
           
private  boolean hasNormals
           
(package private)  int stripCount
          Count of number of strips generated after conversion to GeometryArray.
(package private)  int triangleCount
          Count of number of triangles generated after conversion to GeometryArray.
(package private)  int vertexCount
          Count of number of vertices generated after conversion to GeometryArray.
(package private)  int vertexFormat
          Bits describing the data bundled with each vertex.
private  java.util.ArrayList vertices
           
 
Fields inherited from interface javax.media.j3d.GeneralizedStripFlags
FRONTFACE_CCW, FRONTFACE_CW, REPLACE_MIDDLE, REPLACE_OLDEST, RESTART_CCW, RESTART_CW
 
Constructor Summary
GeneralizedVertexList(int vertexFormat, int frontFace)
          Creates a new GeneralizedVertexList for the specified vertex format.
GeneralizedVertexList(int vertexFormat, int frontFace, int initSize)
          Creates a new GeneralizedVertexList for the specified vertex format.
 
Method Summary
(package private)  void addVertex(Point3f pos, Vector3f norm, Color4f color, int flag)
          Copy vertex data to a new Vertex object and add it to this list.
private  void copyVertexData(GeometryArray ga, GeneralizedStrip.IntList indices)
           
 int getFlag(int index)
          Return the flag associated with the vertex at the specified index.
 int getFlagCount()
          Return the number of flags.
(package private)  void setVertexFormat(int vertexFormat)
          Sets the vertex format for this vertex list.
(package private)  int size()
          Return the number of vertices in this list.
(package private)  LineStripArray toLineStripArray()
          Output a LineStripArray.
(package private)  PointArray toPointArray()
          Output a PointArray.
(package private)  GeometryStripArray[] toStripAndFanArrays()
          Output triangle strip and triangle fan arrays.
(package private)  GeometryArray[] toStripAndTriangleArrays()
          Output triangle strip and and triangle arrays.
(package private)  TriangleArray toTriangleArray()
          Output a TriangleArray.
(package private)  TriangleStripArray toTriangleStripArray()
          Output a TriangleStripArray.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vertices

private java.util.ArrayList vertices

hasColor3

private boolean hasColor3

hasColor4

private boolean hasColor4

hasNormals

private boolean hasNormals

frontFace

private int frontFace

stripCount

int stripCount
Count of number of strips generated after conversion to GeometryArray.


vertexCount

int vertexCount
Count of number of vertices generated after conversion to GeometryArray.


triangleCount

int triangleCount
Count of number of triangles generated after conversion to GeometryArray.


vertexFormat

int vertexFormat
Bits describing the data bundled with each vertex. This is specified using the GeometryArray mask components.

Constructor Detail

GeneralizedVertexList

GeneralizedVertexList(int vertexFormat,
                      int frontFace,
                      int initSize)
Creates a new GeneralizedVertexList for the specified vertex format.

Parameters:
vertexFormat - a mask indicating which components are present in each vertex, as used by GeometryArray.
frontFace - a flag, either GeneralizedStripFlags.FRONTFACE_CW or GeneralizedStripFlags.FRONTFACE_CCW, indicating front face winding
initSize - initial number of elements
See Also:
GeometryArray

GeneralizedVertexList

GeneralizedVertexList(int vertexFormat,
                      int frontFace)
Creates a new GeneralizedVertexList for the specified vertex format.

Parameters:
vertexFormat - a mask indicating which components are present in each vertex, as used by GeometryArray.
frontFace - a flag, either GeneralizedStripFlags.FRONTFACE_CW or GeneralizedStripFlags.FRONTFACE_CCW, indicating front face winding
See Also:
GeometryArray
Method Detail

setVertexFormat

void setVertexFormat(int vertexFormat)
Sets the vertex format for this vertex list.

Parameters:
vertexFormat - a mask indicating which components are present in each vertex, as used by GeometryArray.

addVertex

void addVertex(Point3f pos,
               Vector3f norm,
               Color4f color,
               int flag)
Copy vertex data to a new Vertex object and add it to this list.


size

int size()
Return the number of vertices in this list.


getFlagCount

public int getFlagCount()
Description copied from interface: GeneralizedStripFlags
Return the number of flags. This should be the same as the number of vertices in the generalized strip.

Specified by:
getFlagCount in interface GeneralizedStripFlags

getFlag

public int getFlag(int index)
Description copied from interface: GeneralizedStripFlags
Return the flag associated with the vertex at the specified index.

Specified by:
getFlag in interface GeneralizedStripFlags

copyVertexData

private void copyVertexData(GeometryArray ga,
                            GeneralizedStrip.IntList indices)

toPointArray

PointArray toPointArray()
Output a PointArray.


toTriangleArray

TriangleArray toTriangleArray()
Output a TriangleArray.


toLineStripArray

LineStripArray toLineStripArray()
Output a LineStripArray.


toTriangleStripArray

TriangleStripArray toTriangleStripArray()
Output a TriangleStripArray.


toStripAndFanArrays

GeometryStripArray[] toStripAndFanArrays()
Output triangle strip and triangle fan arrays.

Returns:
a 2-element array of GeometryStripArray; element 0 if non-null will contain a TriangleStripArray, and element 1 if non-null will contain a TriangleFanArray.

toStripAndTriangleArrays

GeometryArray[] toStripAndTriangleArrays()
Output triangle strip and and triangle arrays.

Returns:
a 2-element array of GeometryArray; element 0 if non-null will contain a TriangleStripArray, and element 1 if non-null will contain a TriangleArray.


Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.