I found Katsankat code for editing the terrain ( http://irrlicht.sourceforge.net/forum/v ... hp?t=32251 )
The arrow "finds" the right triangle under the mouse. But its extremely slow. I use a 1024x1024 heightmap and when editing the vertices i get a drop from 300 to 5 fps and smooth painting becomes impossible. And i can only fear when i start editing more then one vertice at a time (which is a must).
If i change to 256x256 heightmap i get much less drop but thats to low for me.
If i remove the last line (terrain->setPosition()) i get no drops at all but terrain doesnt change either... Any way to make this work? Ive seen working terrain-editors out there so im hopeful.
Thanks a lot
Erik
Code: Select all
void world::RaiseTerrainVertex(ITerrainSceneNode* terrain, s32 index, f32 step, bool up)
{
IMesh* pMesh = terrain->getMesh();
s32 b;
for (b=0; b<pMesh->getMeshBufferCount(); ++b)
{
IMeshBuffer* pMeshBuffer = pMesh->getMeshBuffer(b);
// skip mesh buffers that are not the right type
if (pMeshBuffer->getVertexType() != video::EVT_2TCOORDS) continue;
video::S3DVertex2TCoords* pVertices = (video::S3DVertex2TCoords*)pMeshBuffer->getVertices();
pVertices[index].Pos.Y += (up) ? step : -step;
}
// force terrain render buffer to reload
terrain->setPosition(terrain->getPosition());
}