顶点和索引缓冲区Vertex and index buffers

顶点缓冲区是包含顶点数据的内存缓冲区;将处理顶点缓冲区中的顶点以执行转换、照明和剪裁。Vertex buffers are memory buffers that contain vertex data; vertices in a vertex buffer are processed to perform transformation, lighting, and clipping. 索引缓冲区是包含索引数据的内存缓冲区,索引数据是到顶点缓冲区的整数偏移量,用于渲染基元。Index buffers are memory buffers that contain index data, which are integer offsets into vertex buffers, used to render primitives.

顶点缓冲区可包含可呈现的任何顶点类型(已转换或未转换、已亮起或未亮起)。Vertex buffers can contain any vertex type - transformed or untransformed, lit or unlit - that can be rendered. 你可以处理顶点缓冲区中的顶点以执行转换、照明、生成剪裁标志等操作。You can process the vertices in a vertex buffer to perform operations such as transformation, lighting, or generating clipping flags. 转换始终会执行。Transformation is always performed.

顶点缓冲区的灵活性使其成为重复使用已转换几何图形的理想暂存点。The flexibility of vertex buffers make them ideal staging points for reusing transformed geometry. 你可以创建单顶点缓冲区,对其中的顶点进行转换、照明和剪裁,以及将场景中的模型呈现所需的次数而不对其进行再转换,甚至在内插的呈现状态更改时也是如此。You could create a single vertex buffer, transform, light, and clip the vertices in it, and render the model in the scene as many times as needed without re-transforming it, even with interleaved render state changes. 当呈现使用多个纹理的模型时,这很有用:几何图形只转换一次,然后它的各个部分可以呈现所需的次数,并与所需的纹理更改交错。This is useful when rendering models that use multiple textures: the geometry is transformed only once, and then portions of it can be rendered as needed, interleaved with the required texture changes. 在处理顶点后进行的呈现状态更改在下次处理顶点时生效。Render state changes made after vertices are processed take effect the next time the vertices are processed.

本部分中的内容In this section

主题Topic 描述Description

缓冲区简介Introduction to buffers

缓冲区资源是一系列完全类型化的数据,被分组到元素中。A buffer resource is a collection of fully typed data, grouped into elements. 缓冲区将存储数据,如顶点缓冲区 中的纹理坐标、索引缓冲区 中的索引、常量缓冲区 中的着色器常量数据、位置矢量、法向矢量或设备状态。Buffers store data, such as texture coordinates in a vertex buffer, indexes in an index buffer, shader constants data in a constant buffer, position vectors, normal vectors, or device state.

索引缓冲区Index buffers

索引缓冲区是包含索引数据的内存缓冲区,索引数据是到顶点缓冲区的整数偏移量,用于渲染基元。Index buffers are memory buffers that contain index data, which are integer offsets into vertex buffers, used to render primitives.

 

相关主题Related topics

Direct3D 图形学习指南Direct3D Graphics Learning Guide