hi, i am exploring in the heightmap terrain implementation of irrlicht but i cant get it to work, it crashes the application when create the terrain with addTerrainSceneNode.
IDE = M$ VC
OS = Windows XP
IrrVer = 0.4.2
i only want to see the terrain in the screen. for now.
see the code:
video::IImage* texture = driver->createImageFromFile("MapTexture.jpg");
video::IImage* heightmap = driver->createImageFromFile("HeightMapTerrain.jpg");
video::ITexture* detailmap = driver->getTexture("detail.bmp");
// here crash
scene::ITerrainSceneNode* Map = smgr->addTerrainSceneNode(NULL ,NULL, texture, heightmap, detailmap, core::dimension2d<f32>(10.0f,10.0f), 200.0f, core::dimension2d<s32>(64,64));
any idea?
thanks.
ITerrainSceneNode troubles
-
- Posts: 164
- Joined: Wed May 05, 2004 5:34 pm
- Location: Germany Berlin
- Contact:
Code: Select all
#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")
void main()
{
IrrlichtDevice *device = createDevice(video::EDT_DIRECTX9, core::dimension2d<s32>(640, 480), 16);
video::IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
scene::ISceneNode* node = 0;
video::IImage* iHeightMap = driver->createImageFromFile("height.bmp");//this works
video::IImage* iTerrain = driver->createImageFromFile("tex.bmp");//this works iTerrain
scene::IAnimatedMesh* iTerrainMesh = smgr->addTerrainMesh("iTerrainMesh", iTerrain, iHeightMap); //<---Error is here
scene::ISceneNode* iTerrainNode = smgr->addOctTreeSceneNode(iTerrainMesh);
iTerrainNode->setMaterialFlag(EMF_LIGHTING, false);
smgr->addCameraSceneNodeFPS(0, 100.0f, 400.0f, -1, 0, 0);
IGUIEnvironment* env = device->getGUIEnvironment();
IGUIStaticText* fpstext = env->addStaticText(L"", core::rect<s32>(10,26,120,41), true);
IGUISkin* skin = env->getSkin();
IGUIFont* font = env->getFont("../../media/fonthaettenschweiler.bmp");
if (font)
skin->setFont(font);
device->getGUIEnvironment()->getSkin()->setColor(gui::EGDC_BUTTON_TEXT,
video::SColor(255,200,200,200));
//IGUIFont::draw(L"hallo",core::rect<s32>(10,26,120,41))
device->getCursorControl()->setVisible(false);
int lastFPS = -1;
while(device->run())
{
u32 time = device->getTimer()->getTime();
driver->beginScene(true, true, video::SColor(0,100,100,100));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
device->getGUIEnvironment()->getSkin()->setColor(gui::EGDC_BUTTON_TEXT,
video::SColor( 255,2*time % 200,time % 200,3*time % 200));
wchar_t tmp2[255];
swprintf(tmp2, 255, L" FPS: %d", driver->getFPS());
fpstext->setText(tmp2);
}
device->drop();
}
q|^.^|p beeing every time friendly to everyone
sys: 2500+Barton 512MB 6600GT WinXP
sys: 2500+Barton 512MB 6600GT WinXP
-
- Posts: 164
- Joined: Wed May 05, 2004 5:34 pm
- Location: Germany Berlin
- Contact:
what did you mean with no success
you got a error message? loading an hieghtmap wit 256x256 take a lot of time! maybe your computer is to slow to calculate that. when i add an triangle selector for collision detecting... it took almost infinite time.
you got a error message? loading an hieghtmap wit 256x256 take a lot of time! maybe your computer is to slow to calculate that. when i add an triangle selector for collision detecting... it took almost infinite time.
q|^.^|p beeing every time friendly to everyone
sys: 2500+Barton 512MB 6600GT WinXP
sys: 2500+Barton 512MB 6600GT WinXP