I created a flat square model (in the xz plane) and wrote it to an egg file. I then loaded that model in a different script. When loaded, the model “sticks up” as if it were modeled in the xy plane instead. Is there a problem in the code writing out the model?
eggData = EggData()
vp = EggVertexPool("square")
eggData.addChild(vp)
poly = EggPolygon()
eggData.addChild(poly)
v = EggVertex()
v.setPos(Point3D(0, 0, 0))
v.setUv(Point2D(0,0))
poly.addVertex(vp.addVertex(v))
v = EggVertex()
v.setPos(Point3D(1, 0, 0))
v.setUv(Point2D(1,0))
poly.addVertex(vp.addVertex(v))
v = EggVertex()
v.setPos(Point3D(1, 0, 1))
v.setUv(Point2D(1,1))
poly.addVertex(vp.addVertex(v))
v = EggVertex()
v.setPos(Point3D(0, 0, 1))
v.setUv(Point2D(0,1))
poly.addVertex(vp.addVertex(v))
eggData.recomputePolygonNormals()
eggData.writeEgg(Filename("square.egg"))
The .egg file itself seems to have the right information:
<VertexPool> square {
<Vertex> 0 {
0 0 0
<UV> { 0 0 }
}
<Vertex> 1 {
1 0 0
<UV> { 1 0 }
}
<Vertex> 2 {
1 0 1
<UV> { 1 1 }
}
<Vertex> 3 {
0 0 1
<UV> { 0 1 }
}
}
<Polygon> {
<Normal> { 0 -1 0 }
<VertexRef> { 0 1 2 3 <Ref> { square } }
}