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
00033 class ParticleSysComponent : public SceneComponent
00034 {
00035 public:
00036
00037
00041 ParticleSysComponent(Entity *parent, const vector3df &scale = vector3df(1.0f, 1.0f, 1.0f));
00043 ~ParticleSysComponent();
00044
00045
00048 IParticleSystemSceneNode* getParticleSystemSceneNode();
00049
00053 void addAffector(IParticleAffector *affector);
00054
00075 void addAttractionAffector(const vector3df &point, f32 speed = 1.0f, bool attract = true,
00076 bool affectX = true, bool affectY = true, bool affectZ = true);
00077
00091 void addFadeOutParticleAffector(const SColor &targetColor = SColor(0, 0, 0, 0),
00092 u32 timeNeededToFadeOut = 1000);
00093
00107 void addGravityAffector(const vector3df &gravity = vector3df(0.0f,-0.03f, 0.0f),
00108 u32 timeForceLost = 1000);
00109
00122 void addRotationAffector(const vector3df &speed = vector3df(5.0f, 5.0f, 5.0f),
00123 const vector3df &pivotPoint = vector3df(0.0f, 0.0f, 0.0f));
00124
00136 void addScaleParticleAffector(const dimension2df &scaleTo = dimension2df(1.0f, 1.0f));
00137
00139 void removeAffectors();
00140
00143 IParticleEmitter* getEmitter();
00144
00170 void setAnimatedMeshSceneNodeEmitter(IAnimatedMeshSceneNode *node,
00171 bool useNormalDirection = true,
00172 const vector3df &direction = vector3df(0.0f, 0.03f, 0.0f),
00173 f32 normalDirectionModifier = 100.0f,
00174 bool everyMeshVertex = false,
00175 u32 minParticlesPerSecond = 5,
00176 u32 maxParticlesPerSecond = 10,
00177 const SColor &minStartColor = SColor(255, 0, 0, 0),
00178 const SColor &maxStartColor = SColor(255, 255, 255, 255),
00179 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000,
00180 s32 maxAngleDegrees = 0,
00181 const dimension2df &minStartSize = dimension2df(5.0f, 5.0f),
00182 const dimension2df &maxStartSize = dimension2df(5.0f, 5.0f));
00183
00215 void setBoxEmitter(const aabbox3df &box = aabbox3df(-10, 28,-10, 10, 30, 10),
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
00264 void setCylinderEmitter(const vector3df ¢er, f32 radius, const vector3df &normal,
00265 f32 length, bool outlineOnly = false,
00266 const vector3df &direction = vector3df(0.0f, 0.03f, 0.0f),
00267 u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
00268 const SColor &minStartColor = SColor(255, 0, 0, 0),
00269 const SColor &maxStartColor = SColor(255, 255, 255, 255),
00270 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000, s32 maxAngleDegrees = 0,
00271 const dimension2df &minStartSize = dimension2df(5.0f, 5.0f),
00272 const dimension2df &maxStartSize = dimension2df(5.0f, 5.0f));
00273
00276 void setEmitter(IParticleEmitter *emitter);
00277
00323 void setMeshEmitter(const std::string &fileName, bool useNormalDirection = true,
00324 const vector3df &direction = vector3df(0.0f, 0.03f, 0.0f),
00325 f32 normalDirectionModifier = 100.0f, bool everyMeshVertex = false,
00326 u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
00327 const SColor &minStartColor = SColor(255, 0, 0, 0),
00328 const SColor &maxStartColor = SColor(255, 255, 255, 255),
00329 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000, s32 maxAngleDegrees = 0,
00330 const dimension2df &minStartSize = dimension2df(5.0f, 5.0f),
00331 const dimension2df &maxStartSize = dimension2df(5.0f, 5.0f));
00357 void setMeshEmitter(IMesh *mesh, bool useNormalDirection = true,
00358 const vector3df &direction = vector3df(0.0f, 0.03f, 0.0f),
00359 f32 normalDirectionModifier = 100.0f, bool everyMeshVertex = false,
00360 u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
00361 const SColor &minStartColor = SColor(255, 0, 0, 0),
00362 const SColor &maxStartColor = SColor(255, 255, 255, 255),
00363 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000, s32 maxAngleDegrees = 0,
00364 const dimension2df &minStartSize = dimension2df(5.0f, 5.0f),
00365 const dimension2df &maxStartSize = dimension2df(5.0f, 5.0f));
00366
00396 void setPointEmitter(const vector3df &direction = vector3df(0.0f, 0.03f, 0.0f),
00397 u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
00398 const SColor &minStartColor = SColor(255, 0, 0, 0),
00399 const SColor &maxStartColor = SColor(255, 255, 255, 255),
00400 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000, s32 maxAngleDegrees = 0,
00401 const dimension2df &minStartSize = dimension2df(5.0f, 5.0f),
00402 const dimension2df &maxStartSize = dimension2df(5.0f, 5.0f));
00403
00441 void setRingEmitter(const vector3df ¢er, f32 radius, f32 ringThickness,
00442 const vector3df &direction = vector3df(0.0f, 0.03f, 0.0f),
00443 u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
00444 const SColor &minStartColor = SColor(255, 0, 0, 0),
00445 const SColor &maxStartColor = SColor(255, 255, 255, 255),
00446 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000, s32 maxAngleDegrees = 0,
00447 const dimension2df &minStartSize = dimension2df(5.0f, 5.0f),
00448 const dimension2df &maxStartSize = dimension2df(5.0f, 5.0f));
00449
00483 void setSphereEmitter(const vector3df ¢er, f32 radius,
00484 const vector3df &direction = vector3df(0.0f, 0.03f, 0.0f),
00485 u32 minParticlesPerSecond = 5, u32 maxParticlesPerSecond = 10,
00486 const SColor &minStartColor = SColor(255, 0, 0, 0),
00487 const SColor &maxStartColor = SColor(255, 255, 255, 255),
00488 u32 lifeTimeMin = 2000, u32 lifeTimeMax = 4000, s32 maxAngleDegrees = 0,
00489 const dimension2df &minStartSize = dimension2df(5.0f, 5.0f),
00490 const dimension2df &maxStartSize = dimension2df(5.0f, 5.0f));
00491
00494 void setParticlesAreGlobal(bool value = true);
00497 void setParticleSize(const dimension2df &size = dimension2df(5.0f, 5.0f));
00498
00499
00502 static bool parseXML(IXMLReader *file, Entity *entity);
00503
00504 private:
00505
00506
00507 IParticleSystemSceneNode *mParticleSystemSN;
00508 };
00509
00510 #endif