How to draw fire or explosion effect on the blue background?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
hankersyan
Posts: 7
Joined: Sun Dec 13, 2009 1:54 am

How to draw fire or explosion effect on the blue background?

Post by hankersyan »

In examples 08.SpecialFX, there is a good sample about the fire effect. But when i comment out other code segments expect the fire particle and change the background to blue, the fire color is changed to white.

I want to get a yellow fire on the sky background. Actually i wanna the special effect about the fire and the explosion in the sky.

Thanks!

Code: Select all

	scene::IParticleSystemSceneNode* ps =
		smgr->addParticleSystemSceneNode(false);

	scene::IParticleEmitter* em = ps->createBoxEmitter(
		core::aabbox3d<f32>(-7,0,-7,7,1,7), // emitter size
		core::vector3df(0.0f,0.06f,0.0f),   // initial direction
		80,100,                             // emit rate
		video::SColor(0,255,255,255),       // darkest color
		video::SColor(0,255,255,255),       // brightest color
		800,2000,0,                         // min and max age, angle
		core::dimension2df(10.f,10.f),         // min size
		core::dimension2df(20.f,20.f));        // max size

	ps->setEmitter(em); // this grabs the emitter
	em->drop(); // so we can drop it here without deleting it

	scene::IParticleAffector* paf = ps->createFadeOutParticleAffector();

	ps->addAffector(paf); // same goes for the affector
	paf->drop();

	ps->setPosition(core::vector3df(-70,60,40));
	ps->setScale(core::vector3df(2,2,2));
	ps->setMaterialFlag(video::EMF_LIGHTING, false);
	ps->setMaterialFlag(video::EMF_ZWRITE_ENABLE, false);
	ps->setMaterialTexture(0, driver->getTexture("../../media/fire.bmp"));
	ps->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA);

        // ...

	while(device->run())
	if (device->isWindowActive())
	{
		driver->beginScene(true, true, video::SColor(255, 0, 0, 255)); // [b]Blue background[/b]

		smgr->drawAll();

		driver->endScene();
	}

Markhor
Posts: 20
Joined: Thu Sep 02, 2010 2:09 pm

Post by Markhor »

Try this:

Code: Select all

video::SColor(0,255,255,0)
for both darkest and lightest inside the BoxEmitter.

255 for all 3 slots, on a computer, is white. all 0, the absence of color, is black. that is the RGB of yellow in MS Paint on windows 7.

try it.
Post Reply