File: cs_208.html

package info (click to toggle)
crystalspace 0.94-20020412-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 62,276 kB
  • ctags: 52,843
  • sloc: cpp: 274,783; ansic: 6,608; perl: 6,276; objc: 3,952; asm: 2,942; python: 2,354; php: 542; pascal: 530; sh: 430; makefile: 370; awk: 193
file content (303 lines) | stat: -rw-r--r-- 11,905 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Created by texi2html 1.64 -->
<!-- 
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: Olaf Bachmann <obachman@mathematik.uni-kl.de>
Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
 
-->
<HTML>
<HEAD>
<TITLE>Crystal Space: MeshObject Emit</TITLE>

<META NAME="description" CONTENT="Crystal Space: MeshObject Emit">
<META NAME="keywords" CONTENT="Crystal Space: MeshObject Emit">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="texi2html 1.64">

</HEAD>

<BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">

<A NAME="SEC484"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_207.html#SEC478"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_209.html#SEC490"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_196.html#SEC414"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_201.html#SEC452"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_220.html#SEC543"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_285.html#SEC711">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<HR SIZE=1>
<H3> 7.8.7 Emitter Mesh Object </H3>
<!--docid::SEC484::-->
<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. See the general particle system documentation 
which is valid for all particle systems, for 
global options. See section <A HREF="cs_209.html#SEC490">7.8.8 Particle Systems in General</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><P>

<A NAME="SEC485"></A>
<H4> Basic Structure    </H4>
<!--docid::SEC485::-->
<P>

The following SCF class names are used (for <CODE>CS_LOAD_PLUGIN()</CODE>):
</P><P>

<UL>
<LI>
Type plugin: `<SAMP>crystalspace.mesh.object.emit</SAMP>'
<LI>
Loader plugin: `<SAMP>crystalspace.mesh.loader.emit</SAMP>'
<LI>
Factory loader plugin: `<SAMP>crystalspace.mesh.loader.factory.emit</SAMP>'
</UL>
<P>

Objects in this plugin implement the following SCF interfaces (acquire
with <CODE>SCF_QUERY_INTERFACE()</CODE>):
</P><P>

<UL>
<LI>
<EM>MeshObject</EM>
<UL>
<LI>
Implements `<SAMP>iMeshObject</SAMP>'
<LI>
Implements `<SAMP>iParticleState</SAMP>'
<LI>
Implements `<SAMP>iEmitState</SAMP>'
</UL>
<LI>
<EM>MeshObjectFactory</EM>
<UL>
<LI>
Implements `<SAMP>iMeshObjectFactory</SAMP>'
<LI>
Implements `<SAMP>iEmitFactoryState</SAMP>'
</UL>
<LI>
<EM>MeshObjectFactory</EM>
<UL>
<LI>
Implements `<SAMP>iMeshObjectType</SAMP>'
</UL>
</UL>
<P>

<A NAME="SEC486"></A>
<H4> Factory State Interface    </H4>
<!--docid::SEC486::-->
<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><P>

<DL COMPACT>
<DT><CODE>iEmitFixed</CODE>
<DD>This emitter returns a fixed x,y,z value. Corresponds to a point in space,
a fixed speed, or fixed acceleration.
<DT><CODE>iEmitBox</CODE>
<DD>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.
<DT><CODE>iEmitSphere</CODE>
<DD>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.
<DT><CODE>iEmitCone</CODE>
<DD>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.
<DT><CODE>iEmitMix</CODE>
<DD>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>

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.
<DT><CODE>iEmitLine</CODE>
<DD>Returns points from the line between start and end position.
<DT><CODE>iEmitCylinder</CODE>
<DD>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.
<DT><CODE>iEmitSphereTangent</CODE>
<DD>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.
<DT><CODE>iEmitCylinderTangent</CODE>
<DD>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.
</DL>
<P>

<A NAME="SEC487"></A>
<H4> Factory Loader    </H4>
<!--docid::SEC487::-->
<P>

The emitter mesh factory loader has no parameters.
</P><P>

<A NAME="SEC488"></A>
<H4> Object State Interface    </H4>
<!--docid::SEC488::-->
<P>

`<SAMP>iEmitState</SAMP>' 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 `<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><P>

