Class: VertexArrayObject

VertexArrayObject

new VertexArrayObject(gl, id, params)

VAO

Name Type Description
gl WebGLRenderingContext
id String

缓存id

params Object

Members Show Inherited

Name Type Default Description
className String VertexArrayObject
isVertexArrayObject Boolean true
useVao Boolean false

是否使用 vao

useInstanced Boolean false

是否使用 instanced

mode GLEnum gl.TRIANGLES

绘图方式

isDirty Boolean true

是否脏

Methods Show Inherited

bind

unbind

draw

getVertexCount(){Number}

获取顶点数量

Returns:
Type Description
Number 顶点数量

drawInstance(primcount)

drawInstance

Name Type Default Description
primcount Number 1 optional

addIndexBuffer(data, usage){Buffer}

addIndexBuffer

Name Type Description
data GeometryData
usage GLenum

gl.STATIC_DRAW|gl.DYNAMIC_DRAW

Returns:
Type Description
Buffer Buffer

addAttribute(geometryData, attribute, usage, onInit){AttributeObject}

addAttribute

Name Type Description
geometryData GeometryData
attribute Object
usage GLenum

gl.STATIC_DRAW|gl.DYNAMIC_DRAW

onInit function
Returns:
Type Description
AttributeObject attributeObject

addInstancedAttribute(attribute, meshes, getData){AttributeObject}

addInstancedAttribute

Name Type Description
attribute Object
meshes Array
getData function
Returns:
Type Description
AttributeObject attributeObject

useResource(resourceManager, mesh){VertexArrayObject}

使用了资源

Name Type Description
resourceManager WebGLResourceManager
mesh Mesh
Returns:
Type Description
VertexArrayObject

没有被引用时销毁资源

Name Type Description
renderer WebGLRenderer
Returns:
Type Description
VertexArrayObject this

销毁资源

Returns:
Type Description
VertexArrayObject this