def writeGeometry(fp, mesh, config, shapes=None):
    progress = Progress()
    progress(0)
    coord = (mesh.coord + config.offset)
    coord = rotateCoord(coord, config)
    nVerts = len(coord)
    fp.write(((((('\n' + ('    <geometry id="%sMesh" name="%s">\n' % (mesh.name, mesh.name))) + '      <mesh>\n') + ('        <source id="%s-Position">\n' % mesh.name)) + ('          <float_array count="%d" id="%s-Position-array">\n' % ((3 * nVerts), mesh.name))) + '          '))
    fp.write(''.join([('%.4f %.4f %.4f ' % tuple(co)) for co in coord]))
    fp.write(((((((((('\n' + '          </float_array>\n') + '          <technique_common>\n') + ('            <accessor count="%d" source="#%s-Position-array" stride="3">\n' % (nVerts, mesh.name))) + '              <param type="float" name="X"></param>\n') + '              <param type="float" name="Y"></param>\n') + '              <param type="float" name="Z"></param>\n') + '            </accessor>\n') + '          </technique_common>\n') + '        </source>\n'))
    progress(0.2)
    if config.useNormals:
        mesh.calcNormals()
        vnorm = rotateCoord(mesh.vnorm, config)
        nNormals = len(mesh.vnorm)
        fp.write(((('        <source id="%s-Normals">\n' % mesh.name) + ('          <float_array count="%d" id="%s-Normals-array">\n' % ((3 * nNormals), mesh.name))) + '          '))
        fp.write(''.join([('%.4f %.4f %.4f ' % tuple(no)) for no in vnorm]))
        fp.write(((((((((('\n' + '          </float_array>\n') + '          <technique_common>\n') + ('            <accessor count="%d" source="#%s-Normals-array" stride="3">\n' % (nNormals, mesh.name))) + '              <param type="float" name="X"></param>\n') + '              <param type="float" name="Y"></param>\n') + '              <param type="float" name="Z"></param>\n') + '            </accessor>\n') + '          </technique_common>\n') + '        </source>\n'))
        progress(0.35)
    nUvVerts = len(mesh.texco)
    fp.write(((('        <source id="%s-UV">\n' % mesh.name) + ('          <float_array count="%d" id="%s-UV-array">\n' % ((2 * nUvVerts), mesh.name))) + '           '))
    fp.write(''.join([('%.4f %.4f ' % tuple(uv)) for uv in mesh.texco]))
    fp.write((((((((('\n' + '          </float_array>\n') + '          <technique_common>\n') + ('            <accessor count="%d" source="#%s-UV-array" stride="2">\n' % (nUvVerts, mesh.name))) + '              <param type="float" name="S"></param>\n') + '              <param type="float" name="T"></param>\n') + '            </accessor>\n') + '          </technique_common>\n') + '        </source>\n'))
    progress(0.5, 0.7)
    fp.write(((('        <vertices id="%s-Vertex">\n' % mesh.name) + ('          <input semantic="POSITION" source="#%s-Position"/>\n' % mesh.name)) + '        </vertices>\n'))
    checkFaces(mesh, nVerts, nUvVerts)
    progress(0.7, 0.9)
    writePolylist(fp, mesh, config)
    progress(0.9, 0.99)
    fp.write(('      </mesh>\n' + '    </geometry>\n'))
    if (shapes is not None):
        shaprog = Progress(len(shapes))
        for (name, shape) in shapes:
            writeShapeKey(fp, name, shape, mesh, config)
            shaprog.step()
    progress(1)
def writeGeometry(fp, mesh, config, shapes=None):
    progress = Progress()
    progress(0)
    coord = (mesh.coord + config.offset)
    coord = rotateCoord(coord, config)
    nVerts = len(coord)
    fp.write(((((('\n' + ('    <geometry id="%sMesh" name="%s">\n' % (mesh.name, mesh.name))) + '      <mesh>\n') + ('        <source id="%s-Position">\n' % mesh.name)) + ('          <float_array count="%d" id="%s-Position-array">\n' % ((3 * nVerts), mesh.name))) + '          '))
    fp.write(.join([('%.4f %.4f %.4f ' % tuple(co)) for co in coord]))
    fp.write(((((((((('\n' + '          </float_array>\n') + '          <technique_common>\n') + ('            <accessor count="%d" source="#%s-Position-array" stride="3">\n' % (nVerts, mesh.name))) + '              <param type="float" name="X"></param>\n') + '              <param type="float" name="Y"></param>\n') + '              <param type="float" name="Z"></param>\n') + '            </accessor>\n') + '          </technique_common>\n') + '        </source>\n'))
    progress(0.2)
    if config.useNormals:
        mesh.calcNormals()
        vnorm = rotateCoord(mesh.vnorm, config)
        nNormals = len(mesh.vnorm)
        fp.write(((('        <source id="%s-Normals">\n' % mesh.name) + ('          <float_array count="%d" id="%s-Normals-array">\n' % ((3 * nNormals), mesh.name))) + '          '))
        fp.write(.join([('%.4f %.4f %.4f ' % tuple(no)) for no in vnorm]))
        fp.write(((((((((('\n' + '          </float_array>\n') + '          <technique_common>\n') + ('            <accessor count="%d" source="#%s-Normals-array" stride="3">\n' % (nNormals, mesh.name))) + '              <param type="float" name="X"></param>\n') + '              <param type="float" name="Y"></param>\n') + '              <param type="float" name="Z"></param>\n') + '            </accessor>\n') + '          </technique_common>\n') + '        </source>\n'))
        progress(0.35)
    nUvVerts = len(mesh.texco)
    fp.write(((('        <source id="%s-UV">\n' % mesh.name) + ('          <float_array count="%d" id="%s-UV-array">\n' % ((2 * nUvVerts), mesh.name))) + '           '))
    fp.write(.join([('%.4f %.4f ' % tuple(uv)) for uv in mesh.texco]))
    fp.write((((((((('\n' + '          </float_array>\n') + '          <technique_common>\n') + ('            <accessor count="%d" source="#%s-UV-array" stride="2">\n' % (nUvVerts, mesh.name))) + '              <param type="float" name="S"></param>\n') + '              <param type="float" name="T"></param>\n') + '            </accessor>\n') + '          </technique_common>\n') + '        </source>\n'))
    progress(0.5, 0.7)
    fp.write(((('        <vertices id="%s-Vertex">\n' % mesh.name) + ('          <input semantic="POSITION" source="#%s-Position"/>\n' % mesh.name)) + '        </vertices>\n'))
    checkFaces(mesh, nVerts, nUvVerts)
    progress(0.7, 0.9)
    writePolylist(fp, mesh, config)
    progress(0.9, 0.99)
    fp.write(('      </mesh>\n' + '    </geometry>\n'))
    if (shapes is not None):
        shaprog = Progress(len(shapes))
        for (name, shape) in shapes:
            writeShapeKey(fp, name, shape, mesh, config)
            shaprog.step()
    progress(1)