APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.graphics.g3d.particles

public Class ParticleController

extends Object
implements Serializable, Configurable
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.graphics.g3d.particles.ResourceData.Configurable, com.badlogic.gdx.utils.Json.Serializable
Imports
com.badlogic.gdx.Gdx, com.badlogic.gdx.assets.AssetManager, com.badlogic.gdx.graphics.g3d.particles.ParallelArray.FloatChannel, com.badlogic.gdx.graphics.g3d.particles.emitters.Emitter, com.badlogic.gdx.graphics.g3d.particles.influencers.Influencer, com.badlogic.gdx.graphics.g3d.particles.renderers.ParticleControllerRenderer, com.badlogic.gdx.math.Matrix4, .Quaternion, .Vector3, com.badlogic.gdx.math.collision.BoundingBox, com.badlogic.gdx.utils.Array, .Json, .JsonValue, com.badlogic.gdx.utils.reflect.ClassReflection

Base class of all the particle controllers. Encapsulate the generic structure of a controller and methods to update the particles simulation.
Author
Inferno

Field Summary

Modifier and TypeField and Description
protected BoundingBox
boundingBox

Not used by the simulation, it should represent the bounding box containing all the particles

protected static final float
DEFAULT_TIME_STEP

the default time step used to update the simulation

public float
deltaTime

Time step, DO NOT CHANGE MANUALLY

public float
deltaTimeSqr

Time step, DO NOT CHANGE MANUALLY

public Emitter
emitter

Controls the emission of the particles

public Array<Influencer>
influencers

Update the properties of the particles

public String
name

Name of the controller

public ParticleChannels
public ParallelArray
particles

Particles components

public ParticleControllerRenderer<?, ?>
renderer

Controls the graphical representation of the particles

public Vector3
scale

Transform flags

public Matrix4
transform

Current transform of the controller DO NOT CHANGE MANUALLY

Constructor Summary

AccessConstructor and Description
public
public
ParticleController(String name, Emitter emitter, ParticleControllerRenderer<?, ?> renderer, Influencer... influencers)

Method Summary

Modifier and TypeMethod and Description
public void
activateParticles(int startIndex, int count)

Generally called by the Emitter.

protected void
allocateChannels(int maxParticleCount)

protected void
bind()

Bind the sub systems to the controller Called once during the init phase.

protected void
calculateBoundingBox()

Updates the bounding box using the position channel.

public ParticleController
copy()

Returns: a copy of this controller

public void
public void
draw()

Updates the renderer used by this controller, usually this means the particles will be draw inside a batch.

public void
end()

End the simulation.

private <K extends Influencer> int
findIndex(Class<K> type)

Returns: the index of the Influencer of the given type.

public <K extends Influencer> K
findInfluencer(Class<K> influencerClass)

Returns: the influencer having the given type.

public BoundingBox
getBoundingBox()

Returns: a copy of this controller, should be used after the particle effect has been loaded.

public void
getTransform(Matrix4 transform)

Set the given matrix to the current transformation matrix.

public void
init()

Initialize the controller.

public boolean
public void
killParticles(int startIndex, int count)

Generally called by the Emitter.

public void
public void
mul(Matrix4 transform)

Postmultiplies the current transformation with the given matrix.

public void
public <K extends Influencer> void
removeInfluencer(Class<K> type)

Removes the Influencer of the given type.

public <K extends Influencer> boolean
replaceInfluencer(Class<K> type, K newInfluencer)

Replaces the Influencer of the given type with the one passed as parameter.

public void
reset()

Reset the simulation.

public void
rotate(Quaternion rotation)

Post-multiplies the current transformation with a rotation matrix represented by the given quaternion.

public void
rotate(Vector3
the rotation axis
axis
,
float
the rotation angle in degrees
angle
)

Post-multiplies the current transformation with a rotation matrix by the given angle around the given axis.

public void
public void
scale(float scaleX, float scaleY, float scaleZ)

Postmultiplies the current transformation with a scale matrix represented by the given scale on x,y,z.

public void
scale(Vector3 scale)

Postmultiplies the current transformation with a scale matrix represented by the given scale vector.

private void
setTimeStep(float timeStep)

Sets the delta used to step the simulation

public void
setTransform(Matrix4
the new transform matrix
transform
)

Sets the current transformation to the given one.

public void
setTransform(float x, float y, float z, float qx, float qy, float qz, float qw, float scale)

Sets the current transformation.

public void
setTranslation(Vector3 translation)

public void
start()

Start the simulation.

public void
translate(Vector3 translation)

Postmultiplies the current transformation with a translation matrix represented by the given translation.

public void
update()

Updates the particles data

public void
update(float deltaTime)

Updates the particles data

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

boundingBoxback to summary
protected BoundingBox boundingBox

Not used by the simulation, it should represent the bounding box containing all the particles

DEFAULT_TIME_STEPback to summary
protected static final float DEFAULT_TIME_STEP

the default time step used to update the simulation

deltaTimeback to summary
public float deltaTime

Time step, DO NOT CHANGE MANUALLY

deltaTimeSqrback to summary
public float deltaTimeSqr

