<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> <!-- Created by texi2html 1.76 --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> Olaf Bachmann <obachman@mathematik.uni-kl.de> and many others. Maintained by: Many creative people <dev@texi2html.cvshome.org> Send bugs and suggestions to <users@texi2html.cvshome.org> --> <head> <title>Crystal Space 1.2.1: 4.10.17 Emitter Mesh Object</title> <meta name="description" content="Crystal Space 1.2.1: 4.10.17 Emitter Mesh Object"> <meta name="keywords" content="Crystal Space 1.2.1: 4.10.17 Emitter Mesh Object"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="texi2html 1.76"> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> <style type="text/css"> <!-- a.summary-letter {text-decoration: none} pre.display {font-family: serif} pre.format {font-family: serif} pre.menu-comment {font-family: serif} pre.menu-preformatted {font-family: serif} pre.smalldisplay {font-family: serif; font-size: smaller} pre.smallexample {font-size: smaller} pre.smallformat {font-family: serif; font-size: smaller} pre.smalllisp {font-size: smaller} span.sansserif {font-family:sans-serif; font-weight:normal;} ul.toc {list-style: none} --> </style> </head> <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> <a name="MeshObject-Emit"></a> <a name="0"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="MeshObject-Spr3D.html#0" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="MeshObject-Haze.html#0" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="Using-Crystal-Space.html#0" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="MeshObject.html#0" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="Working-with-Engine-Content.html#0" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="index.html#SEC_Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="cs_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="cs_Index.html#0" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="cs_abt.html#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <hr size="1"> <h3 class="subsection"> 4.10.17 Emitter Mesh Object </h3> <p><em>Written by Wouter Wijngaards, <a href="mailto:wouterw@cs.vu.nl">wouterw@cs.vu.nl</a>.</em> </p> <p>An emitter particle system is a very general particle system, that can do a variety of things. It is considered mostly deprecated and if possible you should use the new particle system instead. In the future we will extend the new particles mesh object so that all features of emit are supported. See section <a href="MeshObject-Particles.html#0">Particles Mesh Object</a>. </p> <p>The emitter can be customized to a high degree, using the <samp>‘iEmitGen3D’</samp> objects. Particles are emitted from position you choose, with speeds and accelerations you choose. During their lifetime they age and change as you choose. </p> <a name="1"></a> <h4 class="subsubheading"> Basic Structure </h4> <p>The following <small>SCF</small> class names are used (for <code>csLoadPlugin</code>): </p> <ul> <li> Type plugin: <samp>‘crystalspace.mesh.object.emit’</samp> </li><li> Loader plugin: <samp>‘crystalspace.mesh.loader.emit’</samp> </li><li> Factory loader plugin: <samp>‘crystalspace.mesh.loader.factory.emit’</samp> </li></ul> <p>Objects in this plugin implement the following <small>SCF</small> interfaces (acquire with <code>scfQueryInterface</code>): </p> <ul> <li> <em>MeshObject</em> <ul> <li> Implements <samp>‘iMeshObject’</samp> </li><li> Implements <samp>‘iParticleState’</samp> </li><li> Implements <samp>‘iEmitState’</samp> </li></ul> </li><li> <em>MeshObjectFactory</em> <ul> <li> Implements <samp>‘iMeshObjectFactory’</samp> </li><li> Implements <samp>‘iEmitFactoryState’</samp> </li></ul> </li><li> <em>MeshObjectFactory</em> <ul> <li> Implements <samp>‘iMeshObjectType’</samp> </li></ul> </li></ul> <a name="2"></a> <h4 class="subsubheading"> Factory State Interface </h4> <p>The factory state interface has methods to create new emitter objects, that implement the <samp>‘iEmitGen3D’</samp> 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: </p> <dl compact="compact"> <dt> <code>iEmitFixed</code></dt> <dd><p>This emitter returns a fixed x,y,z value. Corresponds to a point in space, a fixed speed, or fixed acceleration. </p> </dd> <dt> <code>iEmitBox</code></dt> <dd><p>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. </p> </dd> <dt> <code>iEmitSphere</code></dt> <dd><p>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. </p> </dd> <dt> <code>iEmitCone</code></dt> <dd><p>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. </p> </dd> <dt> <code>iEmitMix</code></dt> <dd><p>The mix has a set of other <samp>‘iEmitGen3D’</samp> 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. </p> <p>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. </p> </dd> <dt> <code>iEmitLine</code></dt> <dd><p>Returns points from the line between start and end position. </p> </dd> <dt> <code>iEmitCylinder</code></dt> <dd><p>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. </p> </dd> <dt> <code>iEmitSphereTangent</code></dt> <dd><p>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. </p> </dd> <dt> <code>iEmitCylinderTangent</code></dt> <dd><p>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. </p></dd> </dl> <a name="3"></a> <h4 class="subsubheading"> Factory Loader </h4> <p>The emitter mesh factory loader has no parameters. </p> <a name="4"></a> <h4 class="subsubheading"> Object State Interface </h4> <p><samp>‘iEmitState’</samp> is the <small>SCF</small> interface that you can use to set/get settings for a emitter object. The definition of this interface can be found in <tt>‘CS/include/imesh/emit.h’</tt> 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: </p> <ul> <li> The number of particles </li><li> If particles are lighted </li><li> The time a particle lives, in msec (1/1000). This is the maximum age of the particles. </li><li> The starting position <samp>‘iEmitGen3D’</samp>. </li><li> The starting speed <samp>‘iEmitGen3D’</samp>. </li><li> The starting acceleration <samp>‘iEmitGen3D’</samp>. </li><li> The attractor <samp>‘iEmitGen3D’</samp>. You can also leave this at <small>NULL</small>, and no attractor is used. If given, each point is mysteriously attracted to a point generated by the attractor <samp>‘iEmitGen3D’</samp>. </li><li> The force of the attractor, higher means a faster acceleration towards the attractor. Negative will repel. </li><li> The shape of the particles, either rectangular (given width, height) or regular shaped (given number of sides and radius). </li><li> 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. </li></ul> <p>In addition you can use <samp>‘iParticleState’</samp>. </p> <a name="5"></a> <h4 class="subsubheading"> Object Loader </h4> <dl compact="compact"> <dt> <code><rectparticles w="" h="" /></code></dt> <dd><p>Set the width and height of the particles rectangular shape. </p></dd> <dt> <code><regularparticles sides="" radius="" /></code></dt> <dd><p>Set the number of sides and a radius of the regular shaped particles. </p></dd> <dt> <code><totaltime>milliseconds</totaltime></code></dt> <dd><p>Set the maximum age in milliseconds. </p></dd> <dt> <code><lighting>yes/no</lighting></code></dt> <dd><p>Disable or enable lighting for the particles </p></dd> <dt> <code><number>numberparticles</number></code></dt> <dd><p>Set the number of particles </p></dd> <dt> <code><startpos> <small class="dots">...</small></code></dt> <dd><p>Give an <small>EMIT</small> object for starting position. </p></dd> <dt> <code><startspeed> <small class="dots">...</small></code></dt> <dd><p>Give the starting speed <small>EMIT</small>. </p></dd> <dt> <code><startaccel> <small class="dots">...</small></code></dt> <dd><p>Give the starting acceleration <small>EMIT</small>. </p></dd> <dt> <code><attractorforce>forcevalue</attractorforce></code></dt> <dd><p>Give the attractor force value. </p></dd> <dt> <code><attractor> <small class="dots">...</small></code></dt> <dd><p>Give the <small>EMIT</small> that makes attracting points (per particle). </p></dd> <dt> <code><aging> <small class="dots">...</small></code></dt> <dd><table><tr><td> </td><td><pre class="example"><aging> <color red="" green="" blue="" /> <time>time</time> <alpha>alpha</alpha> <swirl>swirl</swirl> <rotspeed>rotspeed</rotspeed> <scale>scale</scale> </aging> </pre></td></tr></table><p>Give a colour red, colour green, colour blue, age time, alpha, swirl, rotationspeed and scale. </p></dd> <dt> <code><emitfixed x="" y="" z="" /></code></dt> <dd><p>Fixed (x, y, z) emitter. </p></dd> <dt> <code><emitbox> <small class="dots">...</small></code></dt> <dd><p>Box emitter, min x,y,z, max x,y,z. </p><table><tr><td> </td><td><pre class="example"><emitbox> <min x="" y="" z="" /> <max x="" y="" z="" /> </emitbox> </pre></td></tr></table></dd> <dt> <code><emitsphere x="" y="" z="" p="" q="" r="" /></code></dt> <dd><p>Sphere emitter, origin x,y,z, min, max. </p></dd> <dt> <code><emitcone x="" y="" z="" p="" q="" r="" s="" t="" /></code></dt> <dd><p>Cone emitter, start x,y,z, elevation, azimuth, aperture, min,max radius. </p></dd> <dt> <code><emitmix> <small class="dots">...</small></code></dt> <dd><p>Use several <samp>‘emitmix’</samp> keywords in a row to create a mix with several <small>EMIT</small>s. Inside each <samp>‘emitmix’</samp>, <code>WEIGHT(value)</code> can be used to set the weight. </p></dd> <dt> <code><emitline></code></dt> <dd><p>Line emitter, start, end point. </p><table><tr><td> </td><td><pre class="example"><emitline> <min x="" y="" z="" /> <max x="" y="" z="" /> </emitline> </pre></td></tr></table></dd> <dt> <code><emitcylinder p="" q="" /></code></dt> <dd><p>Cylinder emitter, min, max distance, start, end point. </p><table><tr><td> </td><td><pre class="example"><emitcylinder> <min x="" y="" z="" /> <max x="" y="" z="" /> </emitcylinder> </pre></td></tr></table></dd> <dt> <code><emitcylindertangent p="" q="" /></code></dt> <dd><p>CylinderTangent emitter. Give start, end point, min, max speed. </p><table><tr><td> </td><td><pre class="example"><emitcylindertangent> <min x="" y="" z="" /> <max x="" y="" z="" /> </emitcylindertangent> </pre></td></tr></table></dd> <dt> <code><emitspheretangent p="" q="" /></code></dt> <dd><p>SphereTangent emitter. Give origin, min, max speed. </p><table><tr><td> </td><td><pre class="example"><emitspheretangent> <min x="" y="" z="" /> <max x="" y="" z="" /> </emitspheretangent> </pre></td></tr></table></dd> </dl> <hr size="1"> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="MeshObject-Spr3D.html#0" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="MeshObject-Haze.html#0" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="Using-Crystal-Space.html#0" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="MeshObject.html#0" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="Working-with-Engine-Content.html#0" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="index.html#SEC_Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="cs_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="cs_Index.html#0" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="cs_abt.html#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <p> <font size="-1"> This document was generated using <a href="http://texi2html.cvshome.org/"><em>texi2html 1.76</em></a>. </font> <br> </p> </body> </html>