Changing vertex color of terrain.

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
bonsalty
Posts: 120
Joined: Thu Dec 10, 2009 1:30 pm
Location: Budapest,Hungary

Changing vertex color of terrain.

Post by bonsalty »

Whats the best way to change the vertex color of the terrainscenenode , not the material color?
Tomi
Alastriona
Posts: 23
Joined: Sat Apr 17, 2010 3:36 pm

Re: Changing vertex color of terrain.

Post by Alastriona »

bonsalty wrote:Whats the best way to change the vertex color of the terrainscenenode , not the material color?
loadHeightmap allows you to set the vertex colour iirc.
bonsalty
Posts: 120
Joined: Thu Dec 10, 2009 1:30 pm
Location: Budapest,Hungary

Post by bonsalty »

Thanks, I do it this way. I would like to change it without generating a new surface, but I guess its impossible.
Tomi
Alastriona
Posts: 23
Joined: Sat Apr 17, 2010 3:36 pm

Post by Alastriona »

bonsalty wrote:Thanks, I do it this way. I would like to change it without generating a new surface, but I guess its impossible.
Iterrainscenenode->getMesh()->getMeshbuffer()->getVertices()

And then modify the vertices in the array. Wouldn't that work?
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

Alastriona wrote:
bonsalty wrote:Thanks, I do it this way. I would like to change it without generating a new surface, but I guess its impossible.
Iterrainscenenode->getMesh()->getMeshbuffer()->getVertices()

And then modify the vertices in the array. Wouldn't that work?
The terrain node has dynamic lod, so the meshbuffer is constantly changing. You'd have to change the vertex color every time you moved to keep up with lod.
Alastriona
Posts: 23
Joined: Sat Apr 17, 2010 3:36 pm

Post by Alastriona »

Lonesome Ducky wrote:
Alastriona wrote:
bonsalty wrote:Thanks, I do it this way. I would like to change it without generating a new surface, but I guess its impossible.
Iterrainscenenode->getMesh()->getMeshbuffer()->getVertices()

And then modify the vertices in the array. Wouldn't that work?
The terrain node has dynamic lod, so the meshbuffer is constantly changing. You'd have to change the vertex color every time you moved to keep up with lod.
Hmm didn't think about that. I'm guessing that calling the loadHeightmap function every time you wantg to change it is the best then. Unless you can somehow access the vertex color atribute and change it directly. But I don't think its exposed via the API.
Post Reply