<UL>
<LI>
The number of particles
<LI>
If particles are lighted
<LI>
The time a particle lives, in msec (1/1000). This is the maximum age 
of the particles.
<LI>
The starting position `<SAMP>iEmitGen3D</SAMP>'.
<LI>
The starting speed `<SAMP>iEmitGen3D</SAMP>'.
<LI>
The starting acceleration `<SAMP>iEmitGen3D</SAMP>'.
<LI>
The attractor `<SAMP>iEmitGen3D</SAMP>'. 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 `<SAMP>iEmitGen3D</SAMP>'. 
<LI>
The force of the attractor, higher means a faster acceleration
towards the attractor. Negative will repel.
<LI>
The shape of the particles, either rectanguler (given width, height)
or regular shaped (given number of sides and radius).
<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.
</UL>
<P>

In addition you can use `<SAMP>iParticleState</SAMP>'.
</P><P>

<A NAME="SEC489"></A>
<H4> Object Loader    </H4>
<!--docid::SEC489::-->
<P>

Also see the general documentation for particle systems for other recognized
keywords.  See section <A HREF="cs_209.html#SEC490">7.8.8 Particle Systems in General</A>.
</P><P>

<DL COMPACT>
<DT><CODE>RECTPARTICLES(width,height)</CODE>
<DD>Set the width and height of the particles rectangular shape.
<DT><CODE>REGULARPARTICLES(numSides,radius)</CODE>
<DD>Set the number of sides and a radius of the regular shaped particles.
<DT><CODE>TOTALTIME(totalTime)</CODE>
<DD>Set the maximum age in milliseconds.
<DT><CODE>LIGHTING(boolean)</CODE>
<DD>Disable or enable lighting for the particles
<DT><CODE>NUMBER(numberParticles)</CODE>
<DD>Set the number of particles
<DT><CODE>STARTPOS(<small>...</small>)</CODE>
<DD>Give an EMIT object for starting position.
<DT><CODE>STARTSPEED(<small>...</small>)</CODE>
<DD>Give the starting speed EMIT.
<DT><CODE>STARTACCEL(<small>...</small>)</CODE>
<DD>Give the starting acceleration EMIT.
<DT><CODE>ATTRACTORFORCE(force)</CODE>
<DD>Give the attractor force value.
<DT><CODE>ATTRACTOR(<small>...</small>)</CODE>
<DD>Give the EMIT that makes attracting points (per particle).
<DT><CODE>AGING(time,r,g,b,alpha,swirl,rotspeed,scale)</CODE>
<DD>Give a age time, colour red, colour green, colour blue, alpha, swirl, 
rotationspeed and scale. 
<DT><CODE>EMITFIXED(x,y,z)</CODE>
<DD>Fixed (x, y, z) emitter.
<DT><CODE>EMITBOX(minx,miny,minz,maxx,maxy,maxz)</CODE>
<DD>Box emitter, min x,y,z, max x,y,z.
<DT><CODE>EMITSPHERE(x,y,z,min,max)</CODE>
<DD>Sphere emitter, origin x,y,z, min, max.
<DT><CODE>EMITCONE(x,y,z,elevation,azimuth,aperture,minradius,maxradius)</CODE>
<DD>Cone emitter, start x,y,z, elevation, azimuth, aperture, min,max radius.
<DT><CODE>EMITMIX(<small>...</small>)</CODE>
<DD>Use several `<SAMP>EMITMIX</SAMP>' keywords in a row to create a mix with several
EMITs.  Inside each `<SAMP>EMITMIX</SAMP>', <CODE>WEIGHT(value)</CODE> can be used to
set the weight.
<DT><CODE>EMITLINE(x1,y1,z1,x2,y2,z2)</CODE>
<DD>Line emitter, start, end point.
<DT><CODE>EMITCYLINDER(x1,y1,z1,x2,y2,z2,mindist,maxdist)</CODE>
<DD>Cylinder emitter, start, end point, min, max distance.
<DT><CODE>EMITCYLINDERTANGENT(x1,y1,z1,x2,y2,z2,minspeed,maxspeed)</CODE>
<DD>CylinderTangent emitter. Give start, end point, min, max speed.
<DT><CODE>EMITSPHERETANGENT(x,y,z,minspeed,maxspeed)</CODE>
<DD>SphereTangent emitter. Give origin, min, max speed.
</DL>
<P>

<A NAME="MeshObject PartSys"></A>
<HR SIZE=1>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_207.html#SEC478"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_209.html#SEC490"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_196.html#SEC414"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_201.html#SEC452"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_220.html#SEC543"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_285.html#SEC711">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<BR>  
<FONT SIZE="-1">
This document was generated

using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>

</BODY>
</HTML>