Alternative generation EGG file


#1

This method is not fast, but the structure is easier to manage.


Code:

demo.7z (7.38 KB)

Short example of an idea:

from pandac.PandaModules import EggData, StringStream, loadEggData, NodePath
import direct.directbase.DirectStart

egg = '''<Group>  Plane {
      <VertexPool> Plane {
      <Vertex> 0 { -1 -1 0 }
      <Vertex> 1 { 1 -1 0 }
      <Vertex> 2 { 1 1 0 }
      <Vertex> 3 { -1 1 0 }
      }
      
      <Polygon> 0 {
      <Normal> { 0 0 1 }
      <VertexRef> { 0 1 2 3 <Ref> { Plane } }
      }
      }'''

Create_egg = EggData()
Create_egg.read(StringStream(egg))

base.cam.setPos(0, -3, 0)

# Put a sign comments on this line, to save the file.
tiles = render.attachNewNode(loadEggData(Create_egg))

# write file
#Create_egg.writeEgg("tiles.egg") 

base.run()

Parametrical Egg models