Code: Select all
irr::scene::IBillboardSceneNode* explosion = smgr->addBillboardSceneNode(0, dimension2df(40,40),
pos, 0, SColor(0,255,255,255), SColor(0,255,255,255));
explosion->setMaterialFlag(irr::video::EMF_LIGHTING, false);
explosion->setMaterialFlag(irr::video::EMF_ZWRITE_ENABLE, false);
explosion->getMaterial(0).setTexture(0, G::device->getVideoDriver()->getTexture("ani1.jpg"));
explosion->setMaterialType(irr::video::EMT_TRANSPARENT_VERTEX_ALPHA);
explosion->getMaterial(0).getTextureMatrix(0).setTextureTranslate(0.26f, 0.26f);
explosion->getMaterial(0).getTextureMatrix(0).setTextureScale(0.24f, 0.24f);
(I plan to animate it later) Yet depending on the angle from which I view the billboard, sometimes I see all 16 explosions instead of just the 1 frame.
This is really frustrating because my brother-in-law is visiting tomorrow and I'm trying to fix this so I have a working game before then. I'm furiously trying to find where the bug is, but if anyone else can help I'd greatly appreciate it...
Edit: This happens D3D9 only!!! It works fine in OPENGL.
Edit2: if I shoot an unrelated rocket (which creates light, a mesh obviously, and a particle emitter, the 16 frames will merge back into the desired 1 frame, but as soon as all the rocket effects disappear, it goes back to ignoring the texture matrix and showing all 16 frames.)