We generate a heightfield in panda with GeomTriangles, so that we can access the VertexData to change the Vertices z position (if we want to flatten the heightfield for an exemple).
Our problem is that we have to compute the normal by hand…but we saw that EggDatas (and Egg library in general) do that, and other features.
SO the question is : how can we create an EggData from a GeomPrimitive?
I don’t know if there is a API command that converts from a GeomVertexData to EggData in a single call.
But you can always do it by hand:
create an empty EggData and EggVertexPool
loop over your GeomVertexData and create and EggVertex for each vertex
loop over your GeomPrimitive and create and EggPolygon for each triangle
If you modify e.g. a terrain during runtime (maybe a crater from a bomb explosion), then you are probably better off if you compute the normals by hand, since you only have to re-compute them in a small affected area.
If you compute the normals yourself (without the EggLib) you’ll be able, for example, to recompute only the updated vertices if the mesh is modified at runtime.
It’s only a sum of cross products normalized.