def loadSingle()

in jsuarez/extra/embyr_deprecated/embyr/embyr3D.py [0:0]


    def loadSingle(obj, texf=None):
       assert len(obj.materials) == 1
       material = obj.materials[0]

       if texf is None:
          texf = material.texture.image_name
       tex = Image(texf).texture

       vertices = material.vertices
       nVertex = len(vertices) / material.vertex_size
       indices = np.arange(nVertex).astype(int).tolist()
       fmt = OBJLoader.formats(material.vertex_format)

       kw  = {"vertices": vertices, "indices": indices,
              "fmt": fmt,
              "mode": "triangles",
              'texture':tex
              }

       mesh = KivyMesh(**kw)
       mat = Material(tex)
       return mesh, mat