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.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.
Particle Engine
Re: Particle Engine
Working on game: Marrbles (Currently stopped).
Re: Particle Engine
I was referring to the sample code that does this:
But now I see it works like the standard referencecounted of irr.
nice!
Code: Select all
irr::scene::particle::IParticleAffector* affector = new ColorAffector(irr::video::SColor(0,100,50,0));
drawer->addAffector(affector);
affector->drop();
nice!
-
- Posts: 219
- Joined: Fri Feb 19, 2010 4:03 pm
- Location: Estonia
Re: Particle Engine
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
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
to live, is natural; to die, is not!
Re: Particle Engine
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
Reuploaded the ParticleEngine linked seamed to be deleted.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Re: Particle Engine
Added option to make the particles follow its own node origin.
Just call:
Just call:
Code: Select all
particleEngine->setLocalParticles(true);
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Re: Particle Engine
nice. this is especially useful for fast moving objects.Sudi wrote:Added option to make the particles follow its own node origin.
Just call:Code: Select all
particleEngine->setLocalParticles(true);
My company: http://www.kloena.com
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
Re: Particle Engine
Bugfix: now the rotation of particlesystem that are local works correct.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Re: Particle Engine
Bugfix: now the trail and oriented particle drawers work as well in local mode
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Re: Particle Engine
I am interested in your work, link is broken ?
Re: Particle Engine
Yeah rapidshare seams to delete files after some time.
updated the link in the first post
updated the link in the first post
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
-
- Posts: 1638
- Joined: Mon Apr 30, 2007 3:24 am
- Location: Montreal, CANADA
- Contact:
Re: Particle Engine
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
(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
Last edited by christianclavet on Wed Feb 27, 2013 11:38 pm, edited 1 time in total.
Re: Particle Engine
Maybe its better to also add it to the IrrExt project
http://sourceforge.net/projects/irrext/
http://sourceforge.net/projects/irrext/
Re: Particle Engine
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.RdR wrote:Maybe its better to also add it to the IrrExt project
http://sourceforge.net/projects/irrext/
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.