Page 1 of 1

Changing vertex color of terrain.

Posted: Wed Apr 21, 2010 9:40 am
by bonsalty
Whats the best way to change the vertex color of the terrainscenenode , not the material color?

Re: Changing vertex color of terrain.

Posted: Wed Apr 21, 2010 12:12 pm
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.

Posted: Wed Apr 21, 2010 12:45 pm
by bonsalty
Thanks, I do it this way. I would like to change it without generating a new surface, but I guess its impossible.

Posted: Wed Apr 21, 2010 5:11 pm
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?

Posted: Wed Apr 21, 2010 7:57 pm
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.

Posted: Thu Apr 22, 2010 8:59 am
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.