Class BaseEmitter
java.lang.Object
org.web3d.vrml.renderer.common.nodes.AbstractNode
org.web3d.vrml.renderer.common.nodes.particle.BaseEmitter
- All Implemented Interfaces:
VRMLNode
,FrameStateListener
,VRMLNodeType
,VRMLParticleEmitterNodeType
- Direct Known Subclasses:
BaseExplosionEmitter
,BasePointEmitter
,BasePolylineEmitter
Common implementation of all Emitter nodes.
- Version:
- $Revision: 2.1 $
- Author:
- Justin Couch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int
The field index for massprotected static final int
The field index for speedprotected static final int
The field index for surfaceAreaprotected static final int
The field index for variationprotected org.j3d.geom.particle.ParticleInitializer
The particle initializer corresponding to this emitter typeprotected static final int
The last field index used by this classprotected static final int
Number of fields constantprotected float
The value of the mass fieldprotected float
The value of the velocity fieldprotected float
The value of the surfaceArea fieldprotected float
The value of the variation 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
ConstructorsModifierConstructorDescriptionprotected
BaseEmitter
(String type) Construct a new time sensor object -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Copy the values of the given node to this one.getFieldValue
(int index) Get the value of a field.org.j3d.geom.particle.ParticleInitializer
Get the internal initialiser model that will be used for this particle system implementation.float
getMass()
Get the current value of the mass field.int
Get the primary type of this node.float
getSpeed()
Get the current value of the speed field.float
Get the current value of the surfaceArea field.float
Get the current value of the variation field.void
sendRoute
(double time, int srcIndex, VRMLNodeType destNode, int destIndex) Send a routed value from this node to the given destination node.void
setMass
(float mass) Set the position field value to the new value.void
setSpeed
(float speed) Set the position field value to the new value.void
setSurfaceArea
(float surfaceArea) Set the position field value to the new value.void
setValue
(int index, float value) Set the value of the field at the given index as a float for the SFFloat fields.void
setVariation
(float variation) Set the variation field value to the new value.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, 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, setupFinished, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, updateRefCount
-
Field Details
-
FIELD_SPEED
protected static final int FIELD_SPEEDThe field index for speed- See Also:
-
FIELD_MASS
protected static final int FIELD_MASSThe field index for mass- See Also:
-
FIELD_SURFACE_AREA
protected static final int FIELD_SURFACE_AREAThe field index for surfaceArea- See Also:
-
FIELD_VARIATION
protected static final int FIELD_VARIATIONThe field index for variation- See Also:
-
LAST_EMITTER_INDEX
protected static final int LAST_EMITTER_INDEXThe last field index used by this class- See Also:
-
NUM_FIELDS
protected static final int NUM_FIELDSNumber of fields constant- See Also:
-
vfSpeed
protected float vfSpeedThe value of the velocity field -
vfVariation
protected float vfVariationThe value of the variation field -
vfMass
protected float vfMassThe value of the mass field -
vfSurfaceArea
protected float vfSurfaceAreaThe value of the surfaceArea field -
initializer
protected org.j3d.geom.particle.ParticleInitializer initializerThe particle initializer corresponding to this emitter type
-
-
Constructor Details
-
BaseEmitter
-
-
Method Details
-
copy
Copy the values of the given node to this one.- Parameters:
node
- The emitter to use
-
getInitializer
public org.j3d.geom.particle.ParticleInitializer getInitializer()Get the internal initialiser model that will be used for this particle system implementation. This may not be available until after setupFinished() has been called.- Specified by:
getInitializer
in interfaceVRMLParticleEmitterNodeType
- Returns:
- The initialiser instance to use
-
getSpeed
public float getSpeed()Get the current value of the speed field.- Specified by:
getSpeed
in interfaceVRMLParticleEmitterNodeType
- Returns:
- the current speed value 0 - inf.
-
setSpeed
Set the position field value to the new value.- Specified by:
setSpeed
in interfaceVRMLParticleEmitterNodeType
- Parameters:
speed
- The new position to set- Throws:
InvalidFieldValueException
-
getMass
public float getMass()Get the current value of the mass field.- Specified by:
getMass
in interfaceVRMLParticleEmitterNodeType
- Returns:
- the current mass value 0 - inf.
-
setMass
Set the position field value to the new value.- Specified by:
setMass
in interfaceVRMLParticleEmitterNodeType
- Parameters:
mass
- The new mass to set- Throws:
InvalidFieldValueException
- The mass value was negative
-
getSurfaceArea
public float getSurfaceArea()Get the current value of the surfaceArea field.- Specified by:
getSurfaceArea
in interfaceVRMLParticleEmitterNodeType
- Returns:
- the current surfaceArea value 0 - inf.
-
setSurfaceArea
Set the position field value to the new value.- Specified by:
setSurfaceArea
in interfaceVRMLParticleEmitterNodeType
- Parameters:
surfaceArea
- The new amount of surface area to set- Throws:
InvalidFieldValueException
- The area value was negative
-
getVariation
public float getVariation()Get the current value of the variation field.- Specified by:
getVariation
in interfaceVRMLParticleEmitterNodeType
- Returns:
- The current variation value
-
setVariation
Set the variation field value to the new value. If it is out of range the throw an exception.- Specified by:
setVariation
in interfaceVRMLParticleEmitterNodeType
- Parameters:
variation
- The new amount of variation to set- Throws:
InvalidFieldValueException
- The field is out of range
-
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
-
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, float value) throws InvalidFieldException, InvalidFieldValueException Set the value of the field at the given index as a float for the SFFloat fields.- 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 node- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The value provided is not in range or not appropriate for this field
-