Class BaseIndexedQuadSet
java.lang.Object
org.web3d.vrml.renderer.common.nodes.AbstractNode
org.web3d.vrml.renderer.common.nodes.BaseComponentGeometryNode
org.web3d.vrml.renderer.common.nodes.cadgeometry.BaseIndexedQuadSet
- All Implemented Interfaces:
VRMLNode
,FrameStateListener
,VRMLComponentGeometryNodeType
,VRMLGeometryNodeType
,VRMLNodeComponentListener
,VRMLNodeType
- Direct Known Subclasses:
NRIndexedQuadSet
,OGLIndexedQuadSet
Common IndexedQuadSet handling.
- Version:
- $Revision: 1.6 $ copied from the BaseQuadSet.java class by Alan Hudson extra functions added for the 'index' node attribute inspired by the implementation of the BaseIndexedGeometryNode
- Author:
- Vincent Marchetti
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int
Index of the coordIndex SFInt32 fieldprotected static final int
Index of the set_coordIndex SFInt32 eventInprotected int
Number of valid values in vfColorIndexprotected int[]
field MFInt32 coordIndexFields 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, COLOR_NODE_MSG, COLOR_PROTO_MSG, COLORS_CHANGED, COLORS_INDEX_CHANGED, COORD_NODE_MSG, COORD_PROTO_MSG, 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, inSetup, isDEF, isStatic, LAST_NODE_INDEX, layerIds, nodeName, pMetadata, refCounts, removedLayerIds, stateManager, STATIC_SCENE_GRAPH, vfMetadata, vrmlMajorVersion, vrmlMinorVersion
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Construct a default instance of this class with the bind flag set to false and no time information set (effective value of zero).protected
Construct a new instance of this node based on the details from the given node. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a listener for local color changes.void
Add a listener for texture coordinate generation mode changes.void
fieldChanged
(VRMLNodeType node, int index) Notification that the field from the node has changed.getFieldDeclaration
(int index) Get the declaration of the field at the given index.int
getFieldIndex
(String fieldName) Get the index of the given field name.getFieldValue
(int index) Get the value of a field.int[]
Get the list of indices that correspond to fields that contain nodes ie MFNode and SFNode).int
Get the number of fields.boolean
Specified whether this node has color information.boolean
isCCW()
Get the value of the CCW field.boolean
Specifies whether this node requires lighting.boolean
isSolid()
Specifies whether a geometry object is a solid opject.void
Remove a listener for local color changes.void
Remove a listener for texture coordinate generation mode changes.protected void
setCoordIndex
(int[] value, int numValid) Set the coordIndex field.void
setValue
(int index, int[] value, int numValid) Set the value of the field at the given index as an array of integers.Methods inherited from class org.web3d.vrml.renderer.common.nodes.BaseComponentGeometryNode
copy, fireLocalColorsChanged, getComponents, getNumSets, getPrimaryType, getTexCoordGenMode, hasColorPerVertex, hasLocalColorAlpha, hasNormalPerVertex, requiresUnlitColor, sendRoute, setColorNode, setComponent, setComponents, setCoordinateNode, setFogCoordinateNode, setNormalNode, setTexCoordNode, setTextureCount, setUnlitColor, setupFinished, 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, 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.lang.VRMLNode
getSecondaryType, getUserData, getVRMLNodeName, isDEF, setErrorReporter, setUserData, setVersion
Methods inherited from interface org.web3d.vrml.nodes.VRMLNodeType
addNodeListener, clearRemovedLayerIds, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, hasFieldChanged, isSetupFinished, notifyExternProtoLoaded, removeNodeListener, setDEF, setFrameStateManager, setMetadataObject, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, updateRefCount
-
Field Details
-
FIELD_COORDINDEX
protected static final int FIELD_COORDINDEXIndex of the coordIndex SFInt32 field- See Also:
-
FIELD_SET_COORDINDEX
protected static final int FIELD_SET_COORDINDEXIndex of the set_coordIndex SFInt32 eventIn- See Also:
-
vfCoordIndex
protected int[] vfCoordIndexfield MFInt32 coordIndex -
numCoordIndex
protected int numCoordIndexNumber of valid values in vfColorIndex
-
-
Constructor Details
-
BaseIndexedQuadSet
protected BaseIndexedQuadSet()Construct a default instance of this class with the bind flag set to false and no time information set (effective value of zero). -
BaseIndexedQuadSet
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
-
hasLocalColors
public boolean hasLocalColors()Specified whether this node has color information. If so, then it will be used for diffuse terms instead of materials.- Specified by:
hasLocalColors
in interfaceVRMLGeometryNodeType
- Overrides:
hasLocalColors
in classBaseComponentGeometryNode
- Returns:
- true Use local color information for diffuse lighting.
-
addLocalColorsListener
Add a listener for local color changes. Nulls and duplicates will be ignored.- Specified by:
addLocalColorsListener
in interfaceVRMLGeometryNodeType
- Overrides:
addLocalColorsListener
in classBaseComponentGeometryNode
- Parameters:
l
- The listener.
-
removeLocalColorsListener
Remove a listener for local color changes. Nulls will be ignored.- Specified by:
removeLocalColorsListener
in interfaceVRMLGeometryNodeType
- Overrides:
removeLocalColorsListener
in classBaseComponentGeometryNode
- Parameters:
l
- The listener.
-
addTexCoordGenModeChanged
Add a listener for texture coordinate generation mode changes. Nulls and duplicates will be ignored.- Specified by:
addTexCoordGenModeChanged
in interfaceVRMLGeometryNodeType
- Overrides:
addTexCoordGenModeChanged
in classBaseComponentGeometryNode
- Parameters:
l
- The listener.
-
removeTexCoordGenModeChanged
Remove a listener for texture coordinate generation mode changes. Nulls will be ignored.- Specified by:
removeTexCoordGenModeChanged
in interfaceVRMLGeometryNodeType
- Overrides:
removeTexCoordGenModeChanged
in classBaseComponentGeometryNode
- Parameters:
l
- The listener.
-
isSolid
public boolean isSolid()Specifies whether a geometry object is a solid opject. If true, then back-face culling can be performed- Specified by:
isSolid
in interfaceVRMLGeometryNodeType
- Overrides:
isSolid
in classBaseComponentGeometryNode
- Returns:
- The current value of solid
-
isCCW
public boolean isCCW()Get the value of the CCW field. If the node does not have one, this will return true.- Specified by:
isCCW
in interfaceVRMLGeometryNodeType
- Overrides:
isCCW
in classBaseComponentGeometryNode
- Returns:
- true if the vertices are CCW ordered
-
isLightingEnabled
public boolean isLightingEnabled()Specifies whether this node requires lighting.- Specified by:
isLightingEnabled
in interfaceVRMLGeometryNodeType
- Overrides:
isLightingEnabled
in classBaseComponentGeometryNode
- Returns:
- Should lighting be enabled
-
getFieldValue
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 interfaceVRMLNodeType
- Overrides:
getFieldValue
in classBaseComponentGeometryNode
- Parameters:
index
- The index of the field to change.- Returns:
- The class representing the field value
- Throws:
InvalidFieldException
- The field index is not known
-
getFieldIndex
Get the index of the given field name. If the name does not exist for this node then return a value of -1.- Parameters:
fieldName
- The name of the field we want the index from- Returns:
- The index of the field name or -1
-
getNodeFieldIndices
public int[] getNodeFieldIndices()Get the list of indices that correspond to fields that contain nodes ie MFNode and SFNode). Used for blind scene graph traversal without needing to spend time querying for all fields etc. If a node does not have any fields that contain nodes, this shall return null. The field list covers all field types, regardless of whether they are readable or not at the VRML-level.- Returns:
- The list of field indices that correspond to SF/MFnode fields or null if none
-
getFieldDeclaration
Get the declaration of the field at the given index. This allows for reverse lookup if needed. If the field does not exist, this will give a value of null.- Parameters:
index
- The index of the field to get information- Returns:
- A representation of this field's information
-
getNumFields
public int getNumFields()Get the number of fields.- Returns:
- The number of fields.
-
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 interfaceVRMLNodeType
- Overrides:
setValue
in classAbstractNode
- Parameters:
index
- The index of destination field to setvalue
- The new value to use for the nodenumValid
- The number of valid values to copy from the array- Throws:
InvalidFieldException
- The index does not match a known fieldInvalidFieldValueException
- 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
-
setCoordIndex
protected void setCoordIndex(int[] value, int numValid) Set the coordIndex field. Override to provide.renderer-specific behaviour, but remember to also call this implementation too.- Parameters:
value
- The list of index values to usenumValid
- The number of valid indices in the array
-
fieldChanged
Notification that the field from the node has changed.- Parameters:
node
- The component node that changedindex
- The index of the field that has changed
-