00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __PARTICLESYSCOMPONENT_H__
00017 #define __PARTICLESYSCOMPONENT_H__
00018
00019
00020 #include "../../dependencies.h"
00021 #include "SceneComponent.h"
00022
00023
00024
00026 class ParticleSysComponent : public SceneComponent
00027 {
00028 public:
00029
00030
00035 ParticleSysComponent(Entity *parent, const vector3df &rotation = vector3df(0, 0, 0),
00036 const vector3df &scale = vector3df(1.0f, 1.0f, 1.0f));
00038 ~ParticleSysComponent();
00039
00040
00043 static ParticleSysComponent* refFactory(Entity *parent, const vector3df &rotation,
00044 const vector3df &scale);
00045
00046
00049 IParticleSystemSceneNode* getParticleSystemSceneNode();
00050
00054 void addAffector(IParticleAffector *affector);
00055
00063 void addAttractionAffector(const vector3df &point, f32 speed = 1.0f, bool attract = true,
00064 bool affectX = true, bool affectY = true, bool affectZ = true);
00065
00070 void addFadeOutParticleAffector(const SColor &targetColor = SColor(0, 0, 0, 0),
00071 u32 timeNeededToFadeOut = 1000);
00072
00077 void addGravityAffector(const vector3df &gravity = vector3df(0.0f,-0.03f, 0.0f),
00078 u32 timeForceLost = 1000);
00079
00083 void addRotationAffector(const vector3df &speed = vector3df(5.0f, 5.0f, 5.0f),
00084 const vector3df &pivotPoint = vector3df(0.0f, 0.0f, 0.0f));
00085
00089 void addScaleParticleAffector(const dimension2df &scaleTo = dimension2df(1.0f, 1.0f));
00090
00092 void removeAffectors();
00093
00096 IParticleEmitter* getEmitter();
00097
00122 void setAnimatedMeshSceneNodeEmitter(const std::string &fileName,
00123 bool useNormalDirection = true,
00124 const vector3df &direction = vector3df(0.0f, 0.03f, 0.0f),
00125 f32 normalDirectionModifier = 100.0f,
00126 bool everyMeshVertex = false,
00127 u32 minParticlesPerSecond = 5,
00128 u32 maxParticlesPerSecond = 10,
00129 const SColor &minStartColor = SColor(255, 0, 0, 0),
00130 const SColor &maxStartColor = SColor(255, 255, 255, 255),
00131 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000,
00132 s32 maxAngleDegrees = 0,
00133 const dimension2df &minStartSize = dimension2df(5.0f, 5.0f),
00134 const dimension2df &maxStartSize = dimension2df(5.0f, 5.0f));
00160 void setAnimatedMeshSceneNodeEmitter(IAnimatedMeshSceneNode *node,
00161 bool useNormalDirection = true,
00162 const vector3df &direction = vector3df(0.0f, 0.03f, 0.0f),
00163 f32 normalDirectionModifier = 100.0f,
00164 bool everyMeshVertex = false,
00165 u32 minParticlesPerSecond = 5,
00166 u32 maxParticlesPerSecond = 10,
00167 const SColor &minStartColor = SColor(255, 0, 0, 0),
00168 const SColor &maxStartColor = SColor(255, 255, 255, 255),
00169 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000,
00170 s32 maxAngleDegrees = 0,
00171 const dimension2df &minStartSize = dimension2df(5.0f, 5.0f),
00172 const dimension2df &maxStartSize = dimension2df(5.0f, 5.0f));
00173
00187 void setBoxEmitter(const aabbox3df &box = aabbox3df(-10, 28,-10, 10, 30, 10),
00188 const vector3df &direction = vector3df(0.0f, 0.03f, 0.0f),
00189 u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
00190 const SColor &minStartColor = SColor(255, 0, 0, 0),
00191 const SColor &maxStartColor = SColor(255, 255, 255, 255),
00192 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000, s32 maxAngleDegrees = 0,
00193 const dimension2df &minStartSize = dimension2df(5.0f, 5.0f),
00194 const dimension2df &maxStartSize = dimension2df(5.0f, 5.0f));
00195
00214 void setCylinderEmitter(const vector3df ¢er, f32 radius, const vector3df &normal,
00215 f32 length, bool outlineOnly = false,
00216 const vector3df &direction = vector3df(0.0f, 0.03f, 0.0f),
00217 u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
00218 const SColor &minStartColor = SColor(255, 0, 0, 0),
00219 const SColor &maxStartColor = SColor(255, 255, 255, 255),
00220 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000, s32 maxAngleDegrees = 0,
00221 const dimension2df &minStartSize = dimension2df(5.0f, 5.0f),
00222 const dimension2df &maxStartSize = dimension2df(5.0f, 5.0f));
00223
00226 void setEmitter(IParticleEmitter *emitter);
00227
00252 void setMeshEmitter(const std::string &fileName, bool useNormalDirection = true,
00253 const vector3df &direction = vector3df(0.0f, 0.03f, 0.0f),
00254 f32 normalDirectionModifier = 100.0f, bool everyMeshVertex = false,
00255 u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
00256 const SColor &minStartColor = SColor(255, 0, 0, 0),
00257 const SColor &maxStartColor = SColor(255, 255, 255, 255),
00258 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000, s32 maxAngleDegrees = 0,
00259 const dimension2df &minStartSize = dimension2df(5.0f, 5.0f),
00260 const dimension2df &maxStartSize = dimension2df(5.0f, 5.0f));
00286 void setMeshEmitter(IMesh *mesh, bool useNormalDirection = true,
00287 const vector3df &direction = vector3df(0.0f, 0.03f, 0.0f),
00288 f32 normalDirectionModifier = 100.0f, bool everyMeshVertex = false,
00289 u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
00290 const SColor &minStartColor = SColor(255, 0, 0, 0),
00291 const SColor &maxStartColor = SColor(255, 255, 255, 255),
00292 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000, s32 maxAngleDegrees = 0,
00293 const dimension2df &minStartSize = dimension2df(5.0f, 5.0f),
00294 const dimension2df &maxStartSize = dimension2df(5.0f, 5.0f));
00295
00308 void setPointEmitter(const vector3df &direction = vector3df(0.0f, 0.03f, 0.0f),
00309 u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
00310 const SColor &minStartColor = SColor(255, 0, 0, 0),
00311 const SColor &maxStartColor = SColor(255, 255, 255, 255),
00312 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000, s32 maxAngleDegrees = 0,
00313 const dimension2df &minStartSize = dimension2df(5.0f, 5.0f),
00314 const dimension2df &maxStartSize = dimension2df(5.0f, 5.0f));
00315
00333 void setRingEmitter(const vector3df ¢er, f32 radius, f32 ringThickness,
00334 const vector3df &direction = vector3df(0.0f, 0.03f, 0.0f),
00335 u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
00336 const SColor &minStartColor = SColor(255, 0, 0, 0),
00337 const SColor &maxStartColor = SColor(255, 255, 255, 255),
00338 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000, s32 maxAngleDegrees = 0,
00339 const dimension2df &minStartSize = dimension2df(5.0f, 5.0f),
00340 const dimension2df &maxStartSize = dimension2df(5.0f, 5.0f));
00341
00356 void setSphereEmitter(const vector3df ¢er, f32 radius,
00357 const vector3df &direction = vector3df(0.0f, 0.03f, 0.0f),
00358 u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
00359 const SColor &minStartColor = SColor(255, 0, 0, 0),
00360 const SColor &maxStartColor = SColor(255, 255, 255, 255),
00361 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000, s32 maxAngleDegrees = 0,
00362 const dimension2df &minStartSize = dimension2df(5.0f, 5.0f),
00363 const dimension2df &maxStartSize = dimension2df(5.0f, 5.0f));
00364
00367 void setParticlesAreGlobal(bool value = true);
00370 void setParticleSize(const dimension2df &size = dimension2df(5.0f, 5.0f));
00371
00372 private:
00373
00374
00375 IParticleSystemSceneNode *mParticleSystemSN;
00376 };
00377
00378
00379
00381 extern void bindParticleSysComponent(asIScriptEngine *engine);
00382
00383 #endif