Xj3D 2.0 VRML/X3D Code API

org.web3d.vrml.renderer.common.nodes
Class BaseIndexedTriangleGeometryNode

java.lang.Object
  extended by org.web3d.vrml.renderer.common.nodes.AbstractNode
      extended by org.web3d.vrml.renderer.common.nodes.BaseComponentGeometryNode
          extended by org.web3d.vrml.renderer.common.nodes.BaseIndexedTriangleGeometryNode
All Implemented Interfaces:
VRMLNode, FrameStateListener, VRMLComponentGeometryNodeType, VRMLGeometryNodeType, VRMLNodeComponentListener, VRMLNodeType

public abstract class BaseIndexedTriangleGeometryNode
extends BaseComponentGeometryNode

An abstract implementation of the IndexedTriangle* nodes.

Version:
$Revision: 1.9 $
Author:
Justin Couch

Field Summary
protected static java.lang.String COLOR_NODE_MSG
          Message for when the node in setValue() is not a Color
protected static java.lang.String COLOR_PROTO_MSG
          Message for when the proto is not a Color
protected static java.lang.String COORD_NODE_MSG
          Message for when the node in setValue() is not a Coord
protected static java.lang.String COORD_PROTO_MSG
          Message for when the proto is not a Coord
protected static int FIELD_INDEX
          Index of the index MFInt32 field
protected static int FIELD_SET_INDEX
          Index of the set_colorIndex MFInt32 eventIn
protected  org.j3d.geom.GeometryData geomData
          Userdata kept in the triangle geometry
protected static int LAST_INDEXEDTRIANGLEGEOMETRY_INDEX
          The last field index used by this class
protected static java.lang.String NORMAL_NODE_MSG
          Message for when the node in setValue() is not a Normal
protected static java.lang.String NORMAL_PROTO_MSG
          Message for when the proto is not a Normal
protected  int numIndex
          Number of valid values in vfIndex
protected static java.lang.String TEXCOORD_NODE_MSG
          Message for when the node in setValue() is not a TexCoord
protected static java.lang.String TEXCOORD_PROTO_MSG
          Message for when the proto is not a TexCoord
protected  int[] vfIndex
          field MFInt32 index
 
Fields inherited from class org.web3d.vrml.renderer.common.nodes.BaseComponentGeometryNode
ATTRIB_CHANGED, ATTRIB_INDEX_CHANGED, ATTRIB_NODE_MSG, ATTRIB_PROTO_MSG, BAD_NODE_MSG, BAD_PROTO_MSG, changeFlags, COLORS_CHANGED, COLORS_INDEX_CHANGED, COORDS_CHANGED, COORDS_INDEX_CHANGED, FIELD_ATTRIBS, FIELD_CCW, FIELD_COLOR, FIELD_COLORPERVERTEX, FIELD_COORD, FIELD_FOG_COORD, FIELD_NORMAL, FIELD_NORMALPERVERTEX, FIELD_SOLID, FIELD_TEXCOORD, FOG_CHANGED, FOG_INDEX_CHANGED, FOG_NODE_MSG, FOG_PROTO_MSG, LAST_GEOMETRY_INDEX, localColors, localColorsListeners, NORMALS_CHANGED, NORMALS_INDEX_CHANGED, pColor, pCoord, pFogCoord, pNormal, pTexCoord, TEXCOORDS_CHANGED, TEXCOORDS_INDEX_CHANGED, UNLIT_COLORS_CHANGED, VBO_MIN_VERTICES, vfAttribs, vfCcw, vfColor, vfColorPerVertex, vfCoord, vfFogCoord, vfNormal, vfNormalPerVertex, vfSolid, vfTexCoord
 
Fields inherited from class org.web3d.vrml.renderer.common.nodes.AbstractNode
errorReporter, FIELD_METADATA, fieldLocalData, hasChanged, INIT_ONLY_WRITE_MSG, inSetup, isDEF, isStatic, LAST_NODE_INDEX, layerIds, METADATA_NODE_MSG, METADATA_PROTO_MSG, nodeName, pMetadata, refCounts, removedLayerIds, stateManager, vfMetadata, vrmlMajorVersion, vrmlMinorVersion
 
