Skip to content

Commit 3a9152a

Browse files
authored
Docs: Add BufferAttribute Usage constants documentation (mrdoob#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
1 parent ea3762d commit 3a9152a

File tree

5 files changed

+107
-4
lines changed

5 files changed

+107
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<base href="../../../" />
6+
<script src="page.js"></script>
7+
<link type="text/css" rel="stylesheet" href="page.css" />
8+
</head>
9+
<body>
10+
<h1>Buffer Attribute Usage Constants</h1>
11+
12+
<p>
13+
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.
14+
</p>
15+
16+
<h2>Code Example</h2>
17+
18+
<code>
19+
const geometry = new THREE.BufferGeometry();
20+
const positionAttribute = new THREE.BufferAttribute( array, 3 , false );
21+
positionAttribute.setUsage( THREE.DynamicDrawUsage );
22+
geometry.setAttribute( 'position', positionAttribute );
23+
</code>
24+
25+
<h2>Examples</h2>
26+
<p>[example:webgl_buffergeometry_drawrange materials / buffergeometry / drawrange ]</p>
27+
28+
<h2>Geometry Usage</h2>
29+
<code>
30+
THREE.StaticDrawUsage
31+
THREE.DynamicDrawUsage
32+
THREE.StreamDrawUsage
33+
34+
THREE.StaticReadUsage
35+
THREE.DynamicReadUsage
36+
THREE.StreamReadUsage
37+
38+
THREE.StaticCopyUsage
39+
THREE.DynamicCopyUsage
40+
THREE.StreamCopyUsage
41+
</code>
42+
43+
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].
44+
45+
<h2>Source</h2>
46+
47+
<p>
48+
[link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js]
49+
</p>
50+
</body>
51+
</html>

docs/api/en/core/BufferAttribute.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ <h3>[property:Usage usage]</h3>
9797
<p>
9898
Defines the intended usage pattern of the data store for optimization purposes. Corresponds to the *usage* parameter of
9999
[link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData WebGLRenderingContext.bufferData]().
100-
Default is *THREE.StaticDrawUsage*.
100+
Default is [page:BufferAttributeUsage StaticDrawUsage]. See usage [page:BufferAttributeUsage constants] for all possible values.
101101
</p>
102102

103103
<h3>[property:Integer version]</h3>
@@ -179,7 +179,7 @@ <h3>[method:BufferAttribute set] ( [param:Array value], [param:Integer offset] )
179179
</p>
180180

181181
<h3>[method:BufferAttribute setUsage] ( [param:Usage value] ) </h3>
182-
<p>Set [page:BufferAttribute.usage usage] to value.</p>
182+
<p>Set [page:BufferAttribute.usage usage] to value. See usage [page:BufferAttributeUsage constants] for all possible input values.</p>
183183

184184
<h3>[method:BufferAttribute setX]( [param:Integer index], [param:Float x] ) </h3>
185185
<p>Sets the x component of the vector at the given index.</p>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<!DOCTYPE html>
2+
<html lang="zh">
3+
<head>
4+
<meta charset="utf-8" />
5+
<base href="../../../" />
6+
<script src="page.js"></script>
7+
<link type="text/css" rel="stylesheet" href="page.css" />
8+
</head>
9+
<body>
10+
<h1>Buffer Attribute Usage Constants</h1>
11+
12+
<p>
13+
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.
14+
</p>
15+
16+
<h2>Code Example</h2>
17+
18+
<code>
19+
const geometry = new THREE.BufferGeometry();
20+
const positionAttribute = new THREE.BufferAttribute( array, 3 , false );
21+
positionAttribute.setUsage( THREE.DynamicDrawUsage );
22+
geometry.setAttribute( 'position', positionAttribute );
23+
</code>
24+
25+
<h2>Examples</h2>
26+
<p>[example:webgl_buffergeometry_drawrange materials / buffergeometry / drawrange ]</p>
27+
28+
<h2>Geometry Usage</h2>
29+
<code>
30+
THREE.StaticDrawUsage
31+
THREE.DynamicDrawUsage
32+
THREE.StreamDrawUsage
33+
34+
THREE.StaticReadUsage
35+
THREE.DynamicReadUsage
36+
THREE.StreamReadUsage
37+
38+
THREE.StaticCopyUsage
39+
THREE.DynamicCopyUsage
40+
THREE.StreamCopyUsage
41+
</code>
42+
43+
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].
44+
45+
<h2>Source</h2>
46+
47+
<p>
48+
[link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js]
49+
</p>
50+
</body>
51+
</html>

docs/api/zh/core/BufferAttribute.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ <h3>[property:Usage usage]</h3>
8787
<p>
8888
Defines the intended usage pattern of the data store for optimization purposes. Corresponds to the *usage* parameter of
8989
[link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData WebGLRenderingContext.bufferData]().
90-
Default is *THREE.StaticDrawUsage*.
90+
Default is [page:BufferAttributeUsage StaticDrawUsage]. See usage [page:BufferAttributeUsage constants] for all possible values.
9191
</p>
9292

9393
<h3>[property:Integer version]</h3>
@@ -160,7 +160,7 @@ <h3>[method:BufferAttribute set] ( [param:Array value], [param:Integer offset] )
160160
</p>
161161

162162
<h3>[method:BufferAttribute setUsage] ( [param:Usage value] ) </h3>
163-
<p>Set [page:BufferAttribute.usage usage] to value.</p>
163+
<p>Set [page:BufferAttribute.usage usage] to value. See usage [page:BufferAttributeUsage constants] for all possible input values.</p>
164164

165165
<h3>[method:BufferAttribute setX]( [param:Integer index], [param:Float x] ) </h3>
166166
<p>设置给定索引的矢量的第一维数据(设置 X 值)。</p>

docs/list.json

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"Animation": "api/en/constants/Animation",
7676
"Core": "api/en/constants/Core",
7777
"CustomBlendingEquation": "api/en/constants/CustomBlendingEquations",
78+
"BufferAttributeUsage": "api/en/constants/BufferAttributeUsage",
7879
"Materials": "api/en/constants/Materials",
7980
"Renderer": "api/en/constants/Renderer",
8081
"Textures": "api/en/constants/Textures"

0 commit comments

Comments
 (0)