')
-
-
- # Vertex Array
- self.writel(S_GEOM,3,'')
- float_values=""
- for v in vertices:
- float_values+=" "+str(v.vertex.x)+" "+str(v.vertex.y)+" "+str(v.vertex.z)
- self.writel(S_GEOM,4,''+float_values+'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,5,'')
- self.writel(S_GEOM,5,'')
- self.writel(S_GEOM,5,'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,3,'')
-
- # Normal Array
-
- self.writel(S_GEOM,3,'')
- float_values=""
- for v in vertices:
- float_values+=" "+str(v.normal.x)+" "+str(v.normal.y)+" "+str(v.normal.z)
- self.writel(S_GEOM,4,''+float_values+'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,5,'')
- self.writel(S_GEOM,5,'')
- self.writel(S_GEOM,5,'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,3,'')
-
- if (has_tangents):
- self.writel(S_GEOM,3,'')
- float_values=""
- for v in vertices:
- float_values+=" "+str(v.tangent.x)+" "+str(v.tangent.y)+" "+str(v.tangent.z)
- self.writel(S_GEOM,4,''+float_values+'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,5,'')
- self.writel(S_GEOM,5,'')
- self.writel(S_GEOM,5,'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,3,'')
-
- self.writel(S_GEOM,3,'')
- float_values=""
- for v in vertices:
- float_values+=" "+str(v.bitangent.x)+" "+str(v.bitangent.y)+" "+str(v.bitangent.z)
- self.writel(S_GEOM,4,''+float_values+'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,5,'')
- self.writel(S_GEOM,5,'')
- self.writel(S_GEOM,5,'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,3,'')
-
-
-
- # UV Arrays
-
- for uvi in range(uv_layer_count):
-
- self.writel(S_GEOM,3,'')
- float_values=""
- for v in vertices:
- try:
- float_values+=" "+str(v.uv[uvi].x)+" "+str(v.uv[uvi].y)
- except:
- # I don't understand this weird multi-uv-layer API, but with this it seems to works
- float_values+=" 0 0 "
-
- self.writel(S_GEOM,4,''+float_values+'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,5,'')
- self.writel(S_GEOM,5,'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,3,'')
-
- # Color Arrays
-
- if (has_colors):
- self.writel(S_GEOM,3,'')
- float_values=""
- for v in vertices:
- float_values+=" "+str(v.color.x)+" "+str(v.color.y)+" "+str(v.color.z)
- self.writel(S_GEOM,4,''+float_values+'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,5,'')
- self.writel(S_GEOM,5,'')
- self.writel(S_GEOM,5,'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,3,'')
-
- # Triangle Lists
- self.writel(S_GEOM,3,'')
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,3,'')
-
- prim_type=""
- if (triangulate):
- prim_type="triangles"
- else:
- prim_type="polygons"
-
-
- for m in surface_indices:
- indices = surface_indices[m]
- mat = materials[m]
-
- if (mat!=None):
- matref = self.new_id("trimat")
- self.writel(S_GEOM,3,'<'+prim_type+' count="'+str(int(len(indices)))+'" material="'+matref+'">') # todo material
- mat_assign.append( (mat,matref) )
- else:
- self.writel(S_GEOM,3,'<'+prim_type+' count="'+str(int(len(indices)))+'">') # todo material
-
-
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,4,'')
-
- for uvi in range(uv_layer_count):
- self.writel(S_GEOM,4,'')
-
- if (has_colors):
- self.writel(S_GEOM,4,'')
- if (has_tangents):
- self.writel(S_GEOM,4,'')
- self.writel(S_GEOM,4,'')
-
- if (triangulate):
- int_values=""
- for p in indices:
- for i in p:
- int_values+=" "+str(i)
- int_values+="
"
- self.writel(S_GEOM,4,int_values)
- else:
- for p in indices:
- int_values=""
- for i in p:
- int_values+=" "+str(i)
- int_values+="
"
- self.writel(S_GEOM,4,int_values)
-
- self.writel(S_GEOM,3,''+prim_type+'>')
-
-
- self.writel(S_GEOM,2,'')
- self.writel(S_GEOM,1,'