Constructor Summary
protected BaseIndexedTriangleGeometryNode(java.lang.String name)
          Construct a default instance of this class with the bind flag set to false and no time information set (effective value of zero).
 
Method Summary
 void allEventsComplete()
          Notification that the rendering of the event model is complete and that rendering is about to begin.
protected abstract  void buildImpl()
          Build the render specific implementation.
protected  void copy(VRMLComponentGeometryNodeType node)
          Set the fields of the binadble node that has the fields set based on the fields of the passed in node.
 void fieldChanged(VRMLNodeType node, int index)
          Notification that the field from the node has changed.
 VRMLFieldData getFieldValue(int index)
          Get the value of a field.
 void notifyExternProtoLoaded(int index, VRMLNodeType node)
          Notify a node that an ExternProto has resolved.
 void sendRoute(double time, int srcIndex, VRMLNodeType destNode, int destIndex)
          Send a routed value from this node to the given destination node.
protected  void setColorNode(VRMLColorNodeType node)
          Notification of the color node being set.
protected  void setCoordinateNode(VRMLCoordinateNodeType node)
          Notification of the coordinate node being set.
protected  void setIndex(int[] value, int numValid)
          Set the index field.
protected  void setNormalNode(VRMLNormalNodeType node)
          Notification of the color node being set.
protected  void setTextureCoordinateNode(VRMLTextureCoordinateNodeType node)
          Notification of the coordinate node being set.
 void setupFinished()
          Notification that the construction phase of this node has finished.
 void setValue(int index, int[] value, int numValid)
          Set the value of the field at the given index as an array of integers.
 void setValue(int index, VRMLNodeType child)
          Set the value of the field at the given index as a node.
protected  void updateColorArray()
          Update the normal array in geomData based on the normal node and normalPerVertex flag.
protected  void updateCoordinateArray()
          Update the coordinate array in geomData based on the coordinate data.
protected  void updateNormalArray()
          Update the normal array in geomData based on the normal node and normalPerVertex flag.
 
Methods inherited from class org.web3d.vrml.renderer.common.nodes.BaseComponentGeometryNode
addLocalColorsListener, addTexCoordGenModeChanged, fireLocalColorsChanged, getComponents, getNumSets, getPrimaryType, getTexCoordGenMode, hasColorPerVertex, hasLocalColorAlpha, hasLocalColors, hasNormalPerVertex, isCCW, isLightingEnabled, isSolid, removeLocalColorsListener, removeTexCoordGenModeChanged, requiresUnlitColor, setComponent, setComponents, setFogCoordinateNode, setTexCoordNode, setUnlitColor, setValue
 
Methods inherited from class org.web3d.vrml.renderer.common.nodes.AbstractNode
addNodeListener, checkNodeType, checkSecondaryType, checkSecondaryType, clearRemovedLayerIds, fireFieldChanged, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, getSecondaryType, getUserData, getVRMLNodeName, hasFieldChanged, isDEF, isSetupFinished, removeNodeListener, setDEF, setErrorReporter, setFrameStateManager, setMetadataObject, setUserData, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setVersion, 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.VRMLNodeType
addNodeListener, clearRemovedLayerIds, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, hasFieldChanged, isSetupFinished, removeNodeListener, setDEF, setFrameStateManager, setMetadataObject, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, updateRefCount
 
Methods inherited from interface org.web3d.vrml.lang.VRMLNode
getFieldDeclaration, getFieldIndex, getNodeFieldIndices, getNumFields, getSecondaryType, getUserData, getVRMLNodeName, isDEF, setErrorReporter, setUserData, setVersion
 

Field Detail

FIELD_INDEX

protected static final int FIELD_INDEX
Index of the index MFInt32 field

See Also:
Constant Field Values

FIELD_SET_INDEX

