hier der code, ich habs mir teilweise mit copy&paste aus den irrlicht-beispielcodes zusammengeklaubt, ich mache mir jetzt nicht die mühe und entferne die ganzen kommentare.
Code:
#include <irrlicht.h>
using namespace irr;
using namespace video;
using namespace core;
using namespace scene;
using namespace gui;
using namespace io;
int main()
{
IrrlichtDevice *device=
createDevice(EDT_OPENGL, dimension2d<u32>(640,480),0,false,false,false,0);
if (!device)
return 1;
device->setWindowCaption(L"Zimmer");
IVideoDriver *driver=device->getVideoDriver();
ISceneManager *smgr=device->getSceneManager();
//IAnimatedMesh *mesh=smgr->getMesh("C:/Dokumente und Einstellungen/Name/Desktop/Zimmer.3ds");
IAnimatedMesh *mesh=smgr->getMesh("C:/Dokumente und Einstellungen/Name/Desktop/Zimmer.3ds");
smgr->getMeshManipulator()->makePlanarTextureMapping(mesh->getMesh(0), 1.008f);
scene::ISceneNode* node = 0;
node = smgr->addAnimatedMeshSceneNode(mesh);
node->setMaterialTexture(0, driver->getTexture("C:/Dokumente und Einstellungen/Name/Desktop/SDK-Irrlicht3D/irrlicht-1.7.1/media/wall.jpg"));
node->getMaterial(0).SpecularColor.set(0,0,0,0);
scene::ITriangleSelector* selector = 0;
if (mesh)
{
mesh->setPosition(core::vector3df(-1350,-130,-1400));
selector = smgr->createOctreeTriangleSelector(
mesh->getMesh(), mesh, 128);
mesh->setTriangleSelector(selector);
// We're not done with this selector yet, so don't drop it.
}
scene::ITriangleSelector* selector = smgr->createTerrainTriangleSelector(node, 0);
mesh->setTriangleSelector(node);
//scene::ITriangleSelector* selector = 0;
scene::ICameraSceneNode* camera =
smgr->addCameraSceneNodeFPS(0, 100.0f, .3f/*, ID_IsNotPickable*/, 0, 0, true, 3.f);
camera->setPosition(core::vector3df(0,0,0));
camera->setTarget(core::vector3df(-70,30,-60));
if (selector)
{
scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
selector, camera, core::vector3df(30,50,30),
core::vector3df(0,-10,0), core::vector3df(0,30,0));
selector->drop(); // As soon as we're done with the selector, drop it.
camera->addAnimator(anim);
anim->drop(); // And likewise, drop the animator when we're done referring to it.
}
device->getCursorControl()->setVisible(false);
node = smgr->addLightSceneNode(0, core::vector3df(0,0,0),
video::SColorf(1.0f, 0.6f, 0.7f, 1.0f), 600.0f);
while(device->run())
{
driver->beginScene(true,true,0);
smgr->drawAll();
driver->endScene();
}
device->drop();
return 0;
}