Skip to content

Geometry

GeometryAttribute ​

Defined in: packages/wtc-gl/src/geometry/GeometryAttribute.ts:34

Class representing a geometry attribute. A discrete piece of data used to render some geometry.

Implements ​

Constructors ​

Constructor ​

ts
new GeometryAttribute(options): GeometryAttribute;

Defined in: packages/wtc-gl/src/geometry/GeometryAttribute.ts:100

Create a geometry attribute

Parameters ​

ParameterTypeDescription
optionsGeometryAttributeOptionsThe data and its layout; see GeometryAttributeOptions.

Returns ​

GeometryAttribute

Properties ​

PropertyTypeDefault valueDescription
bufferWebGLBuffer | nullnullThe WebGL buffer containing the static attribute data
countnumberundefinedthe number of elements in the attribute
data| Float32Array<ArrayBufferLike> | Float64Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>undefinedA typed array of data for the attribute
divisornumber0The divisor, used in instanced attributes
externalbooleanfalseWhether the buffer is managed by something else, such as a TransformFeedback. Geometry never uploads, recreates or deletes an external attribute's buffer, and re-points its vertex arrays when the buffer is swapped. Bounds aren't computed from an external position, so a mesh using one isn't frustum culled unless you set geometry.bounds.
instancednumberundefinedThe number of instances for this attribute
needsUpdatebooleanfalsewhether this attribute needs an update. Set after the attribute changes to have it recast to memory
normalizedbooleanundefinedwhether integer data values should be normalized into a certain range when being cast to a float.
offsetnumber0How many bytes to offset when passing in the buffer
sizenumber1The size of each element in the attribute. For example if you're describing 3D vectors, this would be 3.
stridenumber0How big a stride should this attribute have. Should be 0 for all attributes that are uncombined.
targetnumber34962gl.ELEMENT_ARRAY_BUFFER or gl.ARRAY_BUFFER depending on whether this is an index attribute or not
typenumberundefineddefault gl.UNSIGNED_SHORT for 'index', gl.FLOAT for others

Methods ​

updateAttribute() ​

ts
updateAttribute(gl): void;

Defined in: packages/wtc-gl/src/geometry/GeometryAttribute.ts:137

Udpate an attribute for rendering

Parameters ​

ParameterTypeDescription
glWTCGLRenderingContextThe WTCGL rendering context.

Returns ​

void

Implementation of ​

WTCGLGeometryAttribute.updateAttribute