protected static final int FIELD_SET_INDEX
Index of the set_colorIndex MFInt32 eventIn

See Also:
Constant Field Values

LAST_INDEXEDTRIANGLEGEOMETRY_INDEX

protected static final int LAST_INDEXEDTRIANGLEGEOMETRY_INDEX
The last field index used by this class

See Also:
Constant Field Values

COORD_PROTO_MSG

protected static final java.lang.String COORD_PROTO_MSG
Message for when the proto is not a Coord

See Also:
Constant Field Values

COORD_NODE_MSG

protected static final java.lang.String COORD_NODE_MSG
Message for when the node in setValue() is not a Coord

See Also:
Constant Field Values

COLOR_PROTO_MSG

protected static final java.lang.String COLOR_PROTO_MSG
Message for when the proto is not a Color

See Also:
Constant Field Values

COLOR_NODE_MSG

protected static final java.lang.String COLOR_NODE_MSG
Message for when the node in setValue() is not a Color

See Also:
Constant Field Values

NORMAL_PROTO_MSG

protected static final java.lang.String NORMAL_PROTO_MSG
Message for when the proto is not a Normal

See Also:
Constant Field Values

NORMAL_NODE_MSG

protected static final java.lang.String NORMAL_NODE_MSG
Message for when the node in setValue() is not a Normal

See Also:
Constant Field Values

TEXCOORD_PROTO_MSG

protected static final java.lang.String TEXCOORD_PROTO_MSG
Message for when the proto is not a TexCoord

See Also:
Constant Field Values

TEXCOORD_NODE_MSG

protected static final java.lang.String TEXCOORD_NODE_MSG
Message for when the node in setValue() is not a TexCoord

See Also:
Constant Field Values

vfIndex

protected int[] vfIndex
field MFInt32 index


numIndex

protected int numIndex
Number of valid values in vfIndex


geomData

protected org.j3d.geom.GeometryData geomData
Userdata kept in the triangle geometry

Constructor Detail

BaseIndexedTriangleGeometryNode

protected BaseIndexedTriangleGeometryNode(java.lang.String name)
Construct a default instance of this class with the bind flag set to false and no time information set (effective value of zero).

Parameters:
name - The name of the type of node
Method Detail

copy

protected void copy(VRMLComponentGeometryNodeType node)
Set the fields of the binadble node that has the fields set based on the fields of the passed in node. This directly copies the bind state, so could cause some interesting problems. Not sure what we should do with this currently.

Overrides:
copy in class BaseComponentGeometryNode
Parameters:
node - The bindable node to copy info from

buildImpl

protected abstract void buildImpl()
Build the render specific implementation.


allEventsComplete

public void allEventsComplete()
Notification that the rendering of the event model is complete and that rendering is about to begin. Used to update the transformation matrix only once per frame. If the derived class needs to propogate the changes then it should override the updateMatrix() method or this and make sure this method is called first.

Specified by:
allEventsComplete in interface FrameStateListener
Overrides:
allEventsComplete in class AbstractNode

getFieldValue

public VRMLFieldData getFieldValue(int index)
                            throws InvalidFieldException
Get the value of a field. If the field is a primitive type, it will return a class representing the value. For arrays or nodes it will return the instance directly.

Specified by:
getFieldValue in interface VRMLNodeType
Overrides:
getFieldValue in class BaseComponentGeometryNode
Parameters:
index - The index of the field to change.
Returns:
The class representing the field value
Throws:
InvalidFieldException - The field index is not known

sendRoute

public void sendRoute(double time,
                      int srcIndex,
                      VRMLNodeType destNode,
                      int destIndex)
Send a routed value from this node to the given destination node. The route should use the appropriate setValue() method of the destination node. It should not attempt to cast the node up to a higher level. Routing should also follow the standard rules for the loop breaking and other appropriate rules for the specification.

