Class BaseSequencerNode
java.lang.Object
org.web3d.vrml.renderer.common.nodes.AbstractNode
org.web3d.vrml.renderer.common.nodes.BaseSequencerNode
- All Implemented Interfaces:
VRMLNode,FrameStateListener,VRMLChildNodeType,VRMLNodeType,VRMLSequencerNodeType,VRMLWorldRootChildNodeType
- Direct Known Subclasses:
BaseBooleanSequencer,BaseIntegerSequencer
Abstract implementation of a sequencer so that specific instances can
derive from it.
Sequencer nodes are designed for discrete animation. Sequencers are driven by an input and produce corresponding impulse output functions.
- Version:
- $Revision: 1.8 $
- Author:
- Alan Hudson
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThe current index in the array that is activeprotected static final intThe field index for keyprotected static final intThe field index for keyValueprotected static final intThe field index for nextprotected static final intThe field index for previousprotected static final intThe field index for set_fractionprotected static final intThe field index for the value_changed fieldprotected static final intThe last field index used by this classprotected intThe number of valid items in vfKeyprotected floatThe value of the fraction fieldprotected float[]The value of the key fieldFields 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
ConstructorsConstructorDescriptionBaseSequencerNode(String name) Initialise the time dependent node and it's fields that are held locally. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcopy(VRMLSequencerNodeType node) Set the fields of the interpolator node that has the fields set based on the fields of the passed in node.getFieldValue(int index) Get the value of a field.floatGet the value of the fraction field.float[]getKey()Get current value of key field value.intGet the number of valid keys defined for this interpolator.intGet the primary type of this node.voidsendRoute(double time, int srcIndex, VRMLNodeType destNode, int destIndex) Send a routed value from this node to the given destination node.protected voidFind the current active key value from the fraction.voidsetKey(float[] keys, int numValid) Set a new value for the key field.voidsetNext()Cause the next value to be generated on the output.voidCause the previous value to be generated on the output.voidsetValue(int index, boolean value) Set the value of the field at the given index as a boolean.voidsetValue(int index, float value) Set the value of the field at the given index as a float.voidsetValue(int index, float[] value, int numValid) Set the value of the field at the given index as an array of floats.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, setupFinished, setUserData, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setVersion, throwInitOnlyWriteException, throwInputOnlyWriteException, throwInvalidNodeException, throwInvalidProtoException, throwOutputOnlyWriteException, updateRefCount, updateRefsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.web3d.vrml.nodes.FrameStateListener
allEventsCompleteMethods inherited from interface org.web3d.vrml.lang.VRMLNode
getFieldDeclaration, getFieldIndex, getNodeFieldIndices, getNumFields, getSecondaryType, getUserData, getVRMLNodeName, isDEF, setErrorReporter, setUserData, setVersionMethods inherited from interface org.web3d.vrml.nodes.VRMLNodeType
addNodeListener, clearRemovedLayerIds, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, hasFieldChanged, isSetupFinished, notifyExternProtoLoaded, removeNodeListener, setDEF, setFrameStateManager, setMetadataObject, setupFinished, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, updateRefCountMethods inherited from interface org.web3d.vrml.nodes.VRMLSequencerNodeType
setFraction
-
Field Details
-
FIELD_NEXT
protected static final int FIELD_NEXTThe field index for next- See Also:
-
FIELD_PREVIOUS
protected static final int FIELD_PREVIOUSThe field index for previous- See Also:
-
FIELD_SET_FRACTION
protected static final int FIELD_SET_FRACTIONThe field index for set_fraction- See Also:
-
FIELD_KEY
protected static final int FIELD_KEYThe field index for key- See Also:
-
FIELD_KEY_VALUE
protected static final int FIELD_KEY_VALUEThe field index for keyValue- See Also:
-
FIELD_VALUE_CHANGED
protected static final int FIELD_VALUE_CHANGEDThe field index for the value_changed field- See Also:
-
LAST_SEQUENCER_INDEX
protected static final int LAST_SEQUENCER_INDEXThe last field index used by this class- See Also:
-
vfFraction
protected float vfFractionThe value of the fraction field -
vfKey
protected float[] vfKeyThe value of the key field -
numKey
protected int numKeyThe number of valid items in vfKey -
currentIndex
protected int currentIndexThe current index in the array that is active
-
-
Constructor Details
-
BaseSequencerNode
Initialise the time dependent node and it's fields that are held locally.- Parameters:
name- The name of the type of node
-
-
Method Details
-
copy
Set the fields of the interpolator node that has the fields set based on the fields of the passed in node.- Parameters:
node- The interpolator node to copy info from
-
setNext
public void setNext()Cause the next value to be generated on the output. This is equivalent to sending a value to the next inputOnly field.- Specified by:
setNextin interfaceVRMLSequencerNodeType
-
setPrevious
public void setPrevious()Cause the previous value to be generated on the output. This is equivalent to sending a value to the previous inputOnly field.- Specified by:
setPreviousin interfaceVRMLSequencerNodeType
-
getPrimaryType
public int getPrimaryType()Get the primary type of this node. Replaces the instanceof mechanism for use in switch statements.- Specified by:
getPrimaryTypein interfaceVRMLNode- Returns:
- The primary type
-
getFraction
public float getFraction()Get the value of the fraction field.- Specified by:
getFractionin interfaceVRMLSequencerNodeType- Returns:
- The current value for fraction
-
setKey
public void setKey(float[] keys, int numValid) Set a new value for the key field. Null will delete all key values.- Specified by:
setKeyin interfaceVRMLSequencerNodeType- Parameters:
keys- The new key values to usenumValid- The number of valid values to copy from the array
-
getNumKey
public int getNumKey()Get the number of valid keys defined for this interpolator.- Specified by:
getNumKeyin interfaceVRMLSequencerNodeType- Returns:
- a value >= 0
-
getKey
public float[] getKey()Get current value of key field value. If no keys exist a blank float[] will be returned.- Specified by:
getKeyin interfaceVRMLSequencerNodeType- Returns:
- The current key values
-
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:
getFieldValuein interfaceVRMLNodeType- Overrides:
getFieldValuein 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:
sendRoutein interfaceVRMLNodeType- Overrides:
sendRoutein 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, boolean value) throws InvalidFieldException, InvalidFieldValueException Set the value of the field at the given index as a boolean. This would be used to set SFBool field type for the field fraction- Specified by:
setValuein interfaceVRMLNodeType- Overrides:
setValuein classAbstractNode- Parameters:
index- The index of destination field to setvalue- The new value to use for the node- 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, float value) throws InvalidFieldException, InvalidFieldValueException Set the value of the field at the given index as a float. This would be used to set SFFloat field type for the field fraction- Specified by:
setValuein interfaceVRMLNodeType- Overrides:
setValuein classAbstractNode- Parameters:
index- The index of destination field to setvalue- The new value to use for the node- 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, float[] value, int numValid) throws InvalidFieldException, InvalidFieldValueException Set the value of the field at the given index as an array of floats. This would be used to set MFFloat, SFVec2f, SFFloat and SFRotation field types.- Specified by:
setValuein interfaceVRMLNodeType- Overrides:
setValuein 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
-
setCurrentKey
protected void setCurrentKey()Find the current active key value from the fraction. This will find the key that is just less than or equal to the current key value, and return its index into vfKey.
-