Python模块,用于tinyobjloader
项目描述
tinyobjloader,Wavefront .obj加载器
tinyobjloader
是C++ wavefront .obj加载器的Python封装。与纯Python版本的.obj加载器相比,tinyobjloader
速度更快,功能更丰富。
快速教程
import sys
import tinyobjloader
# Create reader.
reader = tinyobjloader.ObjReader()
filename = "cornellbox.obj"
# Load .obj(and .mtl) using default configuration
ret = reader.ParseFromFile(filename)
if ret == False:
print("Warn:", reader.Warning())
pint("Err:", reader.Error())
print("Failed to load : ", filename)
sys.exit(-1)
if reader.Warning():
print("Warn:", reader.Warning())
attrib = reader.GetAttrib()
print("attrib.vertices = ", len(attrib.vertices))
print("attrib.normals = ", len(attrib.normals))
print("attrib.texcoords = ", len(attrib.texcoords))
materials = reader.GetMaterials()
print("Num materials: ", len(materials))
for m in materials:
print(m.name)
print(m.diffuse)
shapes = reader.GetShapes()
print("Num shapes: ", len(shapes))
for shape in shapes:
print(shape.name)
print("num_indices = {}".format(len(shape.mesh.indices)))
更详细的用法
请查看tinyobjloader git repo中的python/sample.py
文件。
https://github.com/syoyo/tinyobjloader/blob/master/python/sample.py
许可证
MIT许可证。
待办事项
- 写入保存器
项目详情
关闭
tinyobjloader-0.1.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 7e860164a0e633d476fbc87d05b92db13f198d96a7a1c8e556134bc1a95d6932 |
|
MD5 | 4b7d74bdc61dcea610b6072ea8a8122e |
|
BLAKE2b-256 | c0eef447ed517ff301034b30a1f28fc76365f20bbb70480ca3b7d773803306b1 |
关闭
tinyobjloader-0.1-cp36-cp36m-manylinux1_x86_64.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 65067d820e56e1a2f36ef672641f3f9885ee9724b03ececa70bffaf00e40731f |
|
MD5 | cbf60aed4ec472c939bf1586f2dddb3c |
|
BLAKE2b-256 | 780f6f8b366ae3a30ce7aebd9080fea59723e459f624e64391274d9ae7cfa597 |