ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libgender/txtprt.py
(Generate patch)

Comparing libgender/txtprt.py (file contents):
Revision 1.2 by root, Sun Oct 3 03:46:37 2004 UTC vs.
Revision 1.3 by root, Sun Oct 3 04:14:33 2004 UTC

35 f.write(`s0` + " " + `s1` + " " + `s2` + " " + `material.specTransp` + "\n"); 35 f.write(`s0` + " " + `s1` + " " + `s2` + " " + `material.specTransp` + "\n");
36 s0 *= material.emit 36 s0 *= material.emit
37 s1 *= material.emit 37 s1 *= material.emit
38 s2 *= material.emit 38 s2 *= material.emit
39 f.write(`s0` + " " + `s1` + " " + `s2` + " 1\n"); 39 f.write(`s0` + " " + `s1` + " " + `s2` + " 1\n");
40 f.write(`material.spec` + "\n");
40 else: 41 else:
41 f.write("1 1 1 1\n"); 42 f.write("1 1 1 1\n");
42 f.write("0 0 0 1\n"); 43 f.write("0 0 0 1\n");
43 f.write("0 0 0 1\n"); 44 f.write("0 0 0 1\n");
45 f.write("0\n");
44 46
45 47
46 # Vertex Coordinate header 48 # Vertex Coordinate header
47 f.write("V " + `len(mesh.verts)` + "\n") 49 f.write("V " + `len(mesh.verts)` + "\n")
48 50
49 # Verticies 51 # Verticies
50 for vert in mesh.verts: 52 for vert in mesh.verts:
51 f.write(`vert.co[0]` + " " + `vert.co[1]` + " " + `vert.co[2]` + "\n") 53 f.write(`vert.co[0]` + " " + `vert.co[2]` + " " + `vert.co[1]` + "\n")
52 54
53 # Vertex Normal Header 55 # Vertex Normal Header
54 f.write("N " + `len(mesh.verts)` + "\n") 56 f.write("N " + `len(mesh.verts)` + "\n")
55 # Vertex Normals 57 # Vertex Normals
56 for vert in mesh.verts: 58 for vert in mesh.verts:
57 f.write(`vert.no[0]` + " " + `vert.no[1]` + " " + `vert.no[2]` + "\n") 59 f.write(`vert.no[0]` + " " + `vert.no[2]` + " " + `vert.no[1]` + "\n")
58 60
59 # uv coordinates 61 # uv coordinates
60 if mesh.hasVertexUV: 62 if mesh.hasVertexUV:
61 # UV header 63 # UV header
62 f.write("U " + `len(mesh.verts)` + "\n") 64 f.write("U " + `len(mesh.verts)` + "\n")
72 data = "" 74 data = ""
73 colordata = "" 75 colordata = ""
74 for face in mesh.faces: 76 for face in mesh.faces:
75 if len (face.v) < 4: 77 if len (face.v) < 4:
76 # triangle 78 # triangle
77 data = data + `face.v[0].index` + " " + `face.v[1].index` + " " + `face.v[2].index` + "\n" 79 data = data + `face.v[0].index` + " " + `face.v[2].index` + " " + `face.v[1].index` + "\n"
78 else: 80 else:
79 # this one is a quad 81 # this one is a quad
80 # Break it up into two triangles 82 # Break it up into two triangles
81 # Hence one additional face 83 # Hence one additional face
82 faces = faces + 1 84 faces = faces + 1
83 85
84 data = data + `face.v[0].index` + " " + `face.v[1].index` + " " + `face.v[3].index` + "\n" 86 data = data + `face.v[0].index` + " " + `face.v[3].index` + " " + `face.v[1].index` + "\n"
85 data = data + `face.v[1].index` + " " + `face.v[2].index` + " " + `face.v[3].index` + "\n" 87 data = data + `face.v[1].index` + " " + `face.v[3].index` + " " + `face.v[2].index` + "\n"
86 # Now I can write the header with the correct face count, and then the data 88 # Now I can write the header with the correct face count, and then the data
87 f.write("A " + `faces` + "\n") 89 f.write("A " + `faces` + "\n")
88 f.write(data) 90 f.write(data)
89 91
90 92

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines