]> git.tdb.fi Git - libs/gl.git/commitdiff
Blender exporter: Generate correct normals for smooth vertices
authorMikko Rasa <tdb@tdb.fi>
Thu, 11 Oct 2007 15:10:17 +0000 (15:10 +0000)
committerMikko Rasa <tdb@tdb.fi>
Thu, 11 Oct 2007 15:10:17 +0000 (15:10 +0000)
mesh_export.py

index d7531b36c0f5210d56b8085463c116db0d6e67fd..0158bdbf9189d3cff6e2bedae25b8e040601d02b 100644 (file)
@@ -83,13 +83,16 @@ class SmoothGroup:
                                v=f.verts[i]
                                if v.index not in vert_map:
                                        vt=Vertex(v)
-                                       if not f.smooth:
-                                               vt.no=f.no
+                                       vt.no=Blender.Mathutils.Vector(f.no)
                                        self.verts.append(vt)
                                        vert_map[v.index]=vt
                                        f.verts[i]=vt
                                else:
                                        f.verts[i]=vert_map[v.index]
+                                       vert_map[v.index].no+=f.no
+
+               for v in self.verts:
+                       v.no.normalize()
 
 
 class Exporter: