t3d. Attribute

The Attribute add structural information to Buffer. This class stores data for an attribute (such as vertex positions, face indices, normals, colors, UVs, and any custom attributes ) associated with a Geometry, which allows for more efficient passing of data to the GPU. Data is stored as vectors of any length (defined by size).

Constructor

new Attribute(buffer, sizeopt, offsetopt, normalizedopt)

Parameters:
NameTypeAttributesDefaultDescription
buffert3d.BufferThe Buffer instance passed in the constructor.
sizeNumber<optional>
buffer.strideThe number of values of the array that should be associated with a particular vertex. For instance, if this attribute is storing a 3-component vector (such as a position, normal, or color), then size should be 3.
offsetNumber<optional>
0The offset in the underlying array buffer where an item starts.
normalizedBoolean<optional>
falseIndicates how the underlying data in the buffer maps to the values in the GLSL shader code.

Members

buffer :t3d.Buffer

The Buffer instance passed in the constructor.

divisor :Number

Instance cadence, the number of instances drawn for each vertex in the buffer, non-instance attributes must be 0.
Type:
  • Number
Default Value
  • 0

normalized :Boolean

Indicates how the underlying data in the buffer maps to the values in the GLSL shader code.
Type:
  • Boolean
Default Value
  • false

offset :Number

The offset in the underlying buffer where an item starts.
Type:
  • Number
Default Value
  • 0

size :Number

The number of values of the buffer that should be associated with the attribute.
Type:
  • Number
Default Value
  • buffer.stride

Methods

clone(buffers) → {t3d.Attribute}

Return a new attribute with the same parameters as this attribute.
Parameters:
NameTypeDescription
buffersObjectA WeakMap to save shared buffers.
Returns:
Type: 
t3d.Attribute

copy(source) → {t3d.Attribute}

Copy the parameters from the passed attribute.
Parameters:
NameTypeDescription
sourcet3d.AttributeThe attribute to be copied.
Returns:
Type: 
t3d.Attribute