Cesium原理篇:6 Render模块(5: VAO&RenderState&Command)
VAO
VAO(Vertext Array Object),中文是顶点数组对象。之前在《Buffer》一文中,我们介绍了Cesium如何创建VBO的过程,而VAO可以简单的认为是基于VBO的一个封装,为顶点属性数组和VBO中的顶点数据之间建立了关联。我们来看一下使用示例:
var indexBuffer = Buffer.createIndexBuffer({ context : context, typedArray : indices, usage : BufferUsage.STATIC_DRAW, indexDatatype : indexDatatype }); var buffer = Buffer.createVertexBuffer({ context : context, typedArray : typedArray, usage : BufferUsage.STATIC_DRAW }); // 属性数组,当前是顶点数据z // 因此,该属性有3个分量XYZ // 值类型为float,4个字节 // 因此总共占3 *4= 12字节 attributes.push({ index : 0, vertexBuffer : buffer, componentsPerAttribute : 3, componentDatatype : ComponentDatatype.FLOAT, offsetInBytes : 0, strideInBytes : 3 * 4网友评论


