7.8.8 Emitter Mesh Object
Written by Wouter Wijngaards,
wouterw@cs.vu.nl.
An emitter particle system is a very general particle system, that
can do a variety of things. See the general particle system documentation
which is valid for all particle systems, for
global options. See section 7.8.9 Particle Systems in General.
The emitter can be customized to a high degree, using the `iEmitGen3D'
objects. Particles are emitted from position you choose, with speeds
and accelerations you choose. During their lifetime they age and change
as you choose.
Basic Structure
The following SCF class names are used (for CS_LOAD_PLUGIN()
):
-
Type plugin: `crystalspace.mesh.object.emit'
-
Loader plugin: `crystalspace.mesh.loader.emit'
-
Factory loader plugin: `crystalspace.mesh.loader.factory.emit'
Objects in this plugin implement the following SCF interfaces (acquire
with SCF_QUERY_INTERFACE()
):
-
MeshObject
-
Implements `iMeshObject'
-
Implements `iParticleState'
-
Implements `iEmitState'
-
MeshObjectFactory
-
Implements `iMeshObjectFactory'
-
Implements `iEmitFactoryState'
-
MeshObjectFactory
-
Implements `iMeshObjectType'
Factory State Interface
The factory state interface has methods to create new emitter objects,
that implement the `iEmitGen3D' interface. These objects return a random
3D x,y,z value. They are used to specify starting position, speed and
acceleration for the particles. Several exist:
iEmitFixed
- This emitter returns a fixed x,y,z value. Corresponds to a point in space,
a fixed speed, or fixed acceleration.
iEmitBox
- Returns a value with each component between a min and max. Corresponds to
points from a box in space. Use it to variate x,y,z for speed and
acceleration, or to get positions inside a box.
iEmitSphere
- Returns a point in a sphere. The center of the sphere and a min and max radius
must be given. The point is between the min and max radius from the center.
Thus you can generate points from a hollowed sphere if you like.
The points are evenly distributed across the entire volume of the sphere.
iEmitCone
- Returns a point inside a cone. Give a start point, aperture angle, azimuth
and elevation just like in the fountain particle system. The points are
chosen between a min and max distance from the origin.
iEmitMix
- The mix has a set of other `iEmitGen3D' objects, and samples a weighted
distribution from them. You can give some other emitgen3ds and a weight
for each one. Items with a heavier weight will be asked to return a
point more often.
For example, you could add several EmitLine objects to the mix, each
with a weight equal to its length. Then the mix will return points from
a random line, but those points will be evenly distributed in space.
iEmitLine
- Returns points from the line between start and end position.
iEmitCylinder
- Give the start and end of the middle line of the cylinder, the two end
points. Returns points between min and max radius from the middle line.
The points are evenly distributed in space. Also, when the start = end point,
points from a circle are returned.
iEmitSphereTangent
- The position point that is passed is used to compute a vector that is
tangential to a sphere, relative to given origin. Use it to give a speed
or acceleration tangential to a sphere. Speed is between min and max.
iEmitCylinderTangent
- The position point that is passed is used to compute a vector that is
tangential to a cylinder, relative to given start and end of the middle line.
Use it to give a speed or acceleration tangential to a cylinder. Speed is
between min and max.
Factory Loader
The emitter mesh factory loader has no parameters.
Object State Interface
`iEmitState' is the SCF interface that you can
use to set/get settings for a emitter object. The definition of this
interface can be found in `CS/include/imesh/emit.h' and that's also the
header file you need to include in your applications to use this plugin.
Using this interface you can access the number of particles, the size
of the particles, and various other emitter parameters.
You can set:
-
The number of particles
-
If particles are lighted
-
The time a particle lives, in msec (1/1000). This is the maximum age
of the particles.
-
The starting position `iEmitGen3D'.
-
The starting speed `iEmitGen3D'.
-
The starting acceleration `iEmitGen3D'.
-
The attractor `iEmitGen3D'. You can also leave this at NULL, and
no attractor is used. If given, each point is mysteriously attracted
to a point generated by the attractor `iEmitGen3D'.
-
The force of the attractor, higher means a faster acceleration
towards the attractor. Negative will repel.
-
The shape of the particles, either rectanguler (given width, height)
or regular shaped (given number of sides and radius).
-
Also a table a ages and settings can be given. The particles will
have their settings interpolated from the table in their lifetime.
At a particular time (in milliseconds), you can set the colour of the particle,
the alpha value of the particle (1=transparent), the swirliness of the
particle (it will jiggle around a bit), the rotationspeed (positive or
negative) in radians per second, and the scale (relative to the starting
scale) of the particle.
In addition you can use `iParticleState'.
Object Loader
Also see the general documentation for particle systems for other recognized
keywords. See section 7.8.9 Particle Systems in General.
RECTPARTICLES
- Set the width and height of the particles rectangular shape.
REGULARPARTICLES
- Set the number of sides and a radius of the regular shaped particles.
TOTALTIME
- Set the maximum age in milliseconds.
LIGHTING
- Disable or enable lighting for the particles
NUMBER
- Set the number of particles
STARTPOS
- Give an EMIT object for starting position.
STARTSPEED
- Give the starting speed EMIT.
STARTACCEL
- Give the starting acceleration EMIT.
ATTRACTORFORCE
- Give the attractor force value.
ATTRACTOR
- Give the EMIT that makes attracting points (per particle).
AGING
- Give a age time, colour red, colour green, colour blue, alpha, swirl,
rotationspeed and scale.
EMITFIXED
- Fixed (x, y, z) emitter.
EMITBOX
- Box emitter, min x,y,z, max x,y,z.
EMITSPHERE
- Sphere emitter, origin x,y,z, min, max.
EMITCONE
- Cone emitter, start x,y,z, elevation, azimuth, aperture, min,max radius.
EMITMIX
- Use several `EMITMIX' keywords in a row to create a mix with several
EMITs. Inside each `EMITMIX',
WEIGHT(value)
can be used to
set the weight.
EMITLINE
- Line emitter, start, end point.
EMITCYLINDER
- Cylinder emitter, start, end point, min, max distance.
EMITCYLINDERTANGENT
- CylinderTangent emitter. Give start, end point, min, max speed.
EMITSPHERETANGENT
- SphereTangent emitter. Give origin, min, max speed.
This document was generated
using texi2html