Hey all,
I'm trying to put 2 models into the same scene but i can put only one, the second dosen't work.
here is my code:
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#pragma comment(lib, "Irrlicht.lib")
ICameraSceneNode* camera = 0;
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (camera)
return camera->OnEvent(event);
return false;
}
};
int main()
{
MyEventReceiver receiver;
IrrlichtDevice *device =
createDevice(DT_DIRECTX8,
dimension2d<s32>(800, 600), 32, false, false, &receiver);
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
ISceneNode* node;
IAnimatedMesh* level = smgr->getMesh("Monster.3DS");
if (level)
node = smgr->addOctTreeSceneNode(level->getMesh(0));
node->setMaterialFlag(EMF_LIGHTING, false);
//smgr->addCameraSceneNode(0, vector3df(-20,28,-30), vector3df(-40,5,-20));
if (node)
node->setRelativePosition(vector3df(-1300,-144,-1249));
ISceneNode* node2=0;
IAnimatedMesh* pilot = 0;
pilot = smgr->getMesh("level1.3DS");
if (node2)
node2->setRelativePosition(vector3df(-1300,-160,-1249));
camera = smgr->addCameraSceneNodeFPS();
device->getCursorControl()->setVisible(false);
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->getPrimitiveCountDrawed());
device->setWindowCaption(tmp);
lastFPS = fps;
}
}
device->drop();
return 0;
}
Where i did wrong? or there is another way?
Thanks
two models
There is a line missing before this:
Something like
perhaps.
Code: Select all
if (node2)
Code: Select all
node2 = smgr->addAnimatedMeshSceneNode(pilot);