WaveFront .obj 文件 - “f”命令有什么作用?

DCS*_*oft 3 java wavefront

我一直在阅读David Brackeen 的《用 Java 开发游戏》。到现在为止我已经明白了书中的所有内容。在 Wavefront 对象文件中,我理解该v命令的作用,但不理解该f命令。例如:

# OBJ - Wavefront object file
# The javagamebook loader only understands these commands:
#   mtllib <filename>    - Load materials from an external .mtl
#                          file.
#   v <x> <y> <z>        - Define a vertex with floating-point
#                          coords (x,y,z).
#   f <v1> <v2> <v3> ... - Define a new face. a face is a flat,
#                          convex polygon with vertices in
#                          counter-clockwise order. Positive
#                          numbers indicate the index of the
#                          vertex that is defined in the file.
#                          Negative numbers indicate the vertex
#                          defined relative to last vertex read.
#                          For example, 1 indicates the first
#                          vertex in the file, -1 means the last
#                          vertex read, and -2 is the vertex
#                          before that.
#   g <name>             - Define a new group by name. The faces
#                          following are added to this group.
#   usemtl <name>        - Use the named material (loaded from a
#                          .mtl file) for the faces in this group.

# load materials
mtllib textures.mtl

# define vertices
v 16 32 16
v 16 32 -16
v 16 0 16
v 16 0 -16
v -16 32 16
v -16 32 -16
v -16 0 16
v -16 0 -16

g myCube
usemtl wall1
f 1 3 4 2
f 6 8 7 5
f 2 6 5 1
f 3 7 8 4
f 1 5 7 3
f 4 8 6 2
Run Code Online (Sandbox Code Playgroud)

该命令在这里做什么f

sta*_*ker 6

立方体有八个角(用顶点或点表示),由 v 定义(v 表示顶点)。面 (f) 是由角的坐标 (v) 定义的表面,有关说明,请参见Polygon_mesh

    v1+-----------+  v2
     /            /
    /     f1     /
   /            /
v4+------------+v3
  |            |
  |            |
  |     f2     |
  |            |
  |            |
v6+------------+v5
Run Code Online (Sandbox Code Playgroud)

这意味着面f1由v1、v2、v3和v4定义;f2 由 v4,v3,v5,v6。