Class: Geometry

Geometry()

new Geometry()

Base class for objects describing webGl geometry. All geometry is stored in a circular buffer. Buffer size is fixed on construction

Handy-Dandy Glossary: A vertex is composed of three coordinates A coordinate is the component of a vertex in a single axis Length refers to the number of elements in an array Size refers to byte length of a buffer Index refers to the index of an element in an array Offset refers to byte location in a buffer

Note that for 8bit buffers, index and offset, size and length, will both refer to the same location and capacity, but the terminology should remain consistent regardless.

Source:

Extends

Methods

_rebuildLists()

Rebuild lists for this drawable and notify any parent drawable to do so as well. This ensures each drawable contains an updated, flat list of all the drawables beneath them. This way we save performance by not recursing through each child during draw time, and instead, drawing from the flat list at the level we care about.

Inherited From:
Source:

add(children)

Add a child drawable to this instance

Parameters:
Name Type Description
children Array.<Drawable> | Drawable

child drawables to add

Inherited From:
Source:

addVertices(coords)

Add vertices to this geometry object

Parameters:
Name Type Description
coords Array.<Float>

Packed array of floating point coordinats. (e.g. [x1,y1,z1,x2,y2,z2,...xn,yn,zn])

Source:

draw()

Base draw method, which should always be called by subclasses. This method will perform any updates to dirty geometry buffers, but does not actually perform any drawing itself.

Source:

drawCircular()

Draws the circular buffer as a line strip,

Source:

remove(children)

Remove a child drawable from this instance

Parameters:
Name Type Description
children Array.<Drawable> | Drawable

child drawables to remove

Inherited From:
Source:

setShaderPosition(gl, shader)

Set up a vertex shader's modelView and projection matrixes, and assign the position of the vertex buffer for this geometry.

Parameters:
Name Type Description
gl WebGl

Webgl context

shader Shader

Shader instance

Source:

Type Definitions

Options

Source: