Class OGLElevationGrid
java.lang.Object
org.web3d.vrml.renderer.common.nodes.AbstractNode
org.web3d.vrml.renderer.common.nodes.geom3d.BaseElevationGrid
org.web3d.vrml.renderer.ogl.nodes.geom3d.OGLElevationGrid
- All Implemented Interfaces:
org.j3d.aviatrix3d.NodeUpdateListener
,VRMLNode
,FrameStateListener
,VRMLComponentGeometryNodeType
,VRMLGeometryNodeType
,VRMLNodeType
,OGLGeometryNodeType
,OGLVRMLNode
public class OGLElevationGrid
extends BaseElevationGrid
implements OGLGeometryNodeType, org.j3d.aviatrix3d.NodeUpdateListener
OpenGL implementation of an ElevationGrid
In order to handle colorPerVertex=FALSE and normalPerVertex=FALSE we have to two representations. Under normal conditions(TRUE,TRUE) we can use TriStrips. Otherwise we must revert back to Quads to get the right coloring. Issues: If you specify normalPerVertex = FALSE but colorPerVertex = TRUE then the colorInterpolation is different then Cosmo/Cortona. Is it wrong, hard to say. CreaseAngle is not supported. All terrains are smooth shaded. Not sure ccw handling is correct. TODO: Needed Observers: color, normal, texCoord
- Version:
- $Revision: 1.14 $
- Author:
- Alan Hudson
-
Field Summary
Fields inherited from class org.web3d.vrml.renderer.common.nodes.geom3d.BaseElevationGrid
FIELD_CCW, FIELD_COLOR, FIELD_COLORPERVERTEX, FIELD_CREASEANGLE, FIELD_HEIGHT, FIELD_NORMAL, FIELD_NORMALPERVERTEX, FIELD_SET_HEIGHT, FIELD_SOLID, FIELD_TEXCOORD, FIELD_XDIMENSION, FIELD_XSPACING, FIELD_ZDIMENSION, FIELD_ZSPACING, heightLen, LAST_ELEVATIONGRID_INDEX, localColors, localColorsListeners, pColor, pNormal, pTexCoord, vfCcw, vfColor, vfColorPerVertex, vfCreaseAngle, vfHeight, vfNormal, vfNormalPerVertex, vfSolid, vfTexCoord, vfXDimension, vfXSpacing, vfZDimension, vfZSpacing
Fields inherited from class org.web3d.vrml.renderer.common.nodes.AbstractNode
errorReporter, FIELD_METADATA, fieldLocalData, hasChanged, inSetup, isDEF, isStatic, LAST_NODE_INDEX, layerIds, nodeName, pMetadata, refCounts, removedLayerIds, stateManager, STATIC_SCENE_GRAPH, vfMetadata, vrmlMajorVersion, vrmlMinorVersion
-
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructorOGLElevationGrid
(VRMLNodeType node) Construct a new instance of this node based on the details from the given node. -
Method Summary
Modifier and TypeMethodDescriptionorg.j3d.aviatrix3d.Geometry
Returns a OGL Geometry node that represents this piece of geometry.org.j3d.aviatrix3d.SceneGraphObject
Get the Java3D scene graph object representation of this node.void
setComponent
(VRMLNodeType comp) Set a component that composes part of a geometry object.void
setComponents
(VRMLNodeType[] comps) Set the components that compose a geometry object.protected void
setHeight
(float[] value, int numValid) Set the height field.void
setTextureCount
(int count) Set the number of textures that were found on the accompanying Appearance node.void
Notification that the construction phase of this node has finished.void
setValue
(int index, VRMLNodeType child) Set the value of the field at the given index as a node.void
Notification that its safe to update the node now with any operations that could potentially effect the node's bounds.void
Notification that its safe to update the node now with any operations that only change the node's properties, but do not change the bounds.Methods inherited from class org.web3d.vrml.renderer.common.nodes.geom3d.BaseElevationGrid
addLocalColorsListener, addTexCoordGenModeChanged, fireLocalColorsChanged, getComponents, getFieldDeclaration, getFieldIndex, getFieldValue, getNodeFieldIndices, getNumFields, getNumSets, getPrimaryType, getTexCoordGenMode, hasColorPerVertex, hasLocalColorAlpha, hasLocalColors, hasNormalPerVertex, isCCW, isLightingEnabled, isSolid, removeLocalColorsListener, removeTexCoordGenModeChanged, requiresUnlitColor, sendRoute, setUnlitColor, setValue, setValue, setValue, setValue
Methods inherited from class org.web3d.vrml.renderer.common.nodes.AbstractNode
addNodeListener, allEventsComplete, checkNodeType, checkSecondaryType, checkSecondaryType, clearRemovedLayerIds, fireFieldChanged, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, getSecondaryType, getUserData, getVRMLNodeName, hasFieldChanged, isDEF, isSetupFinished, notifyExternProtoLoaded, removeNodeListener, setDEF, setErrorReporter, setFrameStateManager, setMetadataObject, setUserData, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setVersion, throwInitOnlyWriteException, throwInputOnlyWriteException, throwInvalidNodeException, throwInvalidProtoException, throwOutputOnlyWriteException, updateRefCount, updateRefs
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.web3d.vrml.nodes.FrameStateListener
allEventsComplete
Methods inherited from interface org.web3d.vrml.nodes.VRMLGeometryNodeType
addLocalColorsListener, addTexCoordGenModeChanged, getNumSets, getTexCoordGenMode, hasLocalColorAlpha, hasLocalColors, isCCW, isLightingEnabled, isSolid, removeLocalColorsListener, removeTexCoordGenModeChanged
Methods inherited from interface org.web3d.vrml.lang.VRMLNode
getFieldDeclaration, getFieldIndex, getNodeFieldIndices, getNumFields, getPrimaryType, getSecondaryType, getUserData, getVRMLNodeName, isDEF, setErrorReporter, setUserData, setVersion
Methods inherited from interface org.web3d.vrml.nodes.VRMLNodeType
addNodeListener, clearRemovedLayerIds, getFieldValue, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, hasFieldChanged, isSetupFinished, notifyExternProtoLoaded, removeNodeListener, sendRoute, setDEF, setFrameStateManager, setMetadataObject, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, updateRefCount
-
Constructor Details
-
OGLElevationGrid
public OGLElevationGrid()Empty constructor -
OGLElevationGrid
Construct a new instance of this node based on the details from the given node. If the node is not the same type, an exception will be thrown.- Parameters:
node
- The node to copy- Throws:
IllegalArgumentException
- Incorrect Node Type
-
-
Method Details
-
getGeometry
public org.j3d.aviatrix3d.Geometry getGeometry()Description copied from interface:OGLGeometryNodeType
Returns a OGL Geometry node that represents this piece of geometry. If no geometry is available, then return null.- Specified by:
getGeometry
in interfaceOGLGeometryNodeType
- Returns:
- The geometry needed to represent this object
-
setTextureCount
public void setTextureCount(int count) Set the number of textures that were found on the accompanying Appearance node. Used to set the number of texture coordinates that need to be passed in to the renderer when no explicit texture coordinates were given.- Specified by:
setTextureCount
in interfaceVRMLGeometryNodeType
- Overrides:
setTextureCount
in classBaseElevationGrid
- Parameters:
count
- The number of texture coordinate sets to add
-
getSceneGraphObject
public org.j3d.aviatrix3d.SceneGraphObject getSceneGraphObject()Get the Java3D scene graph object representation of this node. This will need to be cast to the appropriate parent type when being used.- Specified by:
getSceneGraphObject
in interfaceOGLVRMLNode
- Returns:
- The OGL representation.
-
setupFinished
public void setupFinished()Notification that the construction phase of this node has finished. If the node would like to do any internal processing, such as setting up geometry, then go for it now.- Specified by:
setupFinished
in interfaceVRMLNodeType
- Overrides:
setupFinished
in classBaseElevationGrid
-
setValue
public void setValue(int index, VRMLNodeType child) throws InvalidFieldException, InvalidFieldValueException Set the value of the field at the given index as a node. This would be used to set SFNode field types.- Specified by:
setValue
in interfaceVRMLNodeType
- Overrides:
setValue
in classBaseElevationGrid
- Parameters:
index
- The index of destination field to setchild
- The new value to use for the node- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The node does not match the required type.
-
setComponents
Set the components that compose a geometry object.- Specified by:
setComponents
in interfaceVRMLComponentGeometryNodeType
- Overrides:
setComponents
in classBaseElevationGrid
- Parameters:
comps
- An array of geometric properties- Throws:
InvalidFieldValueException
- The node does not match the required type.
-
setComponent
Set a component that composes part of a geometry object.- Specified by:
setComponent
in interfaceVRMLComponentGeometryNodeType
- Overrides:
setComponent
in classBaseElevationGrid
- Parameters:
comp
- A geometric property- Throws:
InvalidFieldValueException
- The node does not match the required type.
-
updateNodeBoundsChanges
Notification that its safe to update the node now with any operations that could potentially effect the node's bounds.- Specified by:
updateNodeBoundsChanges
in interfaceorg.j3d.aviatrix3d.NodeUpdateListener
- Parameters:
src
- The node or Node Component that is to be updated.
-
updateNodeDataChanges
Notification that its safe to update the node now with any operations that only change the node's properties, but do not change the bounds.- Specified by:
updateNodeDataChanges
in interfaceorg.j3d.aviatrix3d.NodeUpdateListener
- Parameters:
src
- The node or Node Component that is to be updated.
-
setHeight
protected void setHeight(float[] value, int numValid) Set the height field.- Overrides:
setHeight
in classBaseElevationGrid
- Parameters:
value
- The new valuenumValid
- The number of valid entries
-