From 3a9152af37e7879e5ed41cb60c549e6a78df57aa Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Fri, 23 Jul 2021 03:25:02 -0700 Subject: [PATCH] Docs: Add BufferAttribute Usage constants documentation (#22173) * Add docs page for usage * GeometryUsage -> BufferAttributeUsage * Add links to new docs page * Update chinese docs * Update BufferAttributeUsage.html * Update BufferAttributeUsage.html * Update BufferAttributeUsage.html * Update BufferAttributeUsage.html * Update BufferAttributeUsage.html --- .../en/constants/BufferAttributeUsage.html | 51 +++++++++++++++++++ docs/api/en/core/BufferAttribute.html | 4 +- .../zh/constants/BufferAttributeUsage.html | 51 +++++++++++++++++++ docs/api/zh/core/BufferAttribute.html | 4 +- docs/list.json | 1 + 5 files changed, 107 insertions(+), 4 deletions(-) create mode 100644 docs/api/en/constants/BufferAttributeUsage.html create mode 100644 docs/api/zh/constants/BufferAttributeUsage.html diff --git a/docs/api/en/constants/BufferAttributeUsage.html b/docs/api/en/constants/BufferAttributeUsage.html new file mode 100644 index 0000000000..91515dfdf0 --- /dev/null +++ b/docs/api/en/constants/BufferAttributeUsage.html @@ -0,0 +1,51 @@ + + + + + + + + + +

Buffer Attribute Usage Constants

+ +

+ The usage constants can be used to provide a hint to the API regarding how the geometry buffer attribute will be used in order to optimize performance. +

+ +

Code Example

+ + + const geometry = new THREE.BufferGeometry(); + const positionAttribute = new THREE.BufferAttribute( array, 3 , false ); + positionAttribute.setUsage( THREE.DynamicDrawUsage ); + geometry.setAttribute( 'position', positionAttribute ); + + +

Examples

+

[example:webgl_buffergeometry_drawrange materials / buffergeometry / drawrange ]

+ +

Geometry Usage

+ + THREE.StaticDrawUsage + THREE.DynamicDrawUsage + THREE.StreamDrawUsage + + THREE.StaticReadUsage + THREE.DynamicReadUsage + THREE.StreamReadUsage + + THREE.StaticCopyUsage + THREE.DynamicCopyUsage + THREE.StreamCopyUsage + + + For more detailed information on each of these constants see [link:https://www.khronos.org/opengl/wiki/Buffer_Object#Buffer_Object_Usage this OpenGL documentation]. + +

Source

+ +

+ [link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js] +

+ + diff --git a/docs/api/en/core/BufferAttribute.html b/docs/api/en/core/BufferAttribute.html index cb97195c88..8773870302 100644 --- a/docs/api/en/core/BufferAttribute.html +++ b/docs/api/en/core/BufferAttribute.html @@ -97,7 +97,7 @@

Defines the intended usage pattern of the data store for optimization purposes. Corresponds to the *usage* parameter of [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData WebGLRenderingContext.bufferData](). - Default is *THREE.StaticDrawUsage*. + Default is [page:BufferAttributeUsage StaticDrawUsage]. See usage [page:BufferAttributeUsage constants] for all possible values.

[property:Integer version]

@@ -179,7 +179,7 @@

[method:BufferAttribute setUsage] ( [param:Usage value] )

-

Set [page:BufferAttribute.usage usage] to value.

+

Set [page:BufferAttribute.usage usage] to value. See usage [page:BufferAttributeUsage constants] for all possible input values.

[method:BufferAttribute setX]( [param:Integer index], [param:Float x] )

Sets the x component of the vector at the given index.

diff --git a/docs/api/zh/constants/BufferAttributeUsage.html b/docs/api/zh/constants/BufferAttributeUsage.html new file mode 100644 index 0000000000..0cd24a6e34 --- /dev/null +++ b/docs/api/zh/constants/BufferAttributeUsage.html @@ -0,0 +1,51 @@ + + + + + + + + + +

Buffer Attribute Usage Constants

+ +

+ The usage constants can be used to provide a hint to the API regarding how the geometry buffer attribute will be used in order to optimize performance. +

+ +

Code Example

+ + + const geometry = new THREE.BufferGeometry(); + const positionAttribute = new THREE.BufferAttribute( array, 3 , false ); + positionAttribute.setUsage( THREE.DynamicDrawUsage ); + geometry.setAttribute( 'position', positionAttribute ); + + +

Examples

+

[example:webgl_buffergeometry_drawrange materials / buffergeometry / drawrange ]

+ +

Geometry Usage

+ + THREE.StaticDrawUsage + THREE.DynamicDrawUsage + THREE.StreamDrawUsage + + THREE.StaticReadUsage + THREE.DynamicReadUsage + THREE.StreamReadUsage + + THREE.StaticCopyUsage + THREE.DynamicCopyUsage + THREE.StreamCopyUsage + + + For more detailed information on each of these constants see [link:https://www.khronos.org/opengl/wiki/Buffer_Object#Buffer_Object_Usage this OpenGL documentation]. + +

Source

+ +

+ [link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js] +

+ + diff --git a/docs/api/zh/core/BufferAttribute.html b/docs/api/zh/core/BufferAttribute.html index 410c915ce5..5ebcea9232 100644 --- a/docs/api/zh/core/BufferAttribute.html +++ b/docs/api/zh/core/BufferAttribute.html @@ -87,7 +87,7 @@

Defines the intended usage pattern of the data store for optimization purposes. Corresponds to the *usage* parameter of [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData WebGLRenderingContext.bufferData](). - Default is *THREE.StaticDrawUsage*. + Default is [page:BufferAttributeUsage StaticDrawUsage]. See usage [page:BufferAttributeUsage constants] for all possible values.

[property:Integer version]

@@ -160,7 +160,7 @@

[method:BufferAttribute setUsage] ( [param:Usage value] )

-

Set [page:BufferAttribute.usage usage] to value.

+

Set [page:BufferAttribute.usage usage] to value. See usage [page:BufferAttributeUsage constants] for all possible input values.

[method:BufferAttribute setX]( [param:Integer index], [param:Float x] )

设置给定索引的矢量的第一维数据(设置 X 值)。

diff --git a/docs/list.json b/docs/list.json index 46e167c03e..1a968f3ba5 100644 --- a/docs/list.json +++ b/docs/list.json @@ -75,6 +75,7 @@ "Animation": "api/en/constants/Animation", "Core": "api/en/constants/Core", "CustomBlendingEquation": "api/en/constants/CustomBlendingEquations", + "BufferAttributeUsage": "api/en/constants/BufferAttributeUsage", "Materials": "api/en/constants/Materials", "Renderer": "api/en/constants/Renderer", "Textures": "api/en/constants/Textures" -- GitLab