[Edu-sig] More on Panda3D

kirby urner kirby.urner at gmail.com
Mon May 8 20:19:44 CEST 2006


So I think the first thing will be to write a new subclass of writer,
as I've already done for VRML, VRML2, EIG, POV-Ray, and Live3D.[1]

There's already an Egg API that will allow me to avoid low-level
bricking in with strings (no direct eggfile.write('stuff')).  Here's
what it looks like (from the documentation [2]):

def makeWedge(angleDegrees = 360, numSteps = 16):
    data = EggData()

    vp = EggVertexPool('fan')
    data.addChild(vp)

    poly = EggPolygon()
    data.addChild(poly)

    v = EggVertex()
    v.setPos(Point3D(0, 0, 0))
    poly.addVertex(vp.addVertex(v))

    angleRadians = deg2Rad(angleDegrees)

    for i in range(numSteps + 1):
        a = angleRadians * i / numSteps
        y = math.sin(a)
        x = math.cos(a)

        v = EggVertex()
        v.setPos(Point3D(x, 0, y))
        poly.addVertex(vp.addVertex(v))

    # To write the egg file to disk, use this:
    data.writeEgg(Filename("wedge.egg"))

    # To load the egg file and render it immediately, use this:
    node = loadEggData(data)
    return NodePath(node)

So I'll just suck up a Polyhedron from my rbf.py, spoon feed the
vertices and polygons via the Egg API, then load the egg in a Panda
scenegraph for display.

I should be getting my initial results shortly.  I'll publish some source code.

Query:  could we reimplement the whole Elastic Interval Geometry thing
inside of Panda3D.  At this point, I see no reason why not.  If we
treated the intervals as changing-size Bones at runtime, I bet we
could get some interesting Creatures.

I recently sent a heads-up to Gerald (originator of EIG, inspired by
Kenneth Snelson [3]), regarding my appreciative mention of his work  a
few times in my LKL talk.[4]

Kirby

[1]  http://www.4dsolutions.net/ocn/python/povray.html  (example POV writer)

[2]  http://panda3d.etc.cmu.edu/wiki/index.php/Writing_3D_Models_out_to_Disk

[3]  Kenneth Snelson:
      http://www.kennethsnelson.net/
      http://www.grunch.net/snelson/
      http://worldgame.blogspot.com/2006/05/barrel-tower.html

[4]  http://bfi.org/pythonicmathematics


More information about the Edu-sig mailing list