- out_file.write("vertex3", *v.co)
- out_file.end()
- for s in strips:
- out_file.begin("batch", "TRIANGLE_STRIP")
- indices = []
- n = 0
- for v in s:
- indices.append(v.index)
- if len(indices)>=32:
- out_file.write("indices", *indices)
- indices = []
- if indices:
- out_file.write("indices", *indices)
- out_file.end()
-
- if loose:
- out_file.begin("batch", "TRIANGLES")
- for f in loose:
- for i in range(2, len(f.vertices)):
- out_file.write("indices", f.vertices[0].index, f.vertices[i-1].index, f.vertices[i].index)
- out_file.end()
+ st.sub.append(Statement("vertex", *v.co))
+
+ statements.append(st)
+
+ if self.use_strips:
+ strips = mesh.vertex_sequence
+ if self.use_degen_tris:
+ strips = [self.join_strips(strips)]
+
+ for s in strips:
+ st = Statement("batch", Token("TRIANGLE_STRIP"))
+ for i in range(0, len(s), 32):
+ st.sub.append(Statement("indices", *(v.index for v in s[i:i+32])))
+ statements.append(st)
+ else:
+ st = Statement("batch", "TRIANGLES")
+ for f in mesh.faces:
+ st.sub.append(Statement("indices", *(v.index for v in f.vertices)))
+ statements.append(st)