Skip to main content

Class: BufferAttribute

存储和 BufferAttribute 相关的属性

Table of contents​

Constructors​

Properties​

Constructors​

constructor​

• new BufferAttribute(renderer, attribute): BufferAttribute

Parameters​

NameType
rendererRenderer
attributeAttribute

Returns​

BufferAttribute

Defined in​

src/core/BufferAttribute.ts:196

Properties​

id​

• id: string

BufferAttribute 的 id,不传时由内部生成。

Defined in​

src/core/BufferAttribute.ts:128


data​

• data: DataType

Attribute 数据,必须是 TypedArray 类型

Defined in​

src/core/BufferAttribute.ts:133


type​

• type: number

BufferAttribute中元素的数据类型

Defined in​

src/core/BufferAttribute.ts:138


size​

• size: number

BufferAttribute中缓冲区每个顶点分量的个数, 一般为 1-4

Defined in​

src/core/BufferAttribute.ts:143


instanced​

• instanced: boolean

BufferAttribute 是否是实例化数据

Defined in​

src/core/BufferAttribute.ts:148


stride​

• stride: number

BufferAttribute中缓冲区顶点的偏移量

Defined in​

src/core/BufferAttribute.ts:153


offset​

• offset: number

BufferAttribute中顶点属性数组中第一部分的字节偏移量

Defined in​

src/core/BufferAttribute.ts:158


divisor​

• divisor: number

指定实例化渲染的数量

Defined in​

src/core/BufferAttribute.ts:163


normalized​

• normalized: boolean

当整数值转换为浮点数时是否应该将整数数值归一化到特定的范围

Defined in​

src/core/BufferAttribute.ts:168


needsUpdate​

• needsUpdate: boolean

标记此 BufferAttribute 是否需要重新上传 GPU,一般我们在数据改变时需要将此值设置为true。

Defined in​

src/core/BufferAttribute.ts:173


count​

• count: number

顶点数量

Defined in​

src/core/BufferAttribute.ts:178


usage​

• usage: number

标记如何使用这些数据,webgl 会针对性的做一些优化,默认是 gl.STATIC_DRAW,即标记数据不会经常性改变。 其他可用值请参考 https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData。

Defined in​

src/core/BufferAttribute.ts:184


target​

• target: number

缓冲区对象,常用的值为gl.ARRAY_BUFFER 和 gl.ELEMENT_ARRAY_BUFFER。当然在webgl2 中有一些新的可用值,如 gl.UNIFORM_BUFFER和 gl.TRANSFORM_FEEDBACK_BUFFER。

Defined in​

src/core/BufferAttribute.ts:189


buffer​

• buffer: WithNull<WebGLBuffer>

WebGLBuffer

Defined in​

src/core/BufferAttribute.ts:194