OBJFILELOADER-pygame [英] OBJFILELOADER - pygame
本文介绍了OBJFILELOADER-pygame的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我尝试运行代码,但是它给出了超出索引范围错误的列表.我将索引从1更改为0,但屏幕仅弹出黑色.我该如何更改代码才能使其正常工作?
So I tried running the code but it gives list out of index range error. I changed the index from 1 to 0, but the screen only pops up black. How could I change the code to make it work?
推荐答案
您只需要将.obj文件的文件名/路径传递给OBJ
类:
You just have to pass the filename/path of the .obj file to the OBJ
class:
obj = OBJ('suzzane.obj')
此外,该脚本是用Python 2编写的,如果要在Python 3中使用它,则必须更新一些内容.
Also, the script was written in Python 2 and if you want to use it with Python 3, you have to update a few things.
更改此行,
raise ValueError, "mtl file doesn't start with newmtl stmt"
收件人:
raise ValueError("mtl file doesn't start with newmtl stmt")
所有map
迭代器都必须转换为列表:
And all the map
iterators have to be turned into lists:
mtl[values[0]] = map(float, values[1:])
# Just call `list()`.
mtl[values[0]] = list(map(float, values[1:]))
这篇关于OBJFILELOADER-pygame的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文