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 intThe field index for massprotected static final intThe field index for speedprotected static final intThe field index for surfaceAreaprotected static final intThe field index for variationprotected org.j3d.geom.particle.ParticleInitializerThe particle initializer corresponding to this emitter typeprotected static final intThe last field index used by this classprotected static final intNumber of fields constantprotected floatThe value of the mass fieldprotected floatThe value of the velocity fieldprotected floatThe value of the surfaceArea fieldprotected floatThe 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
ConstructorsModifierConstructorDescriptionprotectedBaseEmitter(String type) Construct a new time sensor object -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCopy the values of the given node to this one.getFieldValue(int index) Get the value of a field.org.j3d.geom.particle.ParticleInitializerGet the internal initialiser model that will be used for this particle system implementation.floatgetMass()Get the current value of the mass field.intGet the primary type of this node.floatgetSpeed()Get the current value of the speed field.floatGet the current value of the surfaceArea field.floatGet the current value of the variation field.voidsendRoute(double time, int srcIndex, VRMLNodeType destNode, int destIndex) Send a routed value from this node to the given destination node.voidsetMass(float mass) Set the position field value to the new value.voidsetSpeed(float speed) Set the position field value to the new value.voidsetSurfaceArea(float surfaceArea) Set the position field value to the new value.voidsetValue(int index, float value) Set the value of the field at the given index as a float for the SFFloat fields.voidsetVariation(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, 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, 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:
getInitializerin interfaceVRMLParticleEmitterNodeType- Returns:
- The initialiser instance to use
-
getSpeed
public float getSpeed()Get the current value of the speed field.- Specified by:
getSpeedin interfaceVRMLParticleEmitterNodeType- Returns:
- the current speed value 0 - inf.
-
setSpeed
Set the position field value to the new value.- Specified by:
setSpeedin interfaceVRMLParticleEmitterNodeType- Parameters:
speed- The new position to set- Throws:
InvalidFieldValueException
-
getMass
public float getMass()Get the current value of the mass field.- Specified by:
getMassin interfaceVRMLParticleEmitterNodeType- Returns:
- the current mass value 0 - inf.
-
setMass
Set the position field value to the new value.- Specified by:
setMassin 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:
getSurfaceAreain interfaceVRMLParticleEmitterNodeType- Returns:
- the current surfaceArea value 0 - inf.
-
setSurfaceArea
Set the position field value to the new value.- Specified by:
setSurfaceAreain 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:
getVariationin 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:
setVariationin 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:
getPrimaryTypein 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:
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, float value) throws InvalidFieldException, InvalidFieldValueException Set the value of the field at the given index as a float for the SFFloat fields.- 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 knownInvalidFieldValueException- The value provided is not in range or not appropriate for this field
-