Time step, DO NOT CHANGE MANUALLY

emitterback to summary
public Emitter emitter

Controls the emission of the particles

influencersback to summary
public Array<Influencer> influencers

Update the properties of the particles

nameback to summary
public String name

Name of the controller

particleChannelsback to summary
public ParticleChannels particleChannels
particlesback to summary
public ParallelArray particles

Particles components

rendererback to summary
public ParticleControllerRenderer<?, ?> renderer

Controls the graphical representation of the particles

scaleback to summary
public Vector3 scale

Transform flags

transformback to summary
public Matrix4 transform

Current transform of the controller DO NOT CHANGE MANUALLY

Constructor Detail

ParticleControllerback to summary
public ParticleController()
ParticleControllerback to summary
public ParticleController(String name, Emitter emitter, ParticleControllerRenderer<?, ?> renderer, Influencer... influencers)

Method Detail

activateParticlesback to summary
public void activateParticles(int startIndex, int count)

Generally called by the Emitter. This method will notify all the sub systems that a given amount of particles has been activated.

allocateChannelsback to summary
protected void allocateChannels(int maxParticleCount)
bindback to summary
protected void bind()

Bind the sub systems to the controller Called once during the init phase.

calculateBoundingBoxback to summary
protected void calculateBoundingBox()

Updates the bounding box using the position channel.

copyback to summary
public ParticleController copy()
Returns:ParticleController

a copy of this controller

disposeback to summary
public void dispose()
drawback to summary
public void draw()

Updates the renderer used by this controller, usually this means the particles will be draw inside a batch.

endback to summary
public void end()

End the simulation.

findIndexback to summary
private <K extends Influencer> int findIndex(Class<K> type)
Returns:int

the index of the Influencer of the given type.

findInfluencerback to summary
public <K extends Influencer> K findInfluencer(Class<K> influencerClass)
Returns:K

the influencer having the given type.

getBoundingBoxback to summary
public BoundingBox getBoundingBox()
Returns:BoundingBox

a copy of this controller, should be used after the particle effect has been loaded.

getTransformback to summary
public void getTransform(Matrix4 transform)

Set the given matrix to the current transformation matrix.

initback to summary
public void init()

Initialize the controller. All the sub systems will be initialized and binded to the controller. Must be called before any other method.

isCompleteback to summary
public boolean isComplete()
killParticlesback to summary
public void killParticles(int startIndex, int count)

Generally called by the Emitter. This method will notify all the sub systems that a given amount of particles has been killed.

loadback to summary
public void load(AssetManager manager, ResourceData<T> data)

Implements com.badlogic.gdx.graphics.g3d.particles.ResourceData.Configurable.load.

Annotations
@Override
mulback to summary
public void mul(Matrix4 transform)

Postmultiplies the current transformation with the given matrix.

readback to summary
public void read(Json json, JsonValue jsonMap)

Implements com.badlogic.gdx.utils.Json.Serializable.read.

Annotations
@Override
removeInfluencerback to summary
public <K extends Influencer> void removeInfluencer(Class<K> type)

Removes the Influencer of the given type.

replaceInfluencerback to summary
public <K extends Influencer> boolean replaceInfluencer(Class<K> type, K newInfluencer)

Replaces the Influencer of the given type with the one passed as parameter.

resetback to summary
public void reset()

Reset the simulation.

rotateback to summary
public void rotate(Quaternion rotation)

Post-multiplies the current transformation with a rotation matrix represented by the given quaternion.

rotateback to summary
public void rotate(Vector3 axis, float angle)

Post-multiplies the current transformation with a rotation matrix by the given angle around the given axis.

Parameters
axis:Vector3

the rotation axis

angle:float

the rotation angle in degrees

saveback to summary
public void save(AssetManager manager, ResourceData<T> data)

Implements com.badlogic.gdx.graphics.g3d.particles.ResourceData.Configurable.save.

Annotations
@Override
scaleback to summary
public void scale(float scaleX, float scaleY, float scaleZ)

Postmultiplies the current transformation with a scale matrix represented by the given scale on x,y,z.

scaleback to summary
public void scale(Vector3 scale)

Postmultiplies the current transformation with a scale matrix represented by the given scale vector.

setTimeStepback to summary
private void setTimeStep(float timeStep)

Sets the delta used to step the simulation

setTransformback to summary
public void setTransform(Matrix4 transform)

Sets the current transformation to the given one.

Parameters
transform:Matrix4

the new transform matrix

setTransformback to summary
public void setTransform(float x, float y, float z, float qx, float qy, float qz, float qw, float scale)

Sets the current transformation.

setTranslationback to summary
public void setTranslation(Vector3 translation)
startback to summary
public void start()

Start the simulation.

translateback to summary
public void translate(Vector3 translation)

Postmultiplies the current transformation with a translation matrix represented by the given translation.

updateback to summary
public void update()

Updates the particles data

updateback to summary
public void update(float deltaTime)

Updates the particles data

writeback to summary
public void write(Json json)

Implements com.badlogic.gdx.utils.Json.Serializable.write.

Annotations
@Override