170 lines
14 KiB
C++
170 lines
14 KiB
C++
/////////////////////////////////////////////////////
|
|
/////////////////////////////////////////////////////
|
|
//
|
|
// PointParticleSystem
|
|
//
|
|
/////////////////////////////////////////////////////
|
|
/////////////////////////////////////////////////////
|
|
|
|
CKObjectDeclaration *od = CreateCKObjectDeclaration("Particle Systems");
|
|
od->SetDescription("Emits particles from a point");
|
|
od->SetType( CKDLL_BEHAVIORPROTOTYPE);
|
|
od->SetGuid(POINTSYSTEM_GUID);
|
|
od->SetIconIndex(32);
|
|
od->SetAuthorGuid(VIRTOOLS_GUID);
|
|
od->SetAuthorName("Virtools");
|
|
od->SetVersion(0x00010000);
|
|
od->SetCreationFunction(CreateGeneralParticleSystemProto);
|
|
od->SetCompatibleClassId(CKCID_3DENTITY);
|
|
od->SetCategory("Particles");
|
|
/* rem:
|
|
<FONT COLOR=#a03030>On: </FONT>activates the behavior.<BR>
|
|
<FONT COLOR=#a03030>Off: </FONT>disables the behavior.<BR>
|
|
<BR>
|
|
<FONT COLOR=#a03030>Exit On: </FONT>is activated when the behavior's process is activated.<BR>
|
|
<FONT COLOR=#a03030>Exit Off: </FONT>is activated when the behavior's process is disabled.<BR>
|
|
<BR><FONT SIZE="2"> Parameters: </FONT><BR>
|
|
<BR>
|
|
<FONT COLOR=#000077>Emission Delay: </FONT>Time (in ms) to wait before the next particles' emission. 0 means each frame.<BR>
|
|
<FONT COLOR=#000077>Emission Delay Variance: </FONT>Modification of the preceding parameter, +/- its value.<BR>
|
|
<FONT COLOR=#000077>Yaw Variance: </FONT>Max opening angle in the XZ plane. Particles will be given a direction having an angle in this plane between 0 and this value from the Z direction of the emitter.<BR>
|
|
<FONT COLOR=#000077>Pitch Variance: </FONT>Max opening angle in the ZY plane. Particles will be given a direction having an angle in this plane between 0 and this value from the Z direction of the emitter.<BR>
|
|
<FONT COLOR=#000077>Speed: </FONT>Speed of the particle representing the actual distance they cover in 1 ms.<BR>
|
|
<FONT COLOR=#000077>Speed Variance: </FONT>Modification of the preceding parameter, +/- its value.<BR>
|
|
<FONT COLOR=#000077>Angular Speed: </FONT>Angular Speed of the particle representing the actual angle in radians they cover in 1 ms. (used for Sprite and Object Rendering Mode.)<BR>
|
|
<FONT COLOR=#000077>Angular Speed Variance: </FONT>Modification of the preceding parameter, +/- its value.<BR>
|
|
<FONT COLOR=#000077>Spreading: </FONT>Multiplicative Factor applied to the length of the sprites. (used for Oriented Sprite only.)<BR>
|
|
<FONT COLOR=#000077>Spreading Variation: </FONT>Modification of the preceding parameter, +/- its value.<BR>
|
|
<FONT COLOR=#000077>Lifespan: </FONT> The lifespan of a particle (in ms).<BR>
|
|
<FONT COLOR=#000077>Lifespan Variance: </FONT> The random variance of the lifespan (in ms) of individual particles, +/- lifespan value. ie : With a lifespan of 100, a lifespan variance of 15 means a particle may have a lifespan anywhere from 85 to 115 ms.<BR>
|
|
<FONT COLOR=#000077>Maximum Number: </FONT> Maximum number of particles displayed in the same frame. This number is limited by the Total Number Allocated in the Settings (100 by default), and must be changed there if you wish to override it.<BR>
|
|
<FONT COLOR=#000077>Emission: </FONT> The number of particles launched at each emission.<BR>
|
|
<FONT COLOR=#000077>Emission Variance: </FONT>Modification of the preceding parameter, +/- its value.<BR>
|
|
<FONT COLOR=#000077>Initial Size: </FONT> The initial size of the Particle (used in (Orientable)Sprite and Object Rendering Mode).<BR>
|
|
<FONT COLOR=#000077>Initial Size Variance: </FONT>Modification of the preceding parameter, +/- its value.<BR>
|
|
<FONT COLOR=#000077>Ending Size: </FONT> The ending size of the Particle (used in (Orientable)Sprite and Object Rendering Mode).<BR>
|
|
<FONT COLOR=#000077>Ending Size Variance: </FONT>Modification of the preceding parameter, +/- its value.<BR>
|
|
<FONT COLOR=#000077>Bounce: </FONT> The bouncing factor of the Particle (used when Deflectors are present.).<BR>
|
|
<FONT COLOR=#000077>Bounce Variance: </FONT>Modification of the preceding parameter, +/- its value.<BR>
|
|
<FONT COLOR=#000077>Weight: </FONT> The weight of the Particle (used when Gravity Interactor is present.).<BR>
|
|
<FONT COLOR=#000077>Weight Variance: </FONT>Modification of the preceding parameter, +/- its value.<BR>
|
|
<FONT COLOR=#000077>Surface: </FONT> The surface of the Particle (used when Wind or Atmosphere Interactors are present.).<BR>
|
|
<FONT COLOR=#000077>Surface Variance: </FONT>Modification of the preceding parameter, +/- its value.<BR>
|
|
<FONT COLOR=#000077>Initial Color: </FONT> The initial Color of the Particle.<BR>
|
|
<FONT COLOR=#000077>Initial Color Variance: </FONT>Modification of the preceding parameter, +/- its value.<BR>
|
|
<FONT COLOR=#000077>Ending Color: </FONT> The ending Color of the Particle.<BR>
|
|
<FONT COLOR=#000077>Ending Color Variance: </FONT>Modification of the preceding parameter, +/- its value.<BR>
|
|
<FONT COLOR=#000077>Texture: </FONT> The texture (or texture suite) of the Particle.<BR>
|
|
<FONT COLOR=#000077>Initial Texture Frame: </FONT> The initial Texture animation frame of the Particle.<BR>
|
|
<FONT COLOR=#000077>Initial Texture Frame Variance: </FONT>Modification of the preceding parameter, +/- its value.<BR>
|
|
<FONT COLOR=#000077>Texture Speed: </FONT> The speed, in ms, at which the frames are proceeded in the animation.<BR>
|
|
<FONT COLOR=#000077>Texture Speed Variance: </FONT>Modification of the preceding parameter, +/- its value.<BR>
|
|
<FONT COLOR=#000077>Texture Frame Count: </FONT> The number of animation frames included in your texture (it must be disposed in 2x2, 3x3, etc... but you don't have to use all the space in the texture (a 7 frame animation will be included in a texture of 3x3 frames).<BR>
|
|
<FONT COLOR=#000077>Texture Loop: </FONT>Specifies how the animation progress. Looping or not, or Ping-Pong (back and forth)?.<BR>
|
|
<BR>
|
|
<FONT SIZE="2"> Settings : </FONT>
|
|
<BR>
|
|
|
|
<BR>
|
|
<FONT COLOR=#006600>Total Number : </FONT>The total number of particles allocated in memory.<BR>
|
|
<FONT COLOR=#006600>Particle Rendering : </FONT>The rendering mode used for the particles.<BR>
|
|
<blockquote>
|
|
Point : draw 1 pixel points at the particle place.<BR>
|
|
Line : draw 1 pixel thin line connecting current particle position to last frame particle position.<BR>
|
|
Sprite : render a 3D Sprite at the particle place.<BR>
|
|
Object : render a 3d object chosen randomly in the following group at the particle place.<BR>
|
|
Oriented Sprite : render a stretched 3d sprite connecting current particle position to last frame particle position.<BR>
|
|
Radial Sprite : render a stretched 3d sprite connecting the center of world to the current particle position.<BR>
|
|
</blockquote>
|
|
<FONT COLOR=#006600>Source Blend : </FONT>The source blending mode of the sprite or object. see Materials/Basic/Set Src Blend.<BR>
|
|
<FONT COLOR=#006600>Dest Blend : </FONT>The destination blending mode of the sprite or object. see Materials/Basic/Set Src Blend.<BR>
|
|
<FONT COLOR=#006600>Group of Objects : </FONT>Group of 3D objects to render (in Object Rendering Mode).<BR>
|
|
<FONT COLOR=#006600>Evolutions : </FONT>This flags determine if you want the particles to evolve over the time, in Color, in Size or in Texture. Disabling unused evolutions make the system faster.<BR>
|
|
<FONT COLOR=#006600>Variances : </FONT>This flags determine if you want to take in account the variances for the following parameters : Speed, Angular Speed, Lifespan, Emission, Initial Size, Ending Size, Bounce, Weight, Surface, Initial Color, Ending Color, Initial Texture, Ending Texture.<BR>
|
|
<FONT COLOR=#006600>Manage Deflectors : </FONT>This flags determine which type of deflectors you wish to take into account for this particle system. See Deflectors sections below for a complete description of them.<BR>
|
|
<FONT COLOR=#006600>Message To Deflectors : </FONT>The message you wish to send to the deflectors touched (one message sent per object per frame maximum).<BR>
|
|
<FONT COLOR=#006600>Manage Interactors : </FONT>This flags determine which type of interactors you wish to take into account for this particle system. See Interactors sections below for a complete description of them.<BR>
|
|
<FONT COLOR=#006600>Interactors/Deflectors Display : </FONT>Choose if you want to see the Deflectors/Interactors line meshes.<BR>
|
|
|
|
<p>
|
|
<FONT SIZE="2"> Interactors : </FONT><BR>
|
|
|
|
Interactors are object <B>attributes</B> that create an influence over particle systems. The first two interactors can be applied to any object you want, even a scene or a texture; otherwise they are applied to frames<BR>
|
|
<p>
|
|
<FONT COLOR=#000077>Atmosphere: </FONT>The atmosphere interactor is used to brake the particles, as if there was an air resistance. The equation used is :
|
|
<FONT SIZE=2><pre>(new particle direction) = (particle direction) - (particle direction)*atmosphereforce*(particle surface)</pre></FONT>
|
|
You are supposed to use only one atmosphere interactor per scene but if you use more than one, their effect will be cumulative...<BR>
|
|
</p>
|
|
<p>
|
|
<FONT COLOR=#000077>Gravity: </FONT>The gravity interactor simulates the earth attraction. The equation used is :
|
|
<FONT SIZE=2><pre>(new particle direction).y = (particle direction).y + gravityforce*(particle weight)</pre></FONT>
|
|
You'll have to use a negative number in the gravity force to make the particle fall down, but you can also reverse the gravity by using positive number.
|
|
You are supposed to use only one gravity interactor per scene but if you use more than one, their effect will be cumulative...<BR>
|
|
</p>
|
|
<p>
|
|
<B>The following interactors are to be used on frames only.</B><BR>
|
|
<BR>
|
|
<FONT COLOR=#000077>Global Wind: </FONT>The Global Wind interactor simulates a wind blowing the particles away, from wherever they are in the Z local axis direction of the frame, ie the interactor owner. The equation used is :
|
|
<FONT SIZE=2><pre>(new particle direction) = (particle direction) + (wind Z direction)*windforce*(particle surface)</pre></FONT>
|
|
A negative wind force will make the particle go into the wind.
|
|
You can use as many global wind attributes as you like, their effect will be cumulative...<BR>
|
|
</p>
|
|
<p>
|
|
<FONT COLOR=#000077>Local Wind: </FONT>The Local Wind interactor simulates a wind blowing the particles away, only when they are in the cylinder which have the X and Y axis of the interactor owner as basis, in the Z local axis direction of the interactor owner. The equation used is :
|
|
<FONT SIZE=2><pre>(new particle direction) = (particle direction) + attenuation*(wind Z direction)*windforce*(particle surface)
|
|
with : attenuation = 1/(1+(particle distance form the emitter basis)*decayforce</pre></FONT>
|
|
A negative wind force will make the particle go back the wind direction. The higher the decay force, the less the particles will be affected by the interactor when they are away from it.<BR>
|
|
</p>
|
|
<p>
|
|
<FONT COLOR=#000077>Magnet: </FONT>The Magnet interactor simulates a magnet attracting (or repulsing) the particles away, according to their distance. The equation used is :
|
|
<FONT SIZE=2><pre>t = 1 + SquareDistance((particle position) - (magnet position))
|
|
(new particle position) = (magnet position) + ((particle position) - (magnet position))*(t/(t+magnetforce))</pre></FONT>
|
|
The nearer are the particles, the faster they move. The greater the force is, the faster they move too.
|
|
A negative magnet force will repulse the particle.<BR>
|
|
</p>
|
|
<p>
|
|
<FONT COLOR=#000077>Vortex: </FONT>The Vortex interactor simulates a vortex field making the particles turn on its axis, with their speed according to their distance. The equation used is :
|
|
<FONT SIZE=2><pre>t = 1/(1 + SquareDistance((particle position) - (vortex position)))
|
|
(new particle position) = Rotate((particle position),(around vortex position),t*xforce,t*yforce,t*zforce)</pre></FONT>
|
|
The nearer are the particles from an axis, the faster they rotate. The greater the force is, the faster they rotate too.
|
|
A negative force will make the particle turn counterclockwise.<BR>
|
|
</p>
|
|
<p>
|
|
<FONT COLOR=#000077>Disruption Box: </FONT>The Disruption Box interactor simulates a volume which disturb the particle direction.The equation used is :
|
|
<FONT SIZE=2><pre>if(particle in box) (new particle direction) = (particle direction) + boxdisruptionforce*(random point in box - (particle position))</pre></FONT>
|
|
The greater the force is, the faster the particles will move away.<BR>
|
|
</p>
|
|
<p>
|
|
<FONT COLOR=#000077>Mutation Box: </FONT>The Mutation Box interactor allows particle penetrating its volume to mutates in size, color and texture.
|
|
You can also choose the speed at which it will mutate. The greater the speed is, the faster the particles will reach its new form.
|
|
</p>
|
|
<FONT COLOR=#000077>Tunnel: </FONT>The Tunnel interactor conduct particles nearby thru the tunnel, accelerating or decelerating them.
|
|
You can set the velocity aimed by the particles travelling in the tunnel, the absorption radius of the tunnel, the attraction shape modifies the force of the attraction,
|
|
the attraction speed, and finally the attraction direction which represent a force modifying the direction of the particle itself.
|
|
</p>
|
|
|
|
</p>
|
|
<p>
|
|
<FONT SIZE=2> Deflectors : </FONT><BR><BR>
|
|
Deflectors are <B>attributes</B> applied to frames or objects that create obstacles for particle systems. For each particle, we test if between the last frame and the current frame, it touched an obstacle and,
|
|
if so, we change its direction and position according to the following equation :
|
|
<FONT SIZE=2><pre>
|
|
dp = (particle direction).(impact normal)
|
|
(new particle direction) = ( (particle direction)-(impact normal)*dp ) * (deflector friction) + (impact normal)*dp*(particle bounce)*(deflector response)
|
|
</pre></FONT>
|
|
|
|
<p>
|
|
<FONT COLOR=#000077>Object Deflector: </FONT>The Object deflector attribute is to be applied on a 3DEntity with a mesh and define it as an obstacle for the particles.
|
|
The more faces the object has, the slower the processing will be... So don't abuse it.
|
|
</p>
|
|
<p>
|
|
<FONT COLOR=#000077>Other Deflectors: </FONT>The Plane, Infinite Plane, Cylinder, Sphere, Box deflectors are applied to <B>frames</B> and can be geometrically changed by applying
|
|
(non)uniform scale on the frame. A line mesh representing the deflectors shape is created to help you visualize it.
|
|
</p>
|
|
|
|
</p>
|
|
*/
|
|
|
|
return od;
|
|
}
|