Topic: How to manipulate a Terrain in real time?

At first, thumbs up for the new version wink .

Now the problem:
I want to manipulate a loaded terrain (from an image for example), but how can I do this? It would be nice if there would be such a simple thing as the terrain modify-comand in blitz3d (ModifyTerrain(terrain,x,y,height#)). But I can't find something like this and to work using the vertex-comands seems to be very difficult sad .
Any ideas? Is it an issue of Irrlicht or of your wonderful wrapper?

Hope you can help me,
lobby

Re: How to manipulate a Terrain in real time?

greetings smile  i have never done this before, but here's the concept:

1) use ISceneManager.addTerrainMesh() to add your mesh

2) use getMesh(0) on the returned animated mesh to get a mesh you can modify.  keep a reference to this.

3) use ISceneManager.addMeshSceneNode() passing in result of #2 to create a scene node for your terrain.

you should be able to get the buffer from #2 and edit it.

3 (edited by Lobby 2010-12-20 09:57:51)

Re: How to manipulate a Terrain in real time?

Thank you for your answer, but I don't want to use a heighmap-file because I want to manage the terraindata myself (ITerrainSceneNode seems not to support this).
The way it works now:
1.) I generate me random terrain data to have something nice to show (thanks to the diamond square thing...) which I save into a type created for them
2.) I use sceneManager.addHillPlaneMesh:IAnimatedMesh(...) to create a suitable mesh for my terrain in the right size
3.) I maniplulate this IAnimatedMesh of step 2 to get my terrain mesh using the terraindata
4.) To make the whole thing a little bit faster I create a OctreeSceneNode of the AnimatedMesh using sceneManager.addOctreeSceneNode:IMeshSceneNode(...) which will be the final, shown terrain mesh


To manipulate the terrain-octree I make my manipulations on the AnimatedMesh and repeat step 4. The problem is, that the rendering of the created terrain like this, also in sizes like 32*32, is very slow (never higher than 30 FPS) while the terrain sample (size 256*256) is running with 300 FPS.
So the general question: How to be able to use the ITerrainSceneNode-Mesh optimizations on an manipulatable IMesh or IAnimatedMesh?


I hope you can help me, if needed I will also public the source here so that you can test it yourself.