MeshAttribute

MeshAttribute

Mesh Attribute

Constructor

new MeshAttribute(name, data, size, type, normalized, usage)

Source:
Parameters:
Name Type Description
name String attribute name
data ArrayBufferView typed array of data for the attribute
size Number size of data in array. 2 for vec2, 3 for vec3, etc...
type String datatype matching the typed array datatype. 'FLOAT', 'UNSIGNED_BYTE', etc
normalized Boolean wether the data is normalised to 0-1 range for glsl.
usage String usage hint for gl. 'STATIC_DRAW' or 'DYNAMIC_DRAW'.

Methods

bind(gl, program)

Source:
sets up vertex attribute pointer and binds the buffer. this is used before drawing.
Parameters:
Name Type Description
gl WebGLRenderingContext gl context.
program ShaderProgram shaderProgram instance.

init(gl)

Source:
initializes buffer. Internal method. Should not be called manually!
Parameters:
Name Type Description
gl WebGLRenderingContext gl context.

setData(newData)

Source:
Sets new data buffer. and sets this.needsUpdate true.
Parameters:
Name Type Description
newData ArrayBufferView

update(gl)

Source:
updates buffer data. Internal method. Should not be called manually!
Parameters:
Name Type Description
gl WebGLRenderingContext gl context.