NASA World Wind

gov.nasa.worldwind.ogc.collada
Class ColladaAbstractGeometry

java.lang.Object
  extended by gov.nasa.worldwind.util.xml.AbstractXMLEventParser
      extended by gov.nasa.worldwind.ogc.collada.ColladaAbstractObject
          extended by gov.nasa.worldwind.ogc.collada.ColladaAbstractGeometry
All Implemented Interfaces:
XMLEventParser
Direct Known Subclasses:
ColladaLines, ColladaTriangles

public abstract class ColladaAbstractGeometry
extends ColladaAbstractObject

Base class for COLLADA geometry (lines and triangles).


Field Summary
static int COORDS_PER_VERTEX
          Number of coordinates per vertex.
static String DEFAULT_TEX_COORD_SEMANTIC
          Default semantic that identifies texture coordinates.
protected  List<ColladaInput> inputs
          Inputs for the geometry.
static int TEX_COORDS_PER_VERTEX
          Number of texture coordinates per vertex.
 
Fields inherited from class gov.nasa.worldwind.util.xml.AbstractXMLEventParser
CHARACTERS_CONTENT, fields, namespaceURI, parent
 
Constructor Summary
ColladaAbstractGeometry(String ns)
          Create a new instance.
 
Method Summary
 int getCount()
          Indicates the number of shapes (lines or triangles) in the geometry.
protected  void getFloatFromAccessor(FloatBuffer buffer, ColladaAccessor accessor, String semantic, int floatsPerVertex)
          Retrieve numbers from an accessor.
protected  int[] getIndices(String semantic)
           
 List<ColladaInput> getInputs()
          Indicates the inputs that provide vertices, textures coordinates, etc.
 String getMaterial()
          Indicates the identifier for the material applied to this geometry.
 ColladaAccessor getNormalAccessor()
           
 void getNormals(FloatBuffer buffer)
          Retrieves normal vectors in this geometry.
 ColladaAccessor getTexCoordAccessor(String semantic)
          Indicates the accessor for texture coordinates.
 void getTextureCoordinates(FloatBuffer buffer, String semantic)
          Retrieves the texture coordinates of vertices in this geometry.
 ColladaAccessor getVertexAccessor()
           
 void getVertices(FloatBuffer buffer)
          Retrieves the coordinates of vertices in this geometry.
protected abstract  int getVerticesPerShape()
          Indicates the number of vertices per shape in the geometry.
 void setField(String keyName, Object value)
          
 
Methods inherited from class gov.nasa.worldwind.ogc.collada.ColladaAbstractObject
getLocalExtent, getRoot
 
Methods inherited from class gov.nasa.worldwind.util.xml.AbstractXMLEventParser
allocate, doAddCharacters, doAddEventAttribute, doAddEventContent, doParseEventAttributes, doParseEventContent, freeResources, getAConstructor, getCharacters, getField, getField, getFields, getNamespaceURI, getParent, hasField, hasField, hasFields, mergeFields, newInstance, overrideFields, parse, parseCharacterContent, removeField, setField, setFields, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COORDS_PER_VERTEX

public static final int COORDS_PER_VERTEX
Number of coordinates per vertex.

See Also:
Constant Field Values

DEFAULT_TEX_COORD_SEMANTIC

public static final String DEFAULT_TEX_COORD_SEMANTIC
Default semantic that identifies texture coordinates. Used the a file does not specify the semantic using a bind_vertex_input element.

See Also:
Constant Field Values

inputs

protected List<ColladaInput> inputs
Inputs for the geometry. Inputs provide the geometry with vertices, texture coordinates, etc.


TEX_COORDS_PER_VERTEX

public static final int TEX_COORDS_PER_VERTEX
Number of texture coordinates per vertex.

See Also:
Constant Field Values
Constructor Detail

ColladaAbstractGeometry

public ColladaAbstractGeometry(String ns)
Create a new instance.

Parameters:
ns - the qualifying namespace URI. May be null to indicate no namespace qualification.
Method Detail

getCount

public int getCount()
Indicates the number of shapes (lines or triangles) in the geometry.

Returns:
The number of shapes in the geometry.

getFloatFromAccessor

protected void getFloatFromAccessor(FloatBuffer buffer,
                                    ColladaAccessor accessor,
                                    String semantic,
                                    int floatsPerVertex)
Retrieve numbers from an accessor.

Parameters:
buffer - Buffer to receive floats.
accessor - Accessor that will provide floats.
semantic - Semantic that identifiers the set of indices to use (for example, "VERTEX" or "NORMAL").
floatsPerVertex - Number of floats to read for each vertex.

getIndices

protected int[] getIndices(String semantic)

getInputs

public List<ColladaInput> getInputs()
Indicates the inputs that provide vertices, textures coordinates, etc. to the geometry.

Returns:
Inputs to the geometry.

getMaterial

public String getMaterial()
Indicates the identifier for the material applied to this geometry.

Returns:
The material applied to this geometry. May be null.

getNormalAccessor

public ColladaAccessor getNormalAccessor()

getNormals

public void getNormals(FloatBuffer buffer)
Retrieves normal vectors in this geometry.

Parameters:
buffer - Buffer to receive coordinates.

getTexCoordAccessor

public ColladaAccessor getTexCoordAccessor(String semantic)
Indicates the accessor for texture coordinates.

Parameters:
semantic - Semantic that identifies the texture coordinates. May be null, in which case the semantic "TEXCOORD" is used.
Returns:
The texture coordinates accessor, or null if the accessor cannot be resolved.

getTextureCoordinates

public void getTextureCoordinates(FloatBuffer buffer,
                                  String semantic)
Retrieves the texture coordinates of vertices in this geometry.

Parameters:
buffer - Buffer to receive coordinates.
semantic - String to identify which input holds the texture coordinates. May be null, in which case the "TEXCOORD" is used.

getVertexAccessor

public ColladaAccessor getVertexAccessor()

getVertices

public void getVertices(FloatBuffer buffer)
Retrieves the coordinates of vertices in this geometry.

Parameters:
buffer - Buffer to receive coordinates.

getVerticesPerShape

protected abstract int getVerticesPerShape()
Indicates the number of vertices per shape in the geometry.

Returns:
The number of vertices in each shape.

setField

public void setField(String keyName,
                     Object value)

Overrides:
setField in class AbstractXMLEventParser

NASA World Wind