public class ColladaMeshShape extends AbstractGeneralShape
ColladaLines
or ColladaTriangles
, but a single instance cannot render both lines and triangles. New
instances are created by createTriangleMesh
and createLineMesh
.
This shape supports only COLLADA line and triangle geometries.
Modifier and Type | Class and Description |
---|---|
protected static class |
ColladaMeshShape.ExtentCacheKey |
protected static class |
ColladaMeshShape.Geometry
Geometry and attributes of a COLLADA
triangles or lines element. |
static class |
ColladaMeshShape.OrderedMeshShape
Class to represent an instance of the mesh to be drawn as an ordered renderable.
|
protected static class |
ColladaMeshShape.ShapeData
This class holds globe-specific data for this shape.
|
AbstractShape.AbstractShapeData
Modifier and Type | Field and Description |
---|---|
protected ColladaBindMaterial |
bindMaterial
Material applied to this mesh.
|
protected java.nio.FloatBuffer |
coordBuffer
The vertex data buffer for this shape data.
|
protected int |
elementType
OpenGL element type for this shape (GL.GL_LINES or GL.GL_TRIANGLES).
|
protected java.util.Map<ColladaMeshShape.ExtentCacheKey,Extent> |
extentCache
Cache of shape extents computed for different transform matrices.
|
protected java.util.List<ColladaMeshShape.Geometry> |
geometries
Geometry objects that describe different parts of the mesh.
|
protected java.nio.FloatBuffer |
normalBuffer
The slice of the
coordBuffer that contains normals. |
protected int |
normalBufferPosition
The index of the first normal in the
coordBuffer . |
protected int |
shapeCount
Total number of shapes (lines or triangles) in this mesh.
|
protected int |
texCoordBufferPosition
The index of the first texture coordinate in the
coordBuffer . |
protected java.nio.FloatBuffer |
textureCoordsBuffer
Texture coordinates for all geometries in this shape.
|
protected int |
vertsPerShape
Number of vertices per shape.
|
heading, modelPosition, modelScale, pitch, resourceMap, roll
activeAttributes, altitudeMode, BEogsh, currentData, DEFAULT_ALTITUDE_MODE, DEFAULT_GEOMETRY_GENERATION_INTERVAL, DEFAULT_HIGHLIGHT_MATERIAL, DEFAULT_INTERIOR_MATERIAL, DEFAULT_OUTLINE_MATERIAL, DEFAULT_OUTLINE_PICK_WIDTH, defaultAttributes, delegateOwner, dragEnabled, draggableSupport, enableBatchPicking, enableBatchRendering, enableDepthOffset, highlightAttrs, highlighted, maxExpiryTime, minExpiryTime, normalAttrs, outlinePickWidth, outlineShapeRenderer, pickLayer, pickSupport, referencePosition, sector, shapeDataCache, surfaceShape, VBO_THRESHOLD, viewDistanceExpiration, visible
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
Modifier | Constructor and Description |
---|---|
protected |
ColladaMeshShape(java.util.List<? extends ColladaAbstractGeometry> geometries)
Create an instance of the shape.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addOrderedRenderable(DrawContext dc)
Adds this shape to the draw context's ordered renderable list.
|
protected void |
applyMaterial(DrawContext dc,
Material material)
Apply a material to the active draw context.
|
protected OGLStackHandler |
beginDrawing(DrawContext dc,
int attrMask)
Establish the OpenGL state needed to draw this shape.
|
protected Extent |
computeExtent(DrawContext dc)
Compute the shape's extent, using the active orientation matrix.
|
protected double |
computeEyeDistance(DrawContext dc)
Computes the minimum distance between this shape and the eye point.
|
protected Vec4 |
computeReferenceCenter(DrawContext dc)
Computes this shape's reference center.
|
protected Matrix |
computeRenderMatrix(DrawContext dc)
Computes the transform to use during rendering to orient the model.
|
protected AbstractShape.AbstractShapeData |
createCacheEntry(DrawContext dc)
Creates and returns a new cache entry specific to the subclass.
|
protected void |
createFullGeometry(DrawContext dc)
Create full geometry for the shape, including normals and texture coordinates.
|
static ColladaMeshShape |
createLineMesh(java.util.List<ColladaLines> geometries,
ColladaBindMaterial bindMaterial)
Create a line mesh shape.
|
protected void |
createMinimalGeometry(DrawContext dc,
ColladaMeshShape.ShapeData shapeData)
Compute enough geometry to determine this shape's extent, reference point and eye distance.
|
protected void |
createNormals()
Create this shape's vertex normals.
|
protected void |
createTexCoords()
Create this shape's texture coordinates.
|
static ColladaMeshShape |
createTriangleMesh(java.util.List<ColladaTriangles> geometries,
ColladaBindMaterial bindMaterial)
Create a triangle mesh shape.
|
protected void |
createVertexCoords(DrawContext dc)
Create the shape's vertex coordinates.
|
protected void |
doDrawInterior(DrawContext dc)
Draws this shape's interior.
|
protected void |
doDrawInteriorVA(DrawContext dc,
ColladaMeshShape.Geometry geometry)
Draw one geometry in the mesh interior using vertex arrays.
|
protected void |
doDrawInteriorVBO(DrawContext dc,
ColladaMeshShape.Geometry geometry,
int[] vboIds)
Draw one geometry in the mesh interior using vertex buffer objects.
|
protected void |
doDrawOrderedRenderable(DrawContext dc,
PickSupport pickCandidates,
Matrix matrix)
Draw the shape as an OrderedRenderable, using the specified transform matrix.
|
protected void |
doDrawOutline(DrawContext dc)
Draws this shape's outline.
|
protected boolean |
doMakeOrderedRenderable(DrawContext dc)
Produces the geometry and other state necessary to represent this shape as an ordered renderable.
|
protected void |
drawBatched(DrawContext dc)
Draws this ordered renderable and all subsequent Path ordered renderables in the ordered renderable list.
|
protected void |
fillVBO(DrawContext dc)
Fill this shape's vertex buffer objects.
|
protected ColladaEffect |
getEffect(ColladaAbstractGeometry geometry)
Indicates the effect applied to a geometry.
|
protected java.lang.String |
getImageRef(ColladaEffect effect,
ColladaTexture texture)
Indicates the reference string for an image.
|
protected ColladaInstanceMaterial |
getInstanceMaterial(ColladaMeshShape.Geometry geometry)
Indicates the instance_material element for a geometry.
|
Box |
getLocalExtent(ColladaTraversalContext tc) |
protected Material |
getMaterial(ColladaMeshShape.Geometry geometry)
Indicates the material applied to a geometry.
|
protected java.lang.String |
getTexCoordSemantic(ColladaMeshShape.Geometry geometry)
Indicates the semantic that identifies texture coordinates.
|
protected WWTexture |
getTexture(ColladaMeshShape.Geometry geometry)
Indicates the texture applied to this shape.
|
protected java.lang.String |
getTextureSource(ColladaAbstractGeometry geometry)
Indicates the source (file path or URL) of the texture applied to a geometry.
|
java.util.List<Intersection> |
intersect(Line line,
Terrain terrain)
Compute the intersections of a specified line with this shape.
|
protected boolean |
isDoubleSided(ColladaAbstractGeometry geometry)
Indicates whether or not a geometry is double sided.
|
protected boolean |
isOrderedRenderableValid(DrawContext dc)
Determines whether this shape's ordered renderable state is valid and can be rendered.
|
protected boolean |
mustApplyTexture(ColladaMeshShape.Geometry geometry)
Indicates whether or not a texture must be applied to a geometry.
|
protected boolean |
mustApplyTexture(DrawContext dc)
Indicates whether texture should be applied to this shape.
|
void |
pick(DrawContext dc,
java.awt.Point pickPoint,
Matrix matrix)
Pick the mesh in a given orientation.
|
void |
render(DrawContext dc,
Matrix matrix)
Render the mesh in a given orientation.
|
void |
setModelPosition(Position modelPosition)
Specifies this shape's geographic position.
|
protected void |
setModelViewMatrix(DrawContext dc)
Called during drawing to set the modelview matrix to apply the correct position, scale and orientation for this
shape.
|
computeEyeDistance, computeReferencePoint, doExportAsKML, getCurrent, getHeading, getModelPosition, getModelScale, getPitch, getReferencePosition, getResourceMap, getRoll, getSector, initialize, moveTo, setHeading, setModelScale, setPitch, setResourceMap, setRoll
checkViewDistanceExpiration, clearCachedVbos, computeExtentFromPositions, computePoint, computePoint, countTriangleVertices, createPickedObject, createSurfaceShape, determineActiveAttributes, doDrag, doDrawOrderedRenderable, doGetRestorableState, doRestoreState, drag, drawInterior, drawOrderedRenderable, drawOutline, endDrawing, export, exportAsKML, getActiveAttributes, getAltitudeMode, getAttributes, getCurrentData, getDelegateOwner, getDistanceFromEye, getExtent, getExtent, getGeometryRegenerationInterval, getHighlightAttributes, getOutlinePickWidth, getReferencePoint, getRestorableState, getVboIds, intersectsFrustum, isDragEnabled, isEnableBatchPicking, isEnableBatchRendering, isEnableDepthOffset, isExportFormatSupported, isHighlighted, isTerrainDependent, isViewDistanceExpiration, isVisible, makeOrderedRenderable, makeTexture, move, moveTo, mustApplyLighting, mustApplyLighting, mustCreateNormals, mustCreateNormals, mustDrawInterior, mustDrawOutline, mustRegenerateGeometry, pick, prepareToDrawInterior, prepareToDrawOutline, preRender, render, reset, restoreState, setAltitudeMode, setAttributes, setDelegateOwner, setDragEnabled, setEnableBatchPicking, setEnableBatchRendering, setEnableDepthOffset, setGeometryRegenerationInterval, setHighlightAttributes, setHighlighted, setOutlinePickWidth, setReferencePosition, setViewDistanceExpiration, setVisible, shouldUseVBOs, updateSurfaceShape
onMessage, propertyChange
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
protected ColladaBindMaterial bindMaterial
protected java.nio.FloatBuffer coordBuffer
protected int elementType
protected java.util.Map<ColladaMeshShape.ExtentCacheKey,Extent> extentCache
protected java.util.List<ColladaMeshShape.Geometry> geometries
protected java.nio.FloatBuffer normalBuffer
coordBuffer
that contains normals.protected int normalBufferPosition
coordBuffer
.protected int shapeCount
protected int texCoordBufferPosition
coordBuffer
.protected java.nio.FloatBuffer textureCoordsBuffer
protected int vertsPerShape
protected ColladaMeshShape(java.util.List<? extends ColladaAbstractGeometry> geometries)
geometries
- Geometries to render. All geometries must be of the same type (either ColladaTriangles
or ColladaLines
.protected void addOrderedRenderable(DrawContext dc)
ColladaMeshShape.OrderedMeshShape
to represent this drawn instance of the mesh in the ordered renderable queue.addOrderedRenderable
in class AbstractShape
dc
- the current draw context.protected void applyMaterial(DrawContext dc, Material material)
dc
- Current draw context.material
- Material to apply.protected OGLStackHandler beginDrawing(DrawContext dc, int attrMask)
AbstractShape
A AbstractShape.AbstractShapeData
must be current when this method is called.
beginDrawing
in class AbstractShape
dc
- the current draw context.attrMask
- an attribute mask indicating state the caller will set. This base class implementation sets
GL_CURRENT_BIT, GL_LINE_BIT, GL_HINT_BIT, GL_POLYGON_BIT, GL_COLOR_BUFFER_BIT, and
GL_TRANSFORM_BIT
.protected Extent computeExtent(DrawContext dc)
dc
- Current draw context.protected double computeEyeDistance(DrawContext dc)
A AbstractShape.AbstractShapeData
must be current when this method is called.
dc
- the current draw context.protected Vec4 computeReferenceCenter(DrawContext dc)
dc
- the current draw context.protected Matrix computeRenderMatrix(DrawContext dc)
dc
- the current draw contextprotected AbstractShape.AbstractShapeData createCacheEntry(DrawContext dc)
createCacheEntry
in class AbstractShape
dc
- the current draw context.protected void createFullGeometry(DrawContext dc)
dc
- Current draw context.public static ColladaMeshShape createLineMesh(java.util.List<ColladaLines> geometries, ColladaBindMaterial bindMaterial)
geometries
- COLLADA elements that defines geometry for this shape. Must contain at least one element.bindMaterial
- Material applied to the mesh. May be null.protected void createMinimalGeometry(DrawContext dc, ColladaMeshShape.ShapeData shapeData)
A AbstractShape.AbstractShapeData
must be current when this method is called.
dc
- the current draw context.shapeData
- the current shape data for this shape.protected void createNormals()
normalBuffer
.protected void createTexCoords()
textureCoordsBuffer
.public static ColladaMeshShape createTriangleMesh(java.util.List<ColladaTriangles> geometries, ColladaBindMaterial bindMaterial)
geometries
- COLLADA elements that defines geometry for this shape. Must contain at least one element.bindMaterial
- Material applied to the mesh. May be null.protected void createVertexCoords(DrawContext dc)
coordBuffer
.dc
- Current draw context.protected void doDrawInterior(DrawContext dc)
AbstractShape.prepareToDrawInterior(DrawContext,
ShapeAttributes, ShapeAttributes)
, which establishes OpenGL state for lighting, blending, pick color and
interior attributes. Subclasses should execute the drawing commands specific to the type of shape.
A AbstractShape.AbstractShapeData
must be current when this method is called.
doDrawInterior
in class AbstractShape
dc
- the current draw context.protected void doDrawInteriorVA(DrawContext dc, ColladaMeshShape.Geometry geometry)
dc
- Current draw context.geometry
- Geometry to draw.protected void doDrawInteriorVBO(DrawContext dc, ColladaMeshShape.Geometry geometry, int[] vboIds)
dc
- Current draw context.geometry
- Geometry to draw.vboIds
- Array of vertex buffer identifiers. The first element of the array identifies the buffer that
contains vertex coordinates and normal vectors.protected void doDrawOrderedRenderable(DrawContext dc, PickSupport pickCandidates, Matrix matrix)
dc
- Current draw context.pickCandidates
- Pick candidates for this frame.matrix
- Transform matrix to apply before trying shape. mprotected void doDrawOutline(DrawContext dc)
AbstractShape.prepareToDrawOutline(DrawContext,
ShapeAttributes, ShapeAttributes)
, which establishes OpenGL state for lighting, blending, pick color and line
attributes. Subclasses should execute the drawing commands specific to the type of shape.
A AbstractShape.AbstractShapeData
must be current when this method is called. Does nothing, all drawing is performed by doDrawInterior(gov.nasa.worldwind.render.DrawContext)
.
doDrawOutline
in class AbstractShape
dc
- the current draw context.protected boolean doMakeOrderedRenderable(DrawContext dc)
AbstractShape.pick(DrawContext, java.awt.Point)
and AbstractShape.render(DrawContext)
when it's been determined that the shape is
likely to be visible.doMakeOrderedRenderable
in class AbstractShape
dc
- the current draw context.AbstractShape.pick(DrawContext, java.awt.Point)
,
AbstractShape.render(DrawContext)
protected void drawBatched(DrawContext dc)
A AbstractShape.AbstractShapeData
must be current when this method is called. Overridden because ColladaMeshShape uses OrderedMeshShape instead of adding itself to the ordered
renderable queue.
drawBatched
in class AbstractShape
dc
- the current draw context.protected void fillVBO(DrawContext dc)
A AbstractShape.AbstractShapeData
must be current when this method is called.
fillVBO
in class AbstractShape
dc
- the current draw context.protected ColladaEffect getEffect(ColladaAbstractGeometry geometry)
geometry
- Geometry for which to find effect.protected java.lang.String getImageRef(ColladaEffect effect, ColladaTexture texture)
effect
- Effect that defines the texture.texture
- Texture for which to find the image reference.protected ColladaInstanceMaterial getInstanceMaterial(ColladaMeshShape.Geometry geometry)
geometry
- Geometry for which to find material.public Box getLocalExtent(ColladaTraversalContext tc)
protected Material getMaterial(ColladaMeshShape.Geometry geometry)
geometry
- Geometry for which to find material.protected java.lang.String getTexCoordSemantic(ColladaMeshShape.Geometry geometry)
geometry
- Geometry for which to find semantic.protected WWTexture getTexture(ColladaMeshShape.Geometry geometry)
geometry
- Geometry to apply.protected java.lang.String getTextureSource(ColladaAbstractGeometry geometry)
geometry
- Geometry for which to find texture source.public java.util.List<Intersection> intersect(Line line, Terrain terrain) throws java.lang.InterruptedException
WorldWind.ABSOLUTE
, the shape's geometry is created relative to the specified terrain rather than the terrain
used during rendering, which may be at lower level of detail than required for accurate intersection
determination.
COLLADA shapes do not support intersection tests because the shape may be rendered multiple times with different transform matrices. It's not possible to determine intersection without the transform matrix applied when the shape is rendered.
intersect
in class AbstractShape
line
- the line to intersect.terrain
- the Terrain
to use when computing the shape's geometry.null
.java.lang.InterruptedException
- if the operation is interrupted.Terrain
protected boolean isDoubleSided(ColladaAbstractGeometry geometry)
geometry
- Geometry to test.protected boolean isOrderedRenderableValid(DrawContext dc)
AbstractShape.makeOrderedRenderable(DrawContext)
just prior to adding the shape to the ordered renderable list.isOrderedRenderableValid
in class AbstractShape
dc
- the current draw context.protected boolean mustApplyTexture(ColladaMeshShape.Geometry geometry)
geometry
- Geometry to test.protected boolean mustApplyTexture(DrawContext dc)
Note: This method always returns false during the pick pass.
mustApplyTexture
in class AbstractShape
dc
- the current draw contextpublic void pick(DrawContext dc, java.awt.Point pickPoint, Matrix matrix)
dc
- Current draw context.pickPoint
- Current pick point.matrix
- Matrix to multiply with the current modelview matrix to orient the mesh.public void render(DrawContext dc, Matrix matrix)
dc
- Current draw context.matrix
- Matrix to be multiply with the current modelview matrix to orient the mesh.public void setModelPosition(Position modelPosition)
setModelPosition
in class AbstractGeneralShape
modelPosition
- this shape's geographic position.protected void setModelViewMatrix(DrawContext dc)
dc
- the current DrawContextjava.lang.IllegalArgumentException
- if draw context is null or the draw context GL is null