Tried both ogl and dx renderers... I mean I have not the fastest PC (P-III-950, WinXP, tnt 2) but I have a great speed with my blitz basic 3d particle code
Code: Select all
#include <irrlicht.h>
#include <wchar.h>
#include <windows.h>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")
scene::ICameraSceneNode* camera = 0;
class MyEventReceiver : public IEventReceiver {
public:
virtual bool OnEvent(SEvent event)
{
if (camera)
return camera->OnEvent(event);
return false;
}
};
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
////////////////////////////////////////////////////
MyEventReceiver receiver;
////////////////////////////////////////////////////
IrrlichtDevice *device =
createDevice(video::DT_OPENGL, core::dimension2d<s32>(640, 480), 16, false, false, &receiver);
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
////////////////////////////////////////////////////
camera = smgr->addCameraSceneNodeFPS(0, 200.0f, 500.0f );
camera->setPosition(core::vector3df(-50,45,-150));
camera->setFarValue(15000.0f);
////////////////////////////////////////////////////
scene::IParticleSystemSceneNode* ps = 0;
ps = smgr->addParticleSystemSceneNode(false);
ps->setPosition(core::vector3df(-70,60,40));
ps->setScale(core::vector3df(2,2,2));
ps->setParticleSize(core::dimension2d<f32>(20.0f, 10.0f));
scene::IParticleEmitter* em = ps->createBoxEmitter(
core::aabbox3d<f32>(-7,0,-7,7,1,7),
core::vector3df(0.0f,0.03f,0.0f),
800,1000,
video::SColor(0,255,255,255), video::SColor(0,255,255,255),
80,100);
ps->setEmitter(em);
em->drop();
scene::IParticleAffector* paf =
ps->createFadeOutParticleAffector();
ps->addAffector(paf);
paf->drop();
ps->setMaterialFlag(video::EMF_LIGHTING, false);
ps->setMaterialTexture(0, driver->getTexture("sprites/2.jpg"));
ps->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA);
////////////////////////////////////////////////////
int lastFPS = -1;
while(device->run()) {
driver->beginScene(true, true, video::SColor(0,0,0,0));
smgr->drawAll();
driver->endScene();
int fps = driver->getFPS();
if (lastFPS != fps) {
wchar_t tmp[1024];
swprintf(tmp, 1024, L"Quake 3 Map Example - Irrlicht Engine (fps:%d) Triangles:%d",
fps, driver->getPrimitiveCountDrawn());
device->setWindowCaption(tmp);
lastFPS = fps;}}
/*
In the end, delete the Irrlicht device.
*/
device->drop();
return 0;
};