Page 2 of 3

Re: Particle Engine

Posted: Thu Sep 29, 2011 3:21 pm
by serengeor
Abraxas) wrote:If I understand the source correctly (and I'm an engineer not a programmer :/ ) after creating the pointers with "new" they get destroyed automatically by the system? no need to keep track of all the effects running?

I really like how well this is implemented into irr, which lacks a good particle system. I'm in the process of writing some middle level code which I'll release when I'm done.

Can I use this code in a commercial release?

Thanks.
Usually everything you create with new method you have to delete yourself. If you are talking about sudi's particle system, than I don't know for sure.

Re: Particle Engine

Posted: Thu Sep 29, 2011 7:55 pm
by Abraxas)
I was referring to the sample code that does this:

Code: Select all

    irr::scene::particle::IParticleAffector* affector = new ColorAffector(irr::video::SColor(0,100,50,0));
    drawer->addAffector(affector);
    affector->drop();
But now I see it works like the standard referencecounted of irr.

nice!

Re: Particle Engine

Posted: Mon Nov 14, 2011 11:58 am
by xirtamatrix
Very impressive but...

I suggest you create an Editor where you can easily make these particle effects, then save them and then load into your irrlicht app.
For inspiration, take a look at Particle Universe, its a similar example for Ogre: http://www.fxpression.com/

This would increase the usability and popularity of your work a hundred-fold ;)

Re: Particle Engine

Posted: Thu Feb 16, 2012 1:17 pm
by RdR
I created a small patch to make the system relative to its parent (so particles moving along with the parent).

Code: Select all

 
--- CParticleDrawer.cpp 
-------------------------------
@@ -64,5 +64,5 @@
 void CParticleDrawer::drawParticles(irr::core::matrix4& transform, irr::video::IVideoDriver* driver)
 {
-    driver->setTransform(irr::video::ETS_WORLD, irr::core::IdentityMatrix);
+    driver->setTransform(irr::video::ETS_WORLD, transform);
 
     driver->setMaterial(getMaterial());
@@ -97,5 +97,4 @@
     rellocateBuffer();
 
-    irr::core::matrix4 viewMatrix = camera->getViewFrustum()->getTransform( irr::video::ETS_VIEW );
     irr::core::vector3df campos = camera->getAbsolutePosition();
 
@@ -133,5 +132,5 @@
             irr::core::vector3df view = particle->Position-campos;
             view.normalize();
-            createParticle(idx, particle, view, viewMatrix);
+            createParticle(idx, particle, view, transform);
 
             idx++;
 
 
CParticleSystem.cpp
-------------------------------
@@ -60,5 +60,5 @@
                     //view.normalize();
                 }
-                Drawer[i]->doParticles(SceneManager->getActiveCamera(), getAbsoluteTransformation(), timeMs, Paused ? 0.f : diff);
+                Drawer[i]->doParticles(SceneManager->getActiveCamera(), irr::core::IdentityMatrix, timeMs, Paused ? 0.f : diff);
             }
         }
@@ -120,5 +120,4 @@
             irr::f32 diff = timeMs-LastTime;
             diff /= 1000.f;
-            updateAbsolutePosition();
             update(timeMs, diff);
             ISceneNode::OnAnimate(timeMs);
@@ -128,7 +127,8 @@
         void CParticleSystem::render(void)
         {
+               core::matrix4 trans = getAbsoluteTransformation();
             for (u32 i=0;i<Drawer.size();++i)
             {
-                Drawer[i]->drawParticles(AbsoluteTransformation, SceneManager->getVideoDriver());
+                Drawer[i]->drawParticles(trans, SceneManager->getVideoDriver());
             }
         }
 
 
--- CBillboardParticleDrawer.h
-------------------------------
+void drawParticles(irr::core::matrix4& transform, irr::video::IVideoDriver* driver);
+void doParticles(const irr::scene::ICameraSceneNode* camera, const irr::core::matrix4& transform, irr::u32 timeMs, irr::f32 diff);
 
 
--- CBillboardParticleDrawer.cpp
-------------------------------
+void CBillboardParticleDrawer::drawParticles(irr::core::matrix4& transform, irr::video::IVideoDriver* driver)
+{
+        irr::core::matrix4 newTransform = irr::core::IdentityMatrix;
+        newTransform.setTranslation(transform.getTranslation());
+        CParticleDrawer::drawParticles(newTransform, driver);
+}
 
+void CBillboardParticleDrawer::doParticles(const irr::scene::ICameraSceneNode* camera, const irr::core::matrix4& transform, irr::u32 timeMs, irr::f32 diff)
+{
+        irr::core::matrix4 newTransform = transform;
+        irr::core::matrix4 viewMatrix = camera->getViewFrustum()->getTransform( irr::video::ETS_VIEW );
+        newTransform.setRotationDegrees(viewMatrix.getRotationDegrees());
+        CParticleDrawer::doParticles(camera, newTransform, timeMs, diff);
+}
 
void CBillboardParticleDrawer::createParticle(const irr::u32& id, const Particle* particle, const irr::core::vector3df& view, const irr::core::matrix4& transform) {
        irr::f32 f = 0;
-       if (particle->Rotation.X != 0) {
+   if (false) {
 

Re: Particle Engine

Posted: Fri Feb 17, 2012 3:39 pm
by sudi
Reuploaded the ParticleEngine linked seamed to be deleted.

Re: Particle Engine

Posted: Sun Feb 19, 2012 6:53 pm
by sudi
Added option to make the particles follow its own node origin.

Just call:

Code: Select all

 
particleEngine->setLocalParticles(true);
 

Re: Particle Engine

Posted: Wed Feb 22, 2012 7:46 pm
by Virion
Sudi wrote:Added option to make the particles follow its own node origin.

Just call:

Code: Select all

 
particleEngine->setLocalParticles(true);
 
nice. this is especially useful for fast moving objects.

Re: Particle Engine

Posted: Wed Feb 22, 2012 9:28 pm
by sudi
Bugfix: now the rotation of particlesystem that are local works correct.

Re: Particle Engine

Posted: Wed Feb 22, 2012 10:22 pm
by sudi
Bugfix: now the trail and oriented particle drawers work as well in local mode

Re: Particle Engine

Posted: Tue Feb 26, 2013 8:10 pm
by ikam
I am interested in your work, link is broken ?

Re: Particle Engine

Posted: Tue Feb 26, 2013 9:51 pm
by sudi
Yeah rapidshare seams to delete files after some time.
updated the link in the first post

Re: Particle Engine

Posted: Tue Feb 26, 2013 10:34 pm
by ikam
thanks lot ;)

Re: Particle Engine

Posted: Wed Feb 27, 2013 1:02 am
by christianclavet
Hi, @Sudi. I'll host your file on my web site if the link dies then this should help maintain the availability. I'll will try to follow your updates and update the link as it's change.

(From post with compiled example, assets and MSVC project, old source.)
http://www.clavet.org/files/download/Sudi_PARTICLES.zip 4.97Mb

(New updated source with example)
http://www.clavet.org/files/download/Pa ... ne.tar.bz2 2.55Mb

Re: Particle Engine

Posted: Wed Feb 27, 2013 10:08 am
by RdR
Maybe its better to also add it to the IrrExt project
http://sourceforge.net/projects/irrext/

Re: Particle Engine

Posted: Wed Feb 27, 2013 12:42 pm
by sudi
RdR wrote:Maybe its better to also add it to the IrrExt project
http://sourceforge.net/projects/irrext/
Better not. The ParticleEngine is part of a bigger project of mine and if it would be in IrrExt i would have to update two code sources when i add features in the future.