Package com.jme3.effect.shapes
Class EmitterSphereShape
java.lang.Object
com.jme3.effect.shapes.EmitterSphereShape
- All Implemented Interfaces:
EmitterShape
,Savable
,JmeCloneable
,Cloneable
An
EmitterShape
that emits particles randomly from within the volume of a sphere.
The sphere is defined by a center point and a radius.-
Constructor Summary
ConstructorsConstructorDescriptionFor serialization only.EmitterSphereShape
(Vector3f center, float radius) Constructs anEmitterSphereShape
with the given center and radius. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cloneFields
(Cloner cloner, Object original) Called internally by com.jme3.util.clone.Cloner.This method creates a deep clone of the current instance of the emitter shape.Returns the center point of the sphere.float
Returns the radius of the sphere.void
getRandomPoint
(Vector3f store) Generates a random point within the volume of the sphere.void
getRandomPointAndNormal
(Vector3f store, Vector3f normal) For a sphere shape, the normal is not well-defined for points within the volume.jmeClone()
Called internally by com.jme3.util.clone.Cloner.void
read
(JmeImporter im) void
Sets the center point of the sphere.void
setRadius
(float radius) Sets the radius of the sphere.void
write
(JmeExporter ex)
-
Constructor Details
-
EmitterSphereShape
public EmitterSphereShape()For serialization only. Do not use. -
EmitterSphereShape
Constructs anEmitterSphereShape
with the given center and radius.- Parameters:
center
- The center point of the sphere.radius
- The radius of the sphere.- Throws:
IllegalArgumentException
- Ifcenter
is null, or ifradius
is not greater than 0.
-
-
Method Details
-
deepClone
Description copied from interface:EmitterShape
This method creates a deep clone of the current instance of the emitter shape.- Specified by:
deepClone
in interfaceEmitterShape
- Returns:
- deep clone of the current instance of the emitter shape
-
jmeClone
Called internally by com.jme3.util.clone.Cloner. Do not call directly.- Specified by:
jmeClone
in interfaceJmeCloneable
- Returns:
- a new instance
-
cloneFields
Called internally by com.jme3.util.clone.Cloner. Do not call directly.- Specified by:
cloneFields
in interfaceJmeCloneable
- Parameters:
cloner
- The cloner that is performing the cloning operation. The cloneFields method can call back into the cloner to make clones of its subordinate fields.original
- The original object from which this object was cloned. This is provided for the very rare case that this object needs to refer to its original for some reason. In general, all of the relevant values should have been transferred during the shallow clone, and this object need only clone what it wants.
-
getRandomPoint
Generates a random point within the volume of the sphere.- Specified by:
getRandomPoint
in interfaceEmitterShape
- Parameters:
store
- TheVector3f
to store the generated point in.
-
getRandomPointAndNormal
For a sphere shape, the normal is not well-defined for points within the volume. This implementation simply callsgetRandomPoint(Vector3f)
and does not modify the provided normal.- Specified by:
getRandomPointAndNormal
in interfaceEmitterShape
- Parameters:
store
- TheVector3f
to store the generated point in.normal
- TheVector3f
to store the generated normal in (unused).
-
getCenter
Returns the center point of the sphere.- Returns:
- The center point.
-
setCenter
Sets the center point of the sphere.- Parameters:
center
- The new center point.
-
getRadius
public float getRadius()Returns the radius of the sphere.- Returns:
- The radius.
-
setRadius
public void setRadius(float radius) Sets the radius of the sphere.- Parameters:
radius
- The new radius.
-
write
- Specified by:
write
in interfaceSavable
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Throws:
IOException
-