Class c3dl.ParticleSystem
ParticleSystem is used to simulate phenomena such as fire, smoke, rain, etc.
Defined in: particlesystem.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Method Attributes | Method Name and Description |
|---|---|
|
emit(numToEmit)
Emit a number of particles all at once.
|
|
|
Get the acceleration of all the particles.
|
|
|
Get blend equation
|
|
|
get the desination blend factor.
|
|
|
Get the maximum color range.
|
|
|
Get the maximum number of seconds for which any particle can live.
|
|
|
Get the maximum values for each xyz component any particle can
be assigned when emitted.
|
|
|
Get the minimum color range.
|
|
|
Get the minimum amount of seconds for which any particle can live.
|
|
|
Get the total amount of particles in the system, including dead ones.
|
|
|
getParticle(i)
Get the particle at index i.
|
|
|
Get the source blending factor.
|
|
|
Get the texture which all particles are assigned.
|
|
|
init(numParticles)
Initialize the subsystem.
|
|
|
setAcceleration(acceleration)
Set the acceleration of this subsystem.
|
|
|
setBlendEquation(blenEq)
(src * srcBlend) Eq (dst * dstBlend)
|
|
|
setDstBlend(dstBlend)
Set the destination blend factor.
|
|
|
setEmitRate(particlesPerSecond)
Set the amount of particles to emit per second.
|
|
|
setMaxAngularVelocity(maxAngVel)
|
|
|
setMaxColor(maxColor)
Set the maximum color range a particle can be assigned.
|
|
|
setMaxLifetime(maxLifetime)
Set the maximum number of seconds for which any particle can live.
|
|
|
setMaxSize(maxSize)
|
|
|
setMaxVelocity(maxVelocity)
Set the maximum velocity of all the particles.
|
|
|
setMinAngularVelocity(minAngVel)
|
|
|
setMinColor(minParticleColor)
Set the minimum color values each particle can be.
|
|
|
setMinLifetime(minParticleLifetime)
Set the minimum amount of seconds for which particles will live.
|
|
|
setMinSize(minSize)
|
|
|
setMinVelocity(minVelocity)
Set the minimum velocity of all the particles.
|
|
|
Set the position of the particle system.
|
|
|
setSrcBlend(srcBlend)
Set the Source blending factor.
|
|
|
setTexture(textureName)
Set the texure of the particles.
|
Method Detail
emit(numToEmit)
Emit a number of particles all at once. If the amount of particles
to emit exceeds the amount which are available, the last remaining
particles are emitted. If there are no particles available to emit,
none are emitted.
- Parameters:
- numToEmit
getAcceleration()
Get the acceleration of all the particles. This is usually
gravity, but does not have to be.
getBlendEquation()
Get blend equation
{int}
getDstBlend()
get the desination blend factor.
- Returns:
- {int} the destination blend factor.
{Array}
getMaxColor()
Get the maximum color range. The max color range
is an array of components which each contain the
maximum value each component can be assigned. components
range from 0 to 1.
- Returns:
- {Array}
getMaxLifetime()
Get the maximum number of seconds for which any particle can live.
- Returns:
- the maximum number of seconds for which any particle can live.
{Array}
getMaxVelocity()
Get the maximum values for each xyz component any particle can
be assigned when emitted.
- Returns:
- {Array} the maximum values for each xyz component any particle can be assigned when emitted.
{Array}
getMinColor()
Get the minimum color range.
- Returns:
- {Array}
getMinLifetime()
Get the minimum amount of seconds for which any particle can live.
- Returns:
- the minimum amount of seconds for which any particle can live.
getMinVelocity()
getNumParticles()
Get the total amount of particles in the system, including dead ones.
return {int}
getObjectType()
getParticle(i)
Get the particle at index i.
- Parameters:
- {int} i
- the index of the particle to get.
{int}
getSrcBlend()
Get the source blending factor.
- Returns:
- {int} the source blending factor.
{String}
getTexture()
Get the texture which all particles are assigned.
- Returns:
- {String} the texture which all particles are assigned.
getVBOColors()
getVBOTexCoords()
getVBOVertices()
init(numParticles)
Initialize the subsystem. This must be called before the particle
system is actually used.
- Parameters:
- {integer} numParticles
setAcceleration(acceleration)
Set the acceleration of this subsystem. This is commonly gravity, but can be
any valid vector.
- Parameters:
- {Array} acceleration
setBlendEquation(blenEq)
(src * srcBlend) Eq (dst * dstBlend)
- Parameters:
- {int} blenEq
setDstBlend(dstBlend)
Set the destination blend factor. parameter must be one of:
c3dl.ZERO,
c3dl.ONE,
c3dl.SRC_COLOR,
c3dl.ONE_MINUS_SRC_COLOR,
c3dl.SRC_ALPHA,
c3dl.ONE_MINUS_SRC_ALPHA,
c3dl.DST_ALPHA,
c3dl.ONE_MINUS_DST_ALPHA,
c3dl.DST_COLOR,
c3dl.ONE_MINUS_DST_COLOR or
c3dl.SRC_ALPHA_SATURATE
- Parameters:
- {int} dstBlend
setEmitRate(particlesPerSecond)
Set the amount of particles to emit per second. To stop emission, pass in zero.
- Parameters:
- particlesPerSecond
setMaxAngularVelocity(maxAngVel)
- Parameters:
- maxAngVel
setMaxColor(maxColor)
Set the maximum color range a particle can be assigned. Each component
must range from 0 to 1 inclusive.
- Parameters:
- {Array} maxColor
- - array of 4 floating point values ranging from 0 to 1 inclusive.
setMaxLifetime(maxLifetime)
Set the maximum number of seconds for which any particle can live.
Value must be greater than zero.
- Parameters:
- {float} maxLifetime
setMaxSize(maxSize)
- Parameters:
- maxSize
setMaxVelocity(maxVelocity)
Set the maximum velocity of all the particles.
- Parameters:
- {Array} maxVelocity
- the maximum velocity of all the particles.
setMinAngularVelocity(minAngVel)
- Parameters:
- minAngVel
setMinColor(minParticleColor)
Set the minimum color values each particle can be.
- Parameters:
- {Array} minParticleColor
- the minimum Color values each particle can be.
setMinLifetime(minParticleLifetime)
Set the minimum amount of seconds for which particles will live.
Value must be greater than zero.
- Parameters:
- minParticleLifetime
- the minimum amount of seconds for which the particles can live.
setMinSize(minSize)
- Parameters:
- minSize
setMinVelocity(minVelocity)
Set the minimum velocity of all the particles.
- Parameters:
- {Array} minVelocity
- the minimum velocity of all the particles.
setPosition()
Set the position of the particle system.
- Parameters:
- {Array}
setSrcBlend(srcBlend)
Set the Source blending factor. parameter must be one of:
c3dl.ZERO,
c3dl.ONE,
c3dl.SRC_COLOR,
c3dl.ONE_MINUS_SRC_COLOR,
c3dl.SRC_ALPHA,
c3dl.ONE_MINUS_SRC_ALPHA,
c3dl.DST_ALPHA,
c3dl.ONE_MINUS_DST_ALPHA,
c3dl.DST_COLOR,
c3dl.ONE_MINUS_DST_COLOR or
c3dl.SRC_ALPHA_SATURATE
- Parameters:
- {int} srcBlend
setTexture(textureName)
Set the texure of the particles.
- Parameters:
- {String} textureName