http://www.zerocore.net/demo.zip
I think we can also make animated particles? I will check it out soon.
p/s. i'm currently an art student so hardly got time for programming... damn i've forgotten most of the things about c++!
add:
Code: Select all
#include <irrlicht.h>
#include "main.h"
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
u32 oldNow;
u32 time;
u32 now;
u32 elapsed;
int main()
{
IrrlichtDevice *device = createDevice(EDT_OPENGL, dimension2d<s32>(512, 512), 32, false, false, false, 0);
device->setWindowCaption(L"Irrlicht Animated Texture Demo");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
oldNow = device->getTimer()->getRealTime();
time = 0;
int i = 1;
ITexture* img[i];
img[1] = driver->getTexture("beast1.jpg");
img[2] = driver->getTexture("beast2.jpg");
img[3] = driver->getTexture("beast3.jpg");
img[4] = driver->getTexture("beast4.jpg");
img[5] = driver->getTexture("beast5.jpg");
IAnimatedMesh* mesh = smgr->getMesh("beast.b3d");
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh);
node->setMaterialFlag(EMF_LIGHTING,false);
node->setFrameLoop(1, 25);
smgr->addCameraSceneNode(0, vector3df(100,100,-150), vector3df(0,5,0));
while(device->run())
{
now = device->getTimer()->getRealTime();
elapsed = now - oldNow;
oldNow = now;
time += elapsed;
if (time<1000)
{
i = 1;
}
if (time>1000)
{
i = 2;
}
if (time>2000)
{
i = 3;
}
if (time>3000)
{
i = 4;
}
if (time>4000)
{
i = 5;
}
if (time>5000)
{
time = 0;
}
node->setMaterialTexture( 0,img[i]);
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->drop();
return 0;
}