Ok before people dig into me: I did use the search function, but I think I may need a little more hand holding than what is currently posted.
I am looking just to render some terrain, and I can make it appear on screen using a greyscale bmp file for my data. I still am, even after reading the tutorials, a bit unclear on triangle selectors. I would also like to implement a octtree, and while I am aware there is a scene node for it I am having a little trouble grasping that also. Can anyone post some code showing a full working example from beginning to end?
Terrain rendering
Code: Select all
//====================================================
// init terrain //
IImage* heightmap= driver->createImageFromFile("hieghtmap.bmp");
IImage* texture= driver->createImageFromFile("texture.jpg");
ISceneNode* TerrainNode = 0;
IAnimatedMesh* terrain = 0;
smgr->addTerrainMesh("terrain",texture,heightmap,core::dimension2d<f32>
(10.0f,10.0f),1000.0f,core::dimension2d<s32>(64,64));
terrain = smgr->getMesh("terrain");
TerrainNode = smgr->addAnimatedMeshSceneNode(terrain);
//create triangle selector//
ITriangleSelector* selector =
smgr->createTriangleSelector(terrain->getMesh(0),TerrainNode);
//options loop//
if (TerrainNode)
{
TerrainNode->setMaterialFlag(EMF_LIGHTING, false);
TerrainNode->setPosition(core::vector3df (-3000.0f,0.0f,-3000.0f));
TerrainNode->setTriangleSelector(selector);
selector->drop();
}
//====================================================
// init camera //
ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
camera->setFOV(1.5);
//camera->setFarValue(40000.0f);
camera->setPosition(core::vector3df (200.0f,1200.0f,200.0f));
//camera animator//
/*
ISceneNodeAnimator* CameraAnim =
smgr->createCollisionResponseAnimator(selector,camera,core::vector3df(30,60,30),
core::vector3df(0,-100,0), 100.0f,
core::vector3df(0,50,0));
camera->addAnimator(CameraAnim);
CameraAnim->drop();
Last edited by Kaeles on Thu Sep 16, 2004 5:17 pm, edited 1 time in total.
Hi guys,
I think I need some help...![Sad :(](./images/smilies/icon_sad.gif)
I've just copied it to my source (just to test it). It works generally, but I can't find any terrain. Sometimes I can see in the upper left edge of the window a small piece of green (this is my "texture").
My "Terrain" is 64x64px sized mspaint-picture.
Black should be the deepest und white the highest point on the terrain. And my "texture" is a 64x64px sized piece of green (also made by paint).
So what was my fault with this?
Thanks a lot,
Chris
PS: I'm using irr.7 and have no problems!
I think I need some help...
![Sad :(](./images/smilies/icon_sad.gif)
I've just copied it to my source (just to test it). It works generally, but I can't find any terrain. Sometimes I can see in the upper left edge of the window a small piece of green (this is my "texture").
My "Terrain" is 64x64px sized mspaint-picture.
![Wink ;)](./images/smilies/icon_wink.gif)
So what was my fault with this?
Thanks a lot,
Chris
PS: I'm using irr.7 and have no problems!