def _writeVertex(self, file, vert, vtype, idx=0): pos = vert.pos[idx] normal = vert.normal color = vert.vSColor uv = vert.UV[0] uv2 = vert.UV[1] tangent = vert.tangent binormal = vert.biNormal spos = '%.6f %.6f %.6f ' % (pos.x, pos.z, pos.y) snormal = '%.6f %.6f %.6f ' % (normal.x, normal.z, normal.y) if color != None and self.material.useVertexColor: scolor = iUtils.colour2str(color) + ' ' else: scolor = iUtils.del2SColor(self.material.getDiffuse()) + ' ' suv = '%.6f %.6f ' % (uv.x, 1-uv.y) if vtype == iMaterials.EVT_STANDARD: file.write(' ' + spos + snormal + scolor + suv + '\n') return if vtype == iMaterials.EVT_2TCOORDS: suv2 = '%.6f %.6f' % (uv2.x, 1-uv2.y) file.write(' ' + spos + snormal + scolor + suv + suv2 + '\n') return stangent = '%.6f %.6f %.6f ' % (tangent.x, tangent.z, tangent.y) sbinormal = '%.6f %.6f %.6f' % (binormal.x, binormal.z, binormal.y) file.write(' ' + spos + snormal + scolor + suv + stangent + sbinormal + '\n')
def _iwrite(self,file,tag,name,value,indent): svalue = '?enum?' if tag == 'enum': svalue = value elif tag == 'color': svalue = iUtils.del2SColor(value) elif tag == 'float': svalue = iUtils.float2str(value) elif tag == 'texture': svalue = value elif tag == 'int': svalue = iUtils.int2str(value) elif tag == 'bool': svalue = iUtils.bool2str(value) out = indent + '<%s name="%s" value="%s"/>\n' % (tag,name,svalue) file.write(out)
def _iwrite(self, file, tag, name, value): svalue = "?enum?" if tag == "enum": svalue = value elif tag == "color": svalue = iUtils.del2SColor(value) elif tag == "float": svalue = iUtils.float2str(value) elif tag == "texture": svalue = value elif tag == "int": svalue = iUtils.int2str(value) elif tag == "bool": svalue = iUtils.bool2str(value) out = ' <%s name="%s" value="%s"/>\n' % (tag, name, svalue) file.write(out)