X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=examples%2Fmqobuilder.py;h=cc20b664024a2d179204560fe87e0868d1f56692;hb=909e9ce1deb21d4f1697ec18b4520e5e122dce92;hp=b0dcd887f4a14527eac1f906a934efb290729673;hpb=7adaa26517b66d4c8cf8e409e008893e957fe305;p=meshio%2Fpymeshio.git diff --git a/examples/mqobuilder.py b/examples/mqobuilder.py index b0dcd88..cc20b66 100644 --- a/examples/mqobuilder.py +++ b/examples/mqobuilder.py @@ -3,37 +3,36 @@ import time import os -import pymeshio.mqo +import pymeshio.mqo.reader import opengl.material import opengl.texture import opengl.vertexarraymap def build(path): - # load scenee t=time.time() - io=pymeshio.mqo.IO() - if not io.read(path): + model=pymeshio.mqo.reader.read_from_file(path) + if not model: return print(time.time()-t, "sec") # build basedir=os.path.dirname(path) vertexArrayMap=opengl.vertexarraymap.VertexArrayMapWithUV() - for m in io.materials: + for m in model.materials: material=opengl.material.MQOMaterial() material.rgba=(m.color.r, m.color.g, m.color.b, m.color.a) if m.tex: - texturepath=os.path.join(basedir, m.tex) + texturepath=os.path.join(basedir, m.tex.decode('cp932')) material.texture=opengl.texture.Texture(texturepath) vertexArrayMap.addMaterial(material) - for o in io.objects: + for o in model.objects: # skip mikoto objects - if o.name.startswith("anchor"): + if o.name.startswith(b"anchor"): continue - if o.name.startswith("bone:"): + if o.name.startswith(b"bone:"): continue - if o.name.startswith("MCS:"): + if o.name.startswith(b"MCS:"): continue for f in o.faces: