Class ColladaMeshShape
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.render.AbstractShape
-
- gov.nasa.worldwind.render.AbstractGeneralShape
-
- gov.nasa.worldwind.ogc.collada.impl.ColladaMeshShape
-
- All Implemented Interfaces:
AVList
,Draggable
,MessageListener
,Exportable
,ExtentHolder
,Movable
,Movable2
,Attributable
,GeographicExtent
,Highlightable
,OrderedRenderable
,PreRenderable
,Renderable
,Restorable
,WWObject
,java.beans.PropertyChangeListener
,java.util.EventListener
public class ColladaMeshShape extends AbstractGeneralShape
Shape to render a COLLADA line or triangle mesh. An instance of this shape can render any number ofColladaLines
orColladaTriangles
, but a single instance cannot render both lines and triangles. New instances are created bycreateTriangleMesh
andcreateLineMesh
.This shape supports only COLLADA line and triangle geometries.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
ColladaMeshShape.ExtentCacheKey
protected static class
ColladaMeshShape.Geometry
Geometry and attributes of a COLLADAtriangles
orlines
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.-
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.AbstractShape
AbstractShape.AbstractShapeData
-
-
Field Summary
Fields Modifier and Type Field 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 thecoordBuffer
that contains normals.protected int
normalBufferPosition
The index of the first normal in thecoordBuffer
.protected int
shapeCount
Total number of shapes (lines or triangles) in this mesh.protected int
texCoordBufferPosition
The index of the first texture coordinate in thecoordBuffer
.protected java.nio.FloatBuffer
textureCoordsBuffer
Texture coordinates for all geometries in this shape.protected int
vertsPerShape
Number of vertices per shape.-
Fields inherited from class gov.nasa.worldwind.render.AbstractGeneralShape
heading, modelPosition, modelScale, pitch, resourceMap, roll
-
Fields inherited from class gov.nasa.worldwind.render.AbstractShape
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
-
Fields inherited from interface gov.nasa.worldwind.Exportable
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ColladaMeshShape(java.util.List<? extends ColladaAbstractGeometry> geometries)
Create an instance of the shape.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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.-
Methods inherited from class gov.nasa.worldwind.render.AbstractGeneralShape
computeEyeDistance, computeReferencePoint, doExportAsKML, getCurrent, getHeading, getModelPosition, getModelScale, getPitch, getReferencePosition, getResourceMap, getRoll, getSector, initialize, moveTo, setHeading, setModelScale, setPitch, setResourceMap, setRoll
-
Methods inherited from class gov.nasa.worldwind.render.AbstractShape
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
-
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage, propertyChange
-
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
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
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
-
-
-
-
Field Detail
-
elementType
protected int elementType
OpenGL element type for this shape (GL.GL_LINES or GL.GL_TRIANGLES).
-
vertsPerShape
protected int vertsPerShape
Number of vertices per shape. Two in the case of a line mesh, three in the case of a triangle mesh.
-
shapeCount
protected int shapeCount
Total number of shapes (lines or triangles) in this mesh. Equal to the sum of the shapes in each geometry.
-
bindMaterial
protected ColladaBindMaterial bindMaterial
Material applied to this mesh.
-
geometries
protected java.util.List<ColladaMeshShape.Geometry> geometries
Geometry objects that describe different parts of the mesh.
-
extentCache
protected java.util.Map<ColladaMeshShape.ExtentCacheKey,Extent> extentCache
Cache of shape extents computed for different transform matrices.
-
coordBuffer
protected java.nio.FloatBuffer coordBuffer
The vertex data buffer for this shape data. The first part contains vertex coordinates, the second part contains normals, and the third part contains texture coordinates.
-
normalBuffer
protected java.nio.FloatBuffer normalBuffer
The slice of thecoordBuffer
that contains normals.
-
normalBufferPosition
protected int normalBufferPosition
The index of the first normal in thecoordBuffer
.
-
textureCoordsBuffer
protected java.nio.FloatBuffer textureCoordsBuffer
Texture coordinates for all geometries in this shape.
-
texCoordBufferPosition
protected int texCoordBufferPosition
The index of the first texture coordinate in thecoordBuffer
.
-
-
Constructor Detail
-
ColladaMeshShape
protected ColladaMeshShape(java.util.List<? extends ColladaAbstractGeometry> geometries)
Create an instance of the shape.- Parameters:
geometries
- Geometries to render. All geometries must be of the same type (eitherColladaTriangles
orColladaLines
.
-
-
Method Detail
-
createTriangleMesh
public static ColladaMeshShape createTriangleMesh(java.util.List<ColladaTriangles> geometries, ColladaBindMaterial bindMaterial)
Create a triangle mesh shape.- Parameters:
geometries
- COLLADA elements that defines geometry for this shape. Must contain at least one element.bindMaterial
- Material applied to the mesh. May be null.- Returns:
- The resulting shape.
-
createLineMesh
public static ColladaMeshShape createLineMesh(java.util.List<ColladaLines> geometries, ColladaBindMaterial bindMaterial)
Create a line mesh shape.- Parameters:
geometries
- COLLADA elements that defines geometry for this shape. Must contain at least one element.bindMaterial
- Material applied to the mesh. May be null.- Returns:
- The resulting shape.
-
intersect
public java.util.List<Intersection> intersect(Line line, Terrain terrain) throws java.lang.InterruptedException
Compute the intersections of a specified line with this shape. If the shape's altitude mode is other thanWorldWind.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.
- Specified by:
intersect
in classAbstractShape
- Parameters:
line
- the line to intersect.terrain
- theTerrain
to use when computing the shape's geometry.- Returns:
- Always returns
null
. - Throws:
java.lang.InterruptedException
- if the operation is interrupted.- See Also:
Terrain
-
setModelPosition
public void setModelPosition(Position modelPosition)
Specifies this shape's geographic position. The position's altitude is relative to this shape's altitude mode. Overridden to invalidate cached geometry when the model position is changed.- Overrides:
setModelPosition
in classAbstractGeneralShape
- Parameters:
modelPosition
- this shape's geographic position.
-
beginDrawing
protected OGLStackHandler beginDrawing(DrawContext dc, int attrMask)
Description copied from class:AbstractShape
Establish the OpenGL state needed to draw this shape.A
AbstractShape.AbstractShapeData
must be current when this method is called.- Overrides:
beginDrawing
in classAbstractShape
- Parameters:
dc
- the current draw context.attrMask
- an attribute mask indicating state the caller will set. This base class implementation setsGL_CURRENT_BIT, GL_LINE_BIT, GL_HINT_BIT, GL_POLYGON_BIT, GL_COLOR_BUFFER_BIT, and GL_TRANSFORM_BIT
.- Returns:
- the stack handler used to set the OpenGL state. Callers should use this to set additional state, especially state indicated in the attribute mask argument.
-
render
public void render(DrawContext dc, Matrix matrix)
Render the mesh in a given orientation.- Parameters:
dc
- Current draw context.matrix
- Matrix to be multiply with the current modelview matrix to orient the mesh.
-
pick
public void pick(DrawContext dc, java.awt.Point pickPoint, Matrix matrix)
Pick the mesh in a given orientation.- Parameters:
dc
- Current draw context.pickPoint
- Current pick point.matrix
- Matrix to multiply with the current modelview matrix to orient the mesh.
-
drawBatched
protected void drawBatched(DrawContext dc)
Draws this ordered renderable and all subsequent Path ordered renderables in the ordered renderable list. If the current pick mode is true, only shapes within the same layer are drawn as a batch.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.- Overrides:
drawBatched
in classAbstractShape
- Parameters:
dc
- the current draw context.
-
doMakeOrderedRenderable
protected boolean doMakeOrderedRenderable(DrawContext dc)
Produces the geometry and other state necessary to represent this shape as an ordered renderable. Places this shape on the draw context's ordered renderable list for subsequent rendering. This method is called duringAbstractShape.pick(DrawContext, java.awt.Point)
andAbstractShape.render(DrawContext)
when it's been determined that the shape is likely to be visible.- Specified by:
doMakeOrderedRenderable
in classAbstractShape
- Parameters:
dc
- the current draw context.- Returns:
- true if the ordered renderable state was successfully computed, otherwise false, in which case the current pick or render pass is terminated for this shape. Subclasses should return false if it is not possible to create the ordered renderable state.
- See Also:
AbstractShape.pick(DrawContext, java.awt.Point)
,AbstractShape.render(DrawContext)
-
addOrderedRenderable
protected void addOrderedRenderable(DrawContext dc)
Adds this shape to the draw context's ordered renderable list. Overridden because this shape usesColladaMeshShape.OrderedMeshShape
to represent this drawn instance of the mesh in the ordered renderable queue.- Overrides:
addOrderedRenderable
in classAbstractShape
- Parameters:
dc
- the current draw context.
-
doDrawOrderedRenderable
protected void doDrawOrderedRenderable(DrawContext dc, PickSupport pickCandidates, Matrix matrix)
Draw the shape as an OrderedRenderable, using the specified transform matrix.- Parameters:
dc
- Current draw context.pickCandidates
- Pick candidates for this frame.matrix
- Transform matrix to apply before trying shape. m
-
doDrawOutline
protected void doDrawOutline(DrawContext dc)
Draws this shape's outline. Called immediately after callingAbstractShape.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 bydoDrawInterior(gov.nasa.worldwind.render.DrawContext)
.- Specified by:
doDrawOutline
in classAbstractShape
- Parameters:
dc
- the current draw context.
-
doDrawInterior
protected void doDrawInterior(DrawContext dc)
Draws this shape's interior. Called immediately after callingAbstractShape.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.- Specified by:
doDrawInterior
in classAbstractShape
- Parameters:
dc
- the current draw context.
-
doDrawInteriorVA
protected void doDrawInteriorVA(DrawContext dc, ColladaMeshShape.Geometry geometry)
Draw one geometry in the mesh interior using vertex arrays.- Parameters:
dc
- Current draw context.geometry
- Geometry to draw.
-
doDrawInteriorVBO
protected void doDrawInteriorVBO(DrawContext dc, ColladaMeshShape.Geometry geometry, int[] vboIds)
Draw one geometry in the mesh interior using vertex buffer objects.- Parameters:
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.
-
setModelViewMatrix
protected void setModelViewMatrix(DrawContext dc)
Called during drawing to set the modelview matrix to apply the correct position, scale and orientation for this shape.- Parameters:
dc
- the current DrawContext- Throws:
java.lang.IllegalArgumentException
- if draw context is null or the draw context GL is null
-
isOrderedRenderableValid
protected boolean isOrderedRenderableValid(DrawContext dc)
Determines whether this shape's ordered renderable state is valid and can be rendered. Called byAbstractShape.makeOrderedRenderable(DrawContext)
just prior to adding the shape to the ordered renderable list.- Specified by:
isOrderedRenderableValid
in classAbstractShape
- Parameters:
dc
- the current draw context.- Returns:
- true if this shape is ready to be rendered as an ordered renderable.
-
createCacheEntry
protected AbstractShape.AbstractShapeData createCacheEntry(DrawContext dc)
Creates and returns a new cache entry specific to the subclass.- Specified by:
createCacheEntry
in classAbstractShape
- Parameters:
dc
- the current draw context.- Returns:
- a data cache entry for the state in the specified draw context.
-
createMinimalGeometry
protected void createMinimalGeometry(DrawContext dc, ColladaMeshShape.ShapeData shapeData)
Compute enough geometry to determine this shape's extent, reference point and eye distance.A
AbstractShape.AbstractShapeData
must be current when this method is called.- Parameters:
dc
- the current draw context.shapeData
- the current shape data for this shape.
-
createFullGeometry
protected void createFullGeometry(DrawContext dc)
Create full geometry for the shape, including normals and texture coordinates.- Parameters:
dc
- Current draw context.
-
computeExtent
protected Extent computeExtent(DrawContext dc)
Compute the shape's extent, using the active orientation matrix.- Parameters:
dc
- Current draw context.- Returns:
- The spatial extent of the shape, or null if the extent cannot be determined.
-
getLocalExtent
public Box getLocalExtent(ColladaTraversalContext tc)
-
createVertexCoords
protected void createVertexCoords(DrawContext dc)
Create the shape's vertex coordinates. The coordinates are stored incoordBuffer
.- Parameters:
dc
- Current draw context.
-
createNormals
protected void createNormals()
Create this shape's vertex normals. The normals are stored innormalBuffer
.
-
createTexCoords
protected void createTexCoords()
Create this shape's texture coordinates. The texture coordinates are stored intextureCoordsBuffer
.
-
fillVBO
protected void fillVBO(DrawContext dc)
Fill this shape's vertex buffer objects. If the vertex buffer object resource IDs don't yet exist, create them.A
AbstractShape.AbstractShapeData
must be current when this method is called.- Specified by:
fillVBO
in classAbstractShape
- Parameters:
dc
- the current draw context.
-
computeReferenceCenter
protected Vec4 computeReferenceCenter(DrawContext dc)
Computes this shape's reference center.- Parameters:
dc
- the current draw context.- Returns:
- the computed reference center, or null if it cannot be computed.
-
computeEyeDistance
protected double computeEyeDistance(DrawContext dc)
Computes the minimum distance between this shape and the eye point.A
AbstractShape.AbstractShapeData
must be current when this method is called.- Parameters:
dc
- the current draw context.- Returns:
- the minimum distance from the shape to the eye point.
-
computeRenderMatrix
protected Matrix computeRenderMatrix(DrawContext dc)
Computes the transform to use during rendering to orient the model.- Parameters:
dc
- the current draw context- Returns:
- the modelview transform for this shape.
-
mustApplyTexture
protected boolean mustApplyTexture(DrawContext dc)
Indicates whether texture should be applied to this shape. Called during rendering to determine whether texture state should be established during preparation for interior drawing.Note: This method always returns false during the pick pass.
- Specified by:
mustApplyTexture
in classAbstractShape
- Parameters:
dc
- the current draw context- Returns:
- True if any geometry in this shape includes a texture.
-
mustApplyTexture
protected boolean mustApplyTexture(ColladaMeshShape.Geometry geometry)
Indicates whether or not a texture must be applied to a geometry.- Parameters:
geometry
- Geometry to test.- Returns:
- True if the specified geometry includes a texture.
-
getTexture
protected WWTexture getTexture(ColladaMeshShape.Geometry geometry)
Indicates the texture applied to this shape.- Parameters:
geometry
- The geometry to set the texture from.- Returns:
- The texture that must be applied to the shape, or null if there is no texture, or the texture is not available.
-
applyMaterial
protected void applyMaterial(DrawContext dc, Material material)
Apply a material to the active draw context.- Parameters:
dc
- Current draw context.material
- Material to apply.
-
getMaterial
protected Material getMaterial(ColladaMeshShape.Geometry geometry)
Indicates the material applied to a geometry.- Parameters:
geometry
- Geometry for which to find material.- Returns:
- Material to apply to the geometry. If the COLLADA document does not define a material, this method return a default material.
-
getInstanceMaterial
protected ColladaInstanceMaterial getInstanceMaterial(ColladaMeshShape.Geometry geometry)
Indicates the instance_material element for a geometry.- Parameters:
geometry
- Geometry for which to find material.- Returns:
- Material for the specified geometry, or null if the material cannot be resolved.
-
getTexCoordSemantic
protected java.lang.String getTexCoordSemantic(ColladaMeshShape.Geometry geometry)
Indicates the semantic that identifies texture coordinates. This may be specified for each material using a bind_vertex_input element.- Parameters:
geometry
- Geometry for which to find semantic.- Returns:
- The semantic string that identifies the texture coordinates, or null if the geometry does not define the semantic.
-
getTextureSource
protected java.lang.String getTextureSource(ColladaAbstractGeometry geometry)
Indicates the source (file path or URL) of the texture applied to a geometry.- Parameters:
geometry
- Geometry for which to find texture source.- Returns:
- The source of the texture, or null if it cannot be resolved.
-
getImageRef
protected java.lang.String getImageRef(ColladaEffect effect, ColladaTexture texture)
Indicates the reference string for an image. The image reference identifies an image element in this, or another COLLADA file. For example, "#myImage".- Parameters:
effect
- Effect that defines the texture.texture
- Texture for which to find the image reference.- Returns:
- The image reference, or null if it cannot be resolved.
-
getEffect
protected ColladaEffect getEffect(ColladaAbstractGeometry geometry)
Indicates the effect applied to a geometry.- Parameters:
geometry
- Geometry for which to find effect.- Returns:
- Effect applied to the specified geometry, or null if no effect is defined, or the effect is not available.
-
isDoubleSided
protected boolean isDoubleSided(ColladaAbstractGeometry geometry)
Indicates whether or not a geometry is double sided. A geometry is double sided if its effect element contains a technique for the profile "GOOGLEEARTH", and the technique includes a double_sided field. The double_sided field is not part of the COLLADA specification, but many COLLADA models packaged in KML include the element.- Parameters:
geometry
- Geometry to test.- Returns:
- True if the geometry is marked as double sided. Otherwise false.
-
-