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

是否脏

static,readonlyVertexArrayObject.cacheCache

缓存

Methods Show Inherited

staticVertexArrayObject.getVao(gl, id, params){VertexArrayObject}

获取 vao

Name Type Description
gl WebGLRenderingContext
id String

缓存id

params Object
Returns:
Type Description
VertexArrayObject

staticVertexArrayObject.reset(gl)

重置所有vao

Name Type Description
gl WebGLRenderingContext

staticVertexArrayObject.bindSystemVao()

绑定系统vao

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

getResources(resources){Array.<Object>}

获取资源

Name Type Default Description
resources Array.<Object> [] optional
Returns:
Type Description
Array.<Object>

没有被引用时销毁资源

Name Type Description
renderer WebGLRenderer
Returns:
Type Description
VertexArrayObject this

销毁资源

Returns:
Type Description
VertexArrayObject this