Specified by:
sendRoute in interface VRMLNodeType
Overrides:
sendRoute in class BaseComponentGeometryNode
Parameters:
time - The time that this route occurred (not necessarily epoch time. Should be treated as a relative value only)
srcIndex - The index of the field in this node that the value should be sent from
destNode - The node reference that we will be sending the value to
destIndex - The index of the field in the destination node that the value should be sent to.

setValue

public void setValue(int index,
                     int[] value,
                     int numValid)
              throws InvalidFieldException,
                     InvalidFieldValueException,
                     InvalidFieldAccessException
Set the value of the field at the given index as an array of integers. This would be used to set MFInt32 field types.

Specified by:
setValue in interface VRMLNodeType
Overrides:
setValue in class AbstractNode
Parameters:
index - The index of destination field to set
value - The new value to use for the node
numValid - The number of valid values to copy from the array
Throws:
InvalidFieldException - The index does not match a known field
InvalidFieldValueException - The value provided is out of range for the field type.
InvalidFieldAccessException - The call is attempting to write to a field that does not permit writing now

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 interface VRMLNodeType
Overrides:
setupFinished in class BaseComponentGeometryNode

notifyExternProtoLoaded

public void notifyExternProtoLoaded(int index,
                                    VRMLNodeType node)
                             throws InvalidFieldValueException
Notify a node that an ExternProto has resolved. This will verify the objects type and add it to the render sceneGraph.

Specified by:
notifyExternProtoLoaded in interface VRMLNodeType
Overrides:
notifyExternProtoLoaded in class AbstractNode
Parameters:
index - The field index
node - The node resolved
Throws:
InvalidFieldValueException - If the proto contains he wrong type

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 interface VRMLNodeType
Overrides:
setValue in class BaseComponentGeometryNode
Parameters:
index - The index of destination field to set
child - The new value to use for the node
Throws:
InvalidFieldException - The field index is not known
InvalidFieldValueException - The node does not match the required type.

setCoordinateNode

protected void setCoordinateNode(VRMLCoordinateNodeType node)
Notification of the coordinate node being set. If the passed value is null then that clears the node. The node passed is the actual geometry, not any proto wrapper, that will have been previously stripped. The default implementation does nothing.

Overrides:
setCoordinateNode in class BaseComponentGeometryNode
Parameters:
node - The node to use

setColorNode

protected void setColorNode(VRMLColorNodeType node)
Notification of the color node being set. If the passed value is null then that clears the node. The node passed is the actual color, not any proto wrapper, that will have been previously stripped. The default implementation does nothing.

Overrides:
setColorNode in class BaseComponentGeometryNode
Parameters:
node - The node to use

setTextureCoordinateNode

protected void setTextureCoordinateNode(VRMLTextureCoordinateNodeType node)
Notification of the coordinate node being set. If the passed value is null then that clears the node. The node passed is the actual geometry, not any proto wrapper, that will have been previously stripped. The default implementation does nothing.

Parameters:
node - The node to use

setNormalNode

protected void setNormalNode(VRMLNormalNodeType node)
Notification of the color node being set. If the passed value is null then that clears the node. The node passed is the actual color, not any proto wrapper, that will have been previously stripped. The default implementation does nothing.

Overrides:
setNormalNode in class BaseComponentGeometryNode
Parameters:
node - The node to use

fieldChanged

public void fieldChanged(VRMLNodeType node,
                         int index)
Notification that the field from the node has changed.

Parameters:
node - The component node that changed
index - The index of the field that has changed

setIndex

protected void setIndex(int[] value,
                        int numValid)
Set the index field. Override to provide.renderer-specific behaviour, but remember to also call this implementation too.

Parameters:
value - The list of index values to use
numValid - The number of valid values to copy from the array

updateCoordinateArray

protected void updateCoordinateArray()
Update the coordinate array in geomData based on the coordinate data.


updateNormalArray

protected void updateNormalArray()
Update the normal array in geomData based on the normal node and normalPerVertex flag.


updateColorArray

protected void updateColorArray()
Update the normal array in geomData based on the normal node and normalPerVertex flag.


Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium