Commit 4c464ee0 authored by hybrid's avatar hybrid

Add a test for particle system to exist before working with it

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4486 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 5de4ef87
...@@ -165,30 +165,33 @@ int main() ...@@ -165,30 +165,33 @@ int main()
scene::IParticleSystemSceneNode* ps = scene::IParticleSystemSceneNode* ps =
smgr->addParticleSystemSceneNode(false); smgr->addParticleSystemSceneNode(false);
scene::IParticleEmitter* em = ps->createBoxEmitter( if (ps)
core::aabbox3d<f32>(-7,0,-7,7,1,7), // emitter size {
core::vector3df(0.0f,0.06f,0.0f), // initial direction scene::IParticleEmitter* em = ps->createBoxEmitter(
80,100, // emit rate core::aabbox3d<f32>(-7,0,-7,7,1,7), // emitter size
video::SColor(0,255,255,255), // darkest color core::vector3df(0.0f,0.06f,0.0f), // initial direction
video::SColor(0,255,255,255), // brightest color 80,100, // emit rate
800,2000,0, // min and max age, angle video::SColor(0,255,255,255), // darkest color
core::dimension2df(10.f,10.f), // min size video::SColor(0,255,255,255), // brightest color
core::dimension2df(20.f,20.f)); // max size 800,2000,0, // min and max age, angle
core::dimension2df(10.f,10.f), // min size
ps->setEmitter(em); // this grabs the emitter core::dimension2df(20.f,20.f)); // max size
em->drop(); // so we can drop it here without deleting it
ps->setEmitter(em); // this grabs the emitter
scene::IParticleAffector* paf = ps->createFadeOutParticleAffector(); em->drop(); // so we can drop it here without deleting it
ps->addAffector(paf); // same goes for the affector scene::IParticleAffector* paf = ps->createFadeOutParticleAffector();
paf->drop();
ps->addAffector(paf); // same goes for the affector
ps->setPosition(core::vector3df(-70,60,40)); paf->drop();
ps->setScale(core::vector3df(2,2,2));
ps->setMaterialFlag(video::EMF_LIGHTING, false); ps->setPosition(core::vector3df(-70,60,40));
ps->setMaterialFlag(video::EMF_ZWRITE_ENABLE, false); ps->setScale(core::vector3df(2,2,2));
ps->setMaterialTexture(0, driver->getTexture("../../media/fire.bmp")); ps->setMaterialFlag(video::EMF_LIGHTING, false);
ps->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR); ps->setMaterialFlag(video::EMF_ZWRITE_ENABLE, false);
ps->setMaterialTexture(0, driver->getTexture("../../media/fire.bmp"));
ps->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
}
/* /*
Next we add a volumetric light node, which adds a glowing fake area light to Next we add a volumetric light node, which adds a glowing fake area light to
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment