Code: Select all
#include <irrlicht.h>
#include <iostream>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")
int main()
{
irr::IrrlichtDevice* device = irr::createDevice(video::EDT_DIRECT3D9, core::dimension2d<s32>(1152, 864), 32, false, false, true);
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);
scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS(0, 100, 5000, -1, 0, 0, false, 0);
camera->setPosition(core::vector3df(1900*2,255*2,3700*2));
camera->setTarget(core::vector3df(2397*2,343*2,2700*2));
camera->setFarValue(120000.0f);
//device->getCursorControl()->setVisible(false);
scene::IAnimatedMesh* ter_mesh = smgr->addTerrainMesh("terrain",
driver->createImageFromFile("../media/terrain-texture.jpg"),
driver->createImageFromFile( "../media/heightmap512x512.bmp"),
core::dimension2d<f32>(20, 20), 1000,
core::dimension2d< s32 >(64, 64));
scene::IAnimatedMeshSceneNode* terrain = smgr->addAnimatedMeshSceneNode(ter_mesh);
terrain->setMaterialFlag(video::EMF_LIGHTING, false);
terrain->setScale(core::vector3df(10,10,10));
//terrain->setMaterialFlag(video::EMF_WIREFRAME, true);
terrain->setMaterialTexture(1, driver->getTexture("../media/detailmap3.jpg"));
terrain->setMaterialType(video::EMT_DETAIL_MAP);
smgr->addSkyBoxSceneNode(
driver->getTexture("../media/irrlicht2_up.jpg"),
driver->getTexture("../media/irrlicht2_dn.jpg"),
driver->getTexture("../media/irrlicht2_lf.jpg"),
driver->getTexture("../media/irrlicht2_rt.jpg"),
driver->getTexture("../media/irrlicht2_ft.jpg"),
driver->getTexture("../media/irrlicht2_bk.jpg"));
while(device->run())
{
if(device->isWindowActive())
{driver->beginScene(true, true, 0 );
smgr->drawAll();
driver->endScene();}
}
}
best regards