Class BaseJointNode
java.lang.Object
org.web3d.vrml.renderer.common.nodes.AbstractNode
org.web3d.vrml.renderer.common.nodes.rigidphysics.BaseJointNode
- All Implemented Interfaces:
VRMLNode
,FrameStateListener
,VRMLNodeType
,VRMLRigidJointNodeType
- Direct Known Subclasses:
BaseBallJoint
,BaseDoubleAxisHingeJoint
,BaseMotorJoint
,BaseSingleAxisHingeJoint
,BaseSliderJoint
,BaseUniversalJoint
Implementation of the abstract X3DRigidJointNode type.
- Version:
- $Revision: 1.3 $
- Author:
- Justin Couch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
Message for when the node in setValue() is not a Bodyprotected static final String
Message for when the proto is not a Bodyprotected static final int
The field index for body1protected static final int
The field index for body2protected static final int
The field index for mustOutputprotected static final int
Last index used by this base nodeprotected int
The number of valid values in vfMustOutputprotected int
The number of valid values in the output listprotected int[]
Converted version of the output index listprotected VRMLProtoInstance
The proto version of the body1protected VRMLProtoInstance
The proto version of the body2protected VRMLRigidBodyNodeType
The value of the body1 fieldprotected VRMLRigidBodyNodeType
The value of the body2 fieldprotected String[]
The value of the mustOutput listFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBody1()
Fetch the node that is being used to pick the geometrygetBody2()
Fetch the node that is being used to pick the geometrygetFieldValue
(int index) Get the value of a field.int[]
Get the array of output field indices for this joint.int
Get the primary type of this node.int
Get the number of valid fields that the user has requested updates for.void
sendRoute
(double time, int srcIndex, VRMLNodeType destNode, int destIndex) Send a routed value from this node to the given destination node.void
setBody1
(VRMLNodeType body) Set node content as replacement for the body1 field.void
setBody2
(VRMLNodeType body) Set node content as replacement for the body1 field.void
Notification that the construction phase of this node has finished.void
Set the value of the field at the given index as a single float.void
setValue
(int index, VRMLNodeType child) Set the value of the field at the given index as a node.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, 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
getFieldDeclaration, getFieldIndex, getNodeFieldIndices, getNumFields, 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, setValue, updateRefCount
Methods inherited from interface org.web3d.vrml.nodes.VRMLRigidJointNodeType
delete, setODEWorld, updateRequestedOutputs
-
Field Details
-
FIELD_BODY1
protected static final int FIELD_BODY1The field index for body1- See Also:
-
FIELD_BODY2
protected static final int FIELD_BODY2The field index for body2- See Also:
-
FIELD_MUST_OUTPUT
protected static final int FIELD_MUST_OUTPUTThe field index for mustOutput- See Also:
-
LAST_JOINT_INDEX
protected static final int LAST_JOINT_INDEXLast index used by this base node- See Also:
-
BODY_PROTO_MSG
-
BODY_NODE_MSG
Message for when the node in setValue() is not a Body- See Also:
-
vfBody1
The value of the body1 field -
pBody1
The proto version of the body1 -
vfBody2
The value of the body2 field -
pBody2
The proto version of the body2 -
vfMustOutput
The value of the mustOutput list -
numMustOutput
protected int numMustOutputThe number of valid values in vfMustOutput -
outputIndices
protected int[] outputIndicesConverted version of the output index list -
numOutputIndices
protected int numOutputIndicesThe number of valid values in the output list
-
-
Constructor Details
-
BaseJointNode
Construct a new generalised joint node object.- Parameters:
name
- The VRML name of this node
-
-
Method Details
-
numOutputs
public int numOutputs()Get the number of valid fields that the user has requested updates for.- Specified by:
numOutputs
in interfaceVRMLRigidJointNodeType
- Returns:
- a value greater than or equal to zero
-
getOutputFields
public int[] getOutputFields()Get the array of output field indices for this joint. These are previously mapped internally from the output listing to the field index values corresponding to the user-supplied field names, as well as processing for the special NONE and ALL types.- Specified by:
getOutputFields
in interfaceVRMLRigidJointNodeType
- Returns:
- an array of field indices that are to be used
-
setBody1
Set node content as replacement for the body1 field. This checks only for basic node representation. If a concrete node needs a specific set of nodes, it should override this method to check.- Specified by:
setBody1
in interfaceVRMLRigidJointNodeType
- Parameters:
body
- The new body representation. null will act like delete- Throws:
InvalidFieldValueException
- The node does not match the required type.
-
getBody1
Fetch the node that is being used to pick the geometry- Returns:
- The valid geometry node or null if not set
-
setBody2
Set node content as replacement for the body1 field. This checks only for basic node representation. If a concrete node needs a specific set of nodes, it should override this method to check.- Specified by:
setBody2
in interfaceVRMLRigidJointNodeType
- Parameters:
body
- The new body representation. null will act like delete- Throws:
InvalidFieldValueException
- The node does not match the required type.
-
getBody2
Fetch the node that is being used to pick the geometry- Specified by:
getBody2
in interfaceVRMLRigidJointNodeType
- Returns:
- The valid geometry node or null if not set
-
getPrimaryType
public int getPrimaryType()Get the primary type of this node. Replaces the instanceof mechanism for use in switch statements.- Specified by:
getPrimaryType
in interfaceVRMLNode
- Returns:
- The primary type
-
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 classAbstractNode
-
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 classAbstractNode
- 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
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 interfaceVRMLNodeType
- Overrides:
sendRoute
in classAbstractNode
- 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 fromdestNode
- The node reference that we will be sending the value todestIndex
- The index of the field in the destination node that the value should be sent to.
-
setValue
public void setValue(int index, String[] value, int numValid) throws InvalidFieldValueException, InvalidFieldException Set the value of the field at the given index as a single float. This would be used to set MFString 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 field index is not knowInvalidFieldValueException
- The value provided is not in range or not appropriate for this field
-
setValue
public void setValue(int index, VRMLNodeType child) throws InvalidFieldValueException, InvalidFieldException 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 classAbstractNode
- Parameters:
index
- The index of destination field to setchild
- The new value to use for the node- Throws:
InvalidFieldException
- The field index is not knowInvalidFieldValueException
- The value provided does not fit this type of node
-