Egg Octree

Icycal :
I don’t think tag has any use outside .
You must not generated it with collide=1, did you ?
If you generated it with collide=1, the 's would have ‘barrier’ object type, which during loading time will be converted to collision polyset contained in collision node.

birukoff :
the author created that code only for collision, so he must strips all entries after until the with 1 huge bulk of .
So, what raytaller did with this :

egg.getFirstChild()
sourceNode = egg.getNextChild() # the sourcenode must contain a VertexPool and a list of Polygons

is :
egg.getFirstChild() is used to step on the , to reach the by using egg.getNextChild().
Yes, the children must be grabbed sequentially. To my eyes, that’s the limitation by reading the .egg using EggData.
If you want to use that code, the model must be exported as a single huge geometry, then remove all entries before , except and , eg. :

<CoordinateSystem> { Z-Up }

<Comment> {
  "comment comment comment"
}
<Group> whatever {
   <VertexPool> vpool {
     <Vertex> 0 {
       0.024505 0.004868 -0.002914
       <UV> { 0.535007 0.506954 }
       <Normal> { 0.191266 0.0336759 0.98096 }
       <RGBA> { 1 1 1 1 }
     }
.
.
.
}

If the is not inside , you must create the in order to triangulate it.

I hate that limitation, so I dropped the .egg reading using EggData. Instead, I used GeomVertexData directly to fetch the vertices and triangles.
The bonuses are :

  1. I can load any format, not only .egg
  2. I can select only the needed parts of the model to be processed, not the whole bulk

Addition :

  1. I created adjustible cell size visualizer
  2. randomly colored each resulting geom to easily distinguish them
    so I only need to run the code once, and keep splitting the model until satisfied with the result.
  3. added collide toggle, so when I have the desired result, I just need to toggle it and split the model once again to generate the collision mesh
    The output :
  4. the splitted .egg and .bam
  5. (if collide=0) 2 .bam’s, 1 is the randomly colored one, and 1 is white
    NOTE :
    it’s still only for collision, I don’t preserve any UV set and texture reference, only the vertex normal is preserved.
    Here it is :
    [EDIT] : see my next post