hello jox,
you will see a difference if the orientation of the particle system node is different from world orientation.
here is an example (direct copy paste from my code):
Code: Select all
scene::IParticleSystemSceneNode* ps = 0;
ps = smgr->addParticleSystemSceneNode(false,(ISceneNode*)((*(++listCar.begin()))->getNode())); // you can attach it directly to rootscenenode
//ps->setPosition(core::vector3df(50,50,50));
//ps->setScale(core::vector3df(2,2,2));
ps->setParticleSize(core::dimension2d<f32>(20.0f, 20.0f));
scene::IParticleEmitter* em = ps->createBoxEmitter(
core::aabbox3d<f32>(-7,0,-7,7,1,7),
core::vector3df(0.1f,0.01f,0.0f), // here is the emitter vector
50,100,
video::SColor(0,255,255,255), video::SColor(0,255,255,255),
500,1000,5);
ps->setParticleSize(core::dimension2d<f32>(10,10));
ps->setEmitter(em);
em->drop();
scene::IParticleAffector* paf = ps->createFadeOutParticleAffector(video::SColor(0,0,0,0),500);
ps->addAffector(paf);
paf->drop();
vector3df v1 = vector3df(0.0f,0.1f,0.0f);
vector3df v2 = -v1;
paf = ps->createGravityAffector(v1);
ps->addAffector(paf);
paf->drop();
ps->setMaterialFlag(video::EMF_LIGHTING, false);
ps->setMaterialTexture(0, driver->getTexture("C:/irrlicht/media/particle.bmp"));
ps->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
//anim = smgr->createFlyCircleAnimator(vector3df(0,20,0),30,0.003f);
anim = smgr->createRotationAnimator(vector3df(0,0.8f,0));
ps->addAnimator(anim);
anim->drop();
with code like that you'll see the difference.
last thing : I use a little optimization in my systemparticle code (in the render method) :
Code: Select all
core::vector3df v0 = horizontal + vertical;
core::vector3df v1 = horizontal - vertical;
// reallocate arrays, if they are too small
reallocateBuffers();
// create particle vertex data
s32 idx = 0;
for (u32 i=0; i<Particles.size(); ++i)
{
SParticle& particle = Particles[i];
Vertices[idx].Pos = particle.pos + v0;
Vertices[idx].Color = particle.color;
Vertices[idx].Normal = view;
idx++;
Vertices[idx].Pos = particle.pos + v1;
Vertices[idx].Color = particle.color;
Vertices[idx].Normal = view;
idx++;
Vertices[idx].Pos = particle.pos - v0;
Vertices[idx].Color = particle.color;
Vertices[idx].Normal = view;
idx++;
Vertices[idx].Pos = particle.pos - v1;
Vertices[idx].Color = particle.color;
Vertices[idx].Normal = view;
idx++;
}
the benefits are the suppression of 4 vector additions per particle(for calculation of particles position and the suppression of multiplications to calculate indices of particles.
I'm using theses little optimizations for a long time now and haven't exprimented any problems