Is there something I need to do to cache it or something? I think that the scene manager may be loading and drawing the entire landscape every single frame (the detail map is the terrain, world).
Here is the entire code of the program:
Code: Select all
#include <irrlicht.h>
using namespace irr;
int main()
{
IrrlichtDevice *device = createDevice( video::EDT_OPENGL, core::dimension2d<s32>(800, 600), 32, false, true, false );
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
scene::IAnimatedMesh * worldMesh = smgr->addTerrainMesh( "theWorld", driver->createImageFromFile("../../media/himap.jpg"), driver->createImageFromFile("../../media/himap.bmp"), core::dimension2d< f32 >(2.0f, 2.0f), 200.0f, core::dimension2d< s32 >(100, 100) );
scene::ISceneNode* node = smgr->addMeshSceneNode( worldMesh->getMesh(0) );
node->setMaterialFlag(video::EMF_LIGHTING, false);
scene::ICameraSceneNode *camera = smgr->addCameraSceneNodeFPS( 0, 100.0f, 500.0f, -1 );
int lastFPS = -1;
while(device->run())
{
driver->beginScene( true, true, 0 );
smgr->drawAll();
driver->endScene();
int fps = driver->getFPS();
if ( lastFPS != fps )
{
core::stringw str = L"Arcanus - Height Mapping Test [";
str += driver->getName();
str += "] FPS:";
str += fps;
device->setWindowCaption( str.c_str() );
lastFPS = fps;
}
}
device->drop();
return 0;
}