Primitives
图元
A 3D primitive is a collection of vertices that form a single 3D entity. The simplest primitive is a collection of points in a 3D coordinate system, which is called a point list.
一个3D图元是一个顶点的集合来自一个单一的3D实体。最简单的图元是一个集合的点在3D坐标系中,那被叫做点集合。
Often, 3D primitives are polygons. A polygon is a closed 3D figure delineated by at least three vertices. The simplest polygon is a triangle. Microsoft Direct3D uses triangles to compose most of its polygons because all three vertices in a triangle are guaranteed to be coplanar. Rendering nonplanar vertices is inefficient. You can combine triangles to form large, complex polygons and meshes.
通常,3D图元是多边形的,一个多边形是一个由三个顶点组成的闭合的3D图形,最简单的多边形是三角形。Direct3D用三角形去组成大多数多边形是因为三角形中的所有三个顶点是一定共面的。渲染不共面的顶点是低效的。你可以组合三角形去形成更大、更复杂的多边形和网格
Direct3D定义了6中基本图元。
Defines the primitives supported by Direct3D.
typedef enum D3DPRIMITIVETYPE
{
D3DPT_POINTLIST = 1,
D3DPT_LINELIST = 2,
D3DPT_LINESTRIP = 3,
D3DPT_TRIANGLELIST = 4,
D3DPT_TRIANGLESTRIP = 5,
D3DPT_TRIANGLEFAN = 6,
D3DPT_FORCE_DWORD = 0x7fffffff,
} D3DPRIMITIVETYPE, *LPD3DPRIMITIVETYPE;
- D3DPT_POINTLIST
- Renders the vertices as a collection of isolated points. This value is unsupported for indexed primitives.
- D3DPT_LINELIST
- Renders the vertices as a list of isolated straight line segments.
- D3DPT_LINESTRIP
- Renders the vertices as a single polyline.
- D3DPT_TRIANGLELIST
Renders the specified vertices as a sequence of isolated triangles. Each group of three vertices defines a separate triangle.
- Back-face culling is affected by the current winding-order render state.
- D3DPT_TRIANGLESTRIP
- Renders the vertices as a triangle strip. The backface-culling flag is automatically flipped on even-numbered triangles.
- D3DPT_TRIANGLEFAN
- Renders the vertices as a triangle fan.
- D3DPT_FORCE_DWORD
- Forces this enumeration to compile to 32 bits in size. Without this value, some compilers would allow this enumeration to
compile to a size other than 32 bits. This value is not used.