Package gov.nasa.worldwind.ogc.collada
Class ColladaAbstractGeometry
- java.lang.Object
-
- gov.nasa.worldwind.util.xml.AbstractXMLEventParser
-
- gov.nasa.worldwind.ogc.collada.ColladaAbstractObject
-
- 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
Fields Modifier and Type Field Description static int
COORDS_PER_VERTEX
Number of coordinates per vertex.static java.lang.String
DEFAULT_TEX_COORD_SEMANTIC
Default semantic that identifies texture coordinates.protected java.util.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
Constructors Constructor Description ColladaAbstractGeometry(java.lang.String ns)
Create a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
getCount()
Indicates the number of shapes (lines or triangles) in the geometry.protected void
getFloatFromAccessor(java.nio.FloatBuffer buffer, ColladaAccessor accessor, java.lang.String semantic, int floatsPerVertex)
Retrieve numbers from an accessor.protected int[]
getIndices(java.lang.String semantic)
java.util.List<ColladaInput>
getInputs()
Indicates the inputs that provide vertices, textures coordinates, etc.java.lang.String
getMaterial()
Indicates the identifier for the material applied to this geometry.ColladaAccessor
getNormalAccessor()
void
getNormals(java.nio.FloatBuffer buffer)
Retrieves normal vectors in this geometry.ColladaAccessor
getTexCoordAccessor(java.lang.String semantic)
Indicates the accessor for texture coordinates.void
getTextureCoordinates(java.nio.FloatBuffer buffer, java.lang.String semantic)
Retrieves the texture coordinates of vertices in this geometry.ColladaAccessor
getVertexAccessor()
void
getVertices(java.nio.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(java.lang.String keyName, java.lang.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, setNamespaceURI, setParent
-
-
-
-
Field Detail
-
DEFAULT_TEX_COORD_SEMANTIC
public static final java.lang.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
-
COORDS_PER_VERTEX
public static final int COORDS_PER_VERTEX
Number of coordinates per vertex.- See Also:
- Constant Field Values
-
TEX_COORDS_PER_VERTEX
public static final int TEX_COORDS_PER_VERTEX
Number of texture coordinates per vertex.- See Also:
- Constant Field Values
-
inputs
protected java.util.List<ColladaInput> inputs
Inputs for the geometry. Inputs provide the geometry with vertices, texture coordinates, etc.
-
-
Method Detail
-
getVerticesPerShape
protected abstract int getVerticesPerShape()
Indicates the number of vertices per shape in the geometry.- Returns:
- The number of vertices in each shape.
-
getInputs
public java.util.List<ColladaInput> getInputs()
Indicates the inputs that provide vertices, textures coordinates, etc. to the geometry.- Returns:
- Inputs to the geometry.
-
getCount
public int getCount()
Indicates the number of shapes (lines or triangles) in the geometry.- Returns:
- The number of shapes in the geometry.
-
getMaterial
public java.lang.String getMaterial()
Indicates the identifier for the material applied to this geometry.- Returns:
- The material applied to this geometry. May be null.
-
getVertices
public void getVertices(java.nio.FloatBuffer buffer)
Retrieves the coordinates of vertices in this geometry.- Parameters:
buffer
- Buffer to receive coordinates.
-
getNormals
public void getNormals(java.nio.FloatBuffer buffer)
Retrieves normal vectors in this geometry.- Parameters:
buffer
- Buffer to receive coordinates.
-
getTextureCoordinates
public void getTextureCoordinates(java.nio.FloatBuffer buffer, java.lang.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.
-
getFloatFromAccessor
protected void getFloatFromAccessor(java.nio.FloatBuffer buffer, ColladaAccessor accessor, java.lang.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(java.lang.String semantic)
-
getVertexAccessor
public ColladaAccessor getVertexAccessor()
-
getNormalAccessor
public ColladaAccessor getNormalAccessor()
-
getTexCoordAccessor
public ColladaAccessor getTexCoordAccessor(java.lang.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.
-
setField
public void setField(java.lang.String keyName, java.lang.Object value)
- Overrides:
setField
in classAbstractXMLEventParser
-
-