change terrain vertex color

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
troopa
Posts: 28
Joined: Thu Mar 23, 2006 11:00 am
Location: Toulouse (France)
Contact:

change terrain vertex color

Post by troopa »

I use irrspintz. I have created a terrainscenenode thanks to the function addterrainSceneNodeRaw. Its works great but I would like to change the color of the vertex belong the Y value of each vertex. I've tried to modify the color of the vertex of the MeshBuffer but it doesn't change anything because the renderbuffer is not update. I would like to know how i can do that properly without copy and modify the code of CTerrainSceneNode.

An other question. I see there is a new release of Irrlicht, but there is no additionnal feature of irrspintz. Is it two different project now ?

Thanks for your response !
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

I need to add better support to update the vertices but here's the problem...

The terrain scene node maintains 2 mesh buffers. 1 mesh buffer is the original data, as loaded from the bitmap or RAW files. The other mesh is the render mesh, which is updated from the base mesh when position, scale or rotation changes.

What do you think I should do? I guess I need to make specific functions to update vertex data which will update the base mesh and then re-calculate the rendermesh whenever the base mesh changes. Hmmm...
Image
troopa
Posts: 28
Joined: Thu Mar 23, 2006 11:00 am
Location: Toulouse (France)
Contact:

Post by troopa »

maybe I've missed something but why did you have this setScale and setPosition function.

I was looking for answer to your response and i was watching after the source code of AnimatedMeshSceneNode. It has only one mesh buffer and has no setScale, or setPosition function.

Why did you override the virtual function setScale, setPosition defined into ISceneNode.h.

I have certainly missed something :wink:
troopa
Posts: 28
Joined: Thu Mar 23, 2006 11:00 am
Location: Toulouse (France)
Contact:

Post by troopa »

I comment the piece of code who scale the terrain in CTerrainSceneNode and then it doesn't works with the scale function define in ISceneNode.

But I don't understand why there is no need to define one in AnimatedSceneNode and why you have to in TerrainSceneNode.

a Terrain is just a mesh with some additionnal feature.
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

troopa wrote:I comment the piece of code who scale the terrain in CTerrainSceneNode and then it doesn't works with the scale function define in ISceneNode.

But I don't understand why there is no need to define one in AnimatedSceneNode and why you have to in TerrainSceneNode.

a Terrain is just a mesh with some additionnal feature.
Not true. Certain calculations, like camera distance from a terrain patch for LOD determination is the biggest. Like I said, I could implement a better solution, by translating the bbox's based on the scale/position/rotation, but it's more complicated to do so. The terrain scene node has an interface class( ITerrainSceneNode ), so it's easier to add functions for specific purposes to the terrain node, rather than do more work (which would make it slower) to make it work with the standard Irrlicht API.
Image
Post Reply