X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=examples%2Fmqobuilder.py;h=cc20b664024a2d179204560fe87e0868d1f56692;hb=924bae1667aea0f57dd3de11b1248c12bc9a95d1;hp=b73fbe81d7580b1b3bcecd74a768ba8bdee14ad9;hpb=f2381b1a90cf4781c5e3dbf9a6762e15ec63f39b;p=meshio%2Fpymeshio.git diff --git a/examples/mqobuilder.py b/examples/mqobuilder.py index b73fbe8..cc20b66 100644 --- a/examples/mqobuilder.py +++ b/examples/mqobuilder.py @@ -3,30 +3,36 @@ import time import os -import pymeshio.mqo -from opengl import material -from opengl import vertexarraymap +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=vertexarraymap.VertexArrayMapWithUV( - [material.MQOMaterial.create(m, basedir) - for m in io.materials]) - for o in io.objects: + vertexArrayMap=opengl.vertexarraymap.VertexArrayMapWithUV() + 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.decode('cp932')) + material.texture=opengl.texture.Texture(texturepath) + vertexArrayMap.addMaterial(material) + + 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: