How to split EggData

I’m trying to split an single EggGroup into smaller ones.

I can extract all the triangles and add them as EggPolygons according to their bounding box. But then, a lots of vertices will be redundant.
Is there a simple way to optimize the groups to make the polygons share the vertices, or do I need to do it myself when populating the EggGroups ?

Or should I do that with GeomVertex[Reader/Writer] ?

[size=75]
Related topics :
discourse.panda3d.org/viewtopic.php?p=5377#5377
discourse.panda3d.org/viewtopic … 1563#11563
discourse.panda3d.org/viewtopic … 1585#11585
discourse.panda3d.org/viewtopic.php?t=2431[/size]

Ok, I just realized that EggGroups can share the same VertexPool, so it’s a trivial problem using the egg library.

Note that an EggVertexPool is just an organizational construct, as are individual EggVertices. Whether different EggPolygons share the same EggVertexPool, or even the same EggVertex, is largely unrelated to the question of whether the resulting renderable geometry will share vertices.

The egg loader automatically unifies duplicate vertices when possible. It also splits vertices when necessary. These decisions have nothing to do with whether the vertices are shared in the original egg file.

David

Ok thanks. If I understood well, an egg file structured like this :

<VertexPool> {
    <Vertex>
    ..
}
<Group> {
    <Polygon>
    <Polygon>
    ...
}
<Group> {
    <Polygon>
    <Polygon>
    ...
}
...

will actually result in some GeomNodes with their own VertexData that should be optimized to contain only the vertices they use. The total number of vertices in VertexData is greater or equal to the length of the VertexPool, since some vertices may be duplicated in the different GeomNodes.

That’s correct.

David