How to edit mesh vertices?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
jfisher446
Posts: 11
Joined: Mon Mar 14, 2011 10:48 am

How to edit mesh vertices?

Post by jfisher446 »

Hey guys, just looking for some guidance here. In short I'm doing like a terrain editor. I want a plane and I want to be able to manipulate the vertices in it. I don't wish for anyone to do it for me, just some direction.

The different mesh types have confused me thus far. So:
1. What is it that I need to create to act as, maybe a 10x10 grid of vertices just to play with?
2. How do I access these vertices, the actual values I mean?
3. Is each vertex simply vector3df coords? And therefore easily editable once I find these functions I'm looking for?

To sum up. What do I use to create a flat plane, then how can I change one vertex in it to move it up and down. I'll figure out the rest on my own. Thanks!

PS If I can get this worked out I'll add what I learn to the wiki to hopefully help future people looking at this.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Please look into example 23 (SMesh handling), which will give you most things you need. Combined with example 7 (collision tests) you can build your editor.
jfisher446
Posts: 11
Joined: Mon Mar 14, 2011 10:48 am

Post by jfisher446 »

I've looked at and extracted a lot of things from these two tutorials, the thing that I either can't figure out or is missing is the editing of a vertex during runtime. What function is it?
EDIT: Ok so to elaborate a little more. This is the impression that I'm under:
I need a mesh and a meshbuffer. The meshbuffer holds the vertices.(?) I have the code from the tutorials, but all those load from a heightmap, making it hard for me to decipher what is ACTUALLY going on here. I want to, for learning's sake, just make it simple and plug my own small numbers in there. Then I get a little lost...The meshbuffer goes on to to mesh.init to give it the vertices? or what happens?
I've been going over these tut's for a week now and still don't get the underlying concepts of what actually happens here. All the examples using a heightmap is throwing me off.
Last edited by jfisher446 on Mon Mar 21, 2011 8:38 pm, edited 1 time in total.
nespa
Posts: 167
Joined: Wed Feb 24, 2010 12:02 pm

Post by nespa »

take a look at the topic :"Creating a custom heightmap" in the Beginners Help section (follow the link);
jfisher446
Posts: 11
Joined: Mon Mar 14, 2011 10:48 am

Post by jfisher446 »

Ok reading over that, sounds like he was almost in the same predicament as I am. The difference though is that I wish not to use a heightmap. I was editing the post above when you posted your last response, but now, how does one go about skipping the heightmap portion to great the geometry of the mesh, and instead to it manually?
jfisher446
Posts: 11
Joined: Mon Mar 14, 2011 10:48 am

Post by jfisher446 »

I think I've got it. I've been thinking of heightmaps as files, not as a collection of coordinates. I'll work with it and see what I can do.
ChaiRuiPeng
Posts: 363
Joined: Thu Dec 16, 2010 8:50 pm
Location: Somewhere in the clouds.. drinking pink lemonade and sunshine..

Post by ChaiRuiPeng »

make sure you dont forget to call the meshbuffers setDirty() method so the driver knows you update vertex data
ent1ty wrote: success is a matter of concentration and desire
Butler Lampson wrote: all problems in Computer Science can be solved by another level of indirection
at a cost measure in computer resources ;)
jfisher446
Posts: 11
Joined: Mon Mar 14, 2011 10:48 am

Post by jfisher446 »

Awesome, good info. So am I right in saying that all I really need to create this mesh is a heightmap which contains my vertices, a meshbuffer that will hold them, then a mesh to load the meshbuffer to? It's still the whole concept that gets me, I want to make sure I have the basics down.
Post Reply