Code: Select all
void Create_Terrain_Map (irr::scene::ISceneManager * smgr,
irr::video::IVideoDriver * driver,
irr::scene::ITriangleSelector * selector,
irr::scene::IMetaTriangleSelector * metaSelector)
{
// Create terrain from 2d image
irr::video::IImage* heightmap;
irr::video::IImage* texture;
irr::scene::IAnimatedMesh* terrain;
irr::scene::ISceneNode* mapnode;
heightmap = driver->createImageFromFile("C:\\Evil Rocket\\art\\3d\\maps\\terrain.bmp");
texture = driver->createImageFromFile("C:\\Evil Rocket\\art\\3d\\maps\\terrain_texture.jpg");
terrain = smgr->addTerrainMesh ("0",texture, heightmap,irr::core::dimension2d<irr::f32>(64.0f,64.0f),256.0f );
mapnode = smgr->addMeshSceneNode(terrain->getMesh(0));
mapnode ->setPosition(irr::core::vector3df(-400,-256,-256));
mapnode ->setMaterialFlag(irr::video::EMF_LIGHTING, true);
mapnode ->setMaterialFlag(irr::video::EMF_FOG_ENABLE, false);
selector = smgr->createOctTreeTriangleSelector(terrain->getMesh(0), mapnode);
metaSelector->addTriangleSelector(selector);
selector->drop();
map_array [current_map] = mapnode;
current_map++;
}
Code: Select all
mapnode = smgr->addMeshSceneNode(terrain->getMesh(0));
Can anybody tell me why this happens? I don't have any issues creating arrays of regular scene nodes, but the terrains are obviously set up a little different. Help would be appreciated.