I am using irrlicht texture animator to animate my explosion,
I am facing a problem, as you can see in the explosion frame below, that I have used background color as pink, because explosion flame has lots of black pixel so I can not choose to make black pixel transparent.
So I was wondering that how to make that pink color transparent.
I tried using this line below in my code explosion1()
Code: Select all
driver->makeColorKeyTexture(t, core::position2d<s32>(5,5));
here is the code
Code: Select all
void explosion_1()
{
ISceneNodeAnimator* anim = 0;
array<video::ITexture*> textures;
for (s32 g=1; g<17; ++g)
{
for(s32 g1=1; g1<4; ++g1)
{
char tmp[64];
snprintf(tmp, 64, "media/explosion2/Explode-04-june_%d.jpg", g);
ITexture* t = driver->getTexture(tmp);
driver->makeColorKeyTexture(t, core::position2d<s32>(5,5));
textures.push_back(t);
}
}
anim = smgr->createTextureAnimator(textures, 100);
vector3df waypoint;
waypoint.X=50;
waypoint.Y=5;
waypoint.Z=50;
IBillboardSceneNode* bill = 0;
for (int r=0; r<2; ++r)
{
bill = smgr->addBillboardSceneNode(0, core::dimension2d<f32>(100,100),waypoint);
bill->setMaterialFlag(video::EMF_LIGHTING, false);
bill->setMaterialTexture(0, driver->getTexture("media/explosion1/Explode-04-june_1.jpg"));
bill->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA);
bill->addAnimator(anim);
}
anim->drop();
return;
}