现在的位置: 首页 > 综合 > 正文

obj format

2018年02月06日 ⁄ 综合 ⁄ 共 1202字 ⁄ 字号 评论关闭

mtllib cube.mtl
o Cube
v 1.0 1.0 -1.0
v 1.0 -1.0 -1.0
v -1.0 -1.0 -1.0
v -1.0 1.0 -1.0
v 1.0 1.0 1.0
v 1.0 -1.0 1.0
v -1.0 -1.0 1.0
v -1.0 1.0 1.0
vt 0.0 0.0
vt 1.0 0.0
vt 1.0 1.0
vt 0.0 1.0
vn 0.0 1.0 0.0
vn -1.0 0.0 0.0
vn 0.0 -1.0 0.0
vn 1.0 0.0 0.0
vn 1.0 0.0 0.0
vn 0.0 0.0 1.0
vn 0.0 0.0 -1.0
usemtl Material_diffuse.jpg
f 5/1/1 1/2/1 4/3/1
f 5/1/1 4/3/1 8/4/1
f 3/1/2 7/2/2 8/3/2
f 3/1/2 8/3/2 4/4/2
f 2/1/3 6/2/3 3/4/3
f 6/2/3 7/3/3 3/4/3
f 1/1/4 5/2/4 2/4/4
f 5/2/5 6/3/5 2/4/5

f 5/1/6 8/2/6 6/4/6

f 8/2/6 7/3/6 6/4/6
f 1/1/7 2/2/7 3/3/7
f 1/1/7 3/3/7 4/4/7
With just a quick glance at the fi le content, you can tell what most lines represent — starting with
mtllib, which represents the material library associated with the geometry file.
Then you can fi nd an
object declaration, represented by the token o, followed by each set of indexed vertex positions (v).
Next comes the indexed texture coordinates (vt), also known as UVs, and the vertex normals (vn).
After the vertex data declaration, the usemtl line specifi es which material will be used for the incoming
faces. Then, for each face, three sets of vertex positions, UV, and normal index are specifi ed (the f lines).

Each of these sets basically represents a triangle. Wavefront OBJ also supports a quad (which would be
read as four sets); however, since every face representation in GLES has to be defi ned as a triangle, make
sure you triangulate the faces of your meshes before you export them to the OBJ format.

【上篇】
【下篇】

抱歉!评论已关闭.