Skip to content

Commit 574e954

Browse files
authored
[Doc/zh]: Improve Chinese translation. (#30205)
1 parent a7500fd commit 574e954

File tree

2 files changed

+71
-34
lines changed

2 files changed

+71
-34
lines changed

docs/api/zh/core/BufferAttribute.html

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ <h3>[property:Integer count]</h3>
5858

5959
<h3>[property:Number gpuType]</h3>
6060
<p>
61-
Configures the bound GPU type for use in shaders. Either [page:BufferAttribute THREE.FloatType] or [page:BufferAttribute THREE.IntType], default is [page:BufferAttribute THREE.FloatType].
61+
配置着色器中使用的绑定 GPU 类型。[page:BufferAttribute THREE.FloatType] [page:BufferAttribute THREE.IntType],默认为 [page:BufferAttribute THREE.FloatType]
6262

63-
Note: this only has an effect for integer arrays and is not configurable for float arrays. For lower precision float types, see [page:BufferAttributeTypes THREE.Float16BufferAttribute].
63+
注意:这仅对整数数组有效,对于浮点数组不可配置。对于精度较低的浮点类型,请参阅 [page:BufferAttributeTypes THREE.Float16BufferAttribute]
6464
</p>
6565

6666
<h3>[property:Boolean isBufferAttribute]</h3>
@@ -123,6 +123,16 @@ <h3>[method:this applyNormalMatrix]( [param:Matrix3 m] )</h3>
123123

124124
<h3>[method:this transformDirection]( [param:Matrix4 m] )</h3>
125125
<p>将矩阵[page:Matrix4 m]应用到此BufferAttribute的每一个Vector3元素中,并将所有元素解释为方向向量。</p>
126+
127+
<h3>[method:this addUpdateRange]( [param:Integer start], [param:Integer count] )</h3>
128+
<p>
129+
在数据数组中添加要在 GPU 上更新的数据范围。将描述范围的对象添加到 [page:BufferAttribute.updateRanges updateRanges] 数组。
130+
</p>
131+
132+
<h3>[method:this clearUpdateRanges]()</h3>
133+
<p>
134+
清除 [page:BufferAttribute.updateRanges updateRanges] 数组。
135+
</p>
126136

127137
<h3>[method:BufferAttribute clone]() </h3>
128138
<p>返回该 BufferAttribute 的拷贝。</p>
@@ -136,7 +146,7 @@ <h3>[method:this copyAt] ( [param:Integer index1], [param:BufferAttribute buffer
136146
<p>将一个矢量从 bufferAttribute[index2] 拷贝到 [page:BufferAttribute.array array][index1] 中。</p>
137147

138148
<h3>[method:Number getComponent]( [param:Integer index], [param:Integer component] ) </h3>
139-
<p>Returns the given component of the vector at the given index.</p>
149+
<p>返回给定索引处的向量的给定分量。</p>
140150

141151
<h3>[method:Number getX]( [param:Integer index] ) </h3>
142152
<p>获取给定索引的矢量的第一维元素 (即 X 值)。</p>
@@ -167,10 +177,10 @@ <h3>[method:this set] ( [param:Array value], [param:Integer offset] ) </h3>
167177
</p>
168178

169179
<h3>[method:this setUsage] ( [param:Usage value] ) </h3>
170-
<p>Set [page:BufferAttribute.usage usage] to value. See usage [page:BufferAttributeUsage constants] for all possible input values.</p>
180+
<p>设置 [page:BufferAttribute.usage usage] 值。查看所有可能的输入值的 usage [page:BufferAttributeUsage constants]</p>
171181

172182
<h3>[method:Number setComponent]( [param:Integer index], [param:Integer component], [param:Float value] ) </h3>
173-
<p>Sets the given component of the vector at the given index.</p>
183+
<p>在给定索引处设置向量的给定分量。</p>
174184

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

docs/api/zh/core/BufferGeometry.html

Lines changed: 56 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,30 @@ <h2>代码示例</h2>
3737
const material = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
3838
const mesh = new THREE.Mesh( geometry, material );
3939
</code>
40+
41+
<h2>代码示例 (索引Index)</h2>
42+
43+
<code>
44+
const geometry = new THREE.BufferGeometry();
45+
46+
const vertices = new Float32Array( [
47+
-1.0, -1.0, 1.0, // v0
48+
1.0, -1.0, 1.0, // v1
49+
1.0, 1.0, 1.0, // v2
50+
-1.0, 1.0, 1.0, // v3
51+
] );
52+
53+
const indices = [
54+
0, 1, 2,
55+
2, 3, 0,
56+
];
57+
58+
geometry.setIndex( indices );
59+
geometry.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
60+
61+
const material = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
62+
const mesh = new THREE.Mesh( geometry, material );
63+
</code>
4064

4165
<h2>例子</h2>
4266
<p>
@@ -82,6 +106,8 @@ <h3>[property:Object drawRange]</h3>
82106
<code>
83107
{ start: 0, count: Infinity }
84108
</code>
109+
对于非索引 BufferGeometry,count 是要渲染的顶点数。
110+
对于索引 BufferGeometry,count 是要渲染的索引数。
85111
</p>
86112

87113
<h3>[property:Array groups]</h3>
@@ -94,8 +120,8 @@ <h3>[property:Array groups]</h3>
94120
start 表明当前 draw call 中的没有索引的几何体的几何体的第一个顶点;或者第一个三角面片的索引。
95121
count 指明当前分割包含多少顶点(或 indices)。
96122
materialIndex 指出当前用到的材质队列的索引。<br /><br />
97-
98-
通过 [page:.addGroup] 来增加组,而不是直接更改当前队列
123+
通过 [page:.addGroup] 来增加组,而不是直接更改当前队列。<br /><br />
124+
每个顶点和索引必须恰好属于一个组,不同组之间不得共享顶点或索引,并且不得留下未使用的顶点或索引
99125
</p>
100126

101127

@@ -159,54 +185,52 @@ <h2>方法</h2>
159185

160186
<p>[page:EventDispatcher EventDispatcher] 在该类上可用的所有方法。</p>
161187

162-
<h3>[method:this setAttribute]( [param:String name], [param:BufferAttribute attribute] )</h3>
163-
<p>
164-
为当前几何体设置一个 attribute 属性。在类的内部,有一个存储 [page:.attributes] 的 hashmap,
165-
通过该 hashmap,遍历 attributes 的速度会更快。而使用该方法,可以向 hashmap 内部增加 attribute。
166-
所以,你需要使用该方法来添加 attributes。
167-
</p>
168-
169188
<h3>[method:undefined addGroup]( [param:Integer start], [param:Integer count], [param:Integer materialIndex] )</h3>
170189
<p>
171190
为当前几何体增加一个 group,详见 [page:BufferGeometry.groups groups] 属性。
172191
</p>
173192

174-
175193
<h3>[method:this applyMatrix4]( [param:Matrix4 matrix] )</h3>
176194
<p> 用给定矩阵转换几何体的顶点坐标。</p>
177195

196+
<h3>[method:this applyQuaternion]( [param:Quaternion quaternion] )</h3>
197+
<p>用给四元数表示的旋转应用于几何体的顶点坐标。</p>
198+
178199
<h3>[method:this center] ()</h3>
179200
<p>根据边界矩形将几何体居中。</p>
201+
202+
<h3>[method:undefined clearGroups]( )</h3>
203+
<p>清空所有的 groups。</p>
180204

181205
<h3>[method:BufferGeometry clone]()</h3>
182206
<p>克隆当前的 BufferGeometry。</p>
183207

184-
<h3>[method:this copy]( [param:BufferGeometry bufferGeometry] )</h3>
185-
<p>将参数指定的 BufferGeometry 的值拷贝到当前 BufferGeometry 中。</p>
186-
187-
<h3>[method:undefined clearGroups]( )</h3>
188-
<p>清空所有的 groups。</p>
189-
190208
<h3>[method:undefined computeBoundingBox]()</h3>
191209
<p>
192-
计算当前几何体的的边界矩形,该操作会更新已有 [param:.boundingBox]。<br />
210+
计算当前几何体的的边界矩形,该操作会更新已有 [page:.boundingBox]。<br />
193211
边界矩形不会默认计算,需要调用该接口指定计算边界矩形,否则保持默认值 *null*。
194212
</p>
195213

196214
<h3>[method:undefined computeBoundingSphere]()</h3>
197215
<p>
198-
计算当前几何体的的边界球形,该操作会更新已有 [param:.boundingSphere]。<br />
216+
计算当前几何体的的边界球形,该操作会更新已有 [page:.boundingSphere]。<br />
199217
边界球形不会默认计算,需要调用该接口指定计算边界球形,否则保持默认值 *null*。
200218
</p>
201219

202220
<h3>[method:undefined computeTangents]()</h3>
203221
<p>
204222
计算并向此geometry中添加tangent attribute。<br />
205-
只支持索引化的几何体对象,并且必须拥有position(位置),normal(法向)和 uv attributes。如果使用了切线空间法向贴图,最好使用[page:BufferGeometryUtils.computeMikkTSpaceTangents]中的MikkTSpace算法。
223+
只支持索引化的几何体对象,并且必须拥有position(位置),normal(法向)和 uv attributes。如果使用了切线空间法向贴图,最好使用 [page:BufferGeometryUtils.computeMikkTSpaceTangents] 中的MikkTSpace算法。
206224
</p>
207225

208226
<h3>[method:undefined computeVertexNormals]()</h3>
209-
<p>通过面片法向量的平均值计算每个顶点的法向量。</p>
227+
<p>通过面片法向量的平均值计算每个顶点的法向量。对于索引几何体,该方法将每个顶点法线设置为共享该顶点的面的面法线的平均值。对于非索引几何体,顶点不共享,该方法将每个顶点法线设置为与面法线相同。</p>
228+
229+
<h3>[method:this copy]( [param:BufferGeometry bufferGeometry] )</h3>
230+
<p>将参数指定的 BufferGeometry 的值拷贝到当前 BufferGeometry 中。</p>
231+
232+
<h3>[method:BufferAttribute deleteAttribute]( [param:String name] )</h3>
233+
<p>删除具有指定名称的 [page:BufferAttribute attribute]。</p>
210234

211235
<h3>[method:undefined dispose]()</h3>
212236
<p>
@@ -235,9 +259,6 @@ <h3>[method:undefined normalizeNormals]()</h3>
235259
几何体中的每个法向量长度将会为 1。这样操作会更正光线在表面的效果。
236260
</p>
237261

238-
<h3>[method:BufferAttribute deleteAttribute]( [param:String name] )</h3>
239-
<p>删除具有指定名称的 [page:BufferAttribute attribute]。</p>
240-
241262
<h3>[method:this rotateX] ( [param:Float radians] )</h3>
242263
<p>
243264
在 X 轴上旋转几何体。该操作一般在一次处理中完成,不会循环处理。典型的用法是通过调用 [page:Object3D.rotation] 实时旋转几何体。
@@ -258,24 +279,30 @@ <h3>[method:this scale] ( [param:Float x], [param:Float y], [param:Float z] )</h
258279
缩放几何体。该操作一般在一次处理中完成,不会循环处理。典型的用法是通过调用 [page:Object3D.scale] 实时旋转几何体。
259280
</p>
260281

261-
<h3>[method:this setIndex] ( [param:BufferAttribute index] )</h3>
262-
<p>设置缓存的 [page:.index]。</p>
282+
<h3>[method:this setAttribute]( [param:String name], [param:BufferAttribute attribute] )</h3>
283+
<p>
284+
为当前几何体设置一个 attribute 属性。在类的内部,有一个存储 [page:.attributes] 的 hashmap,
285+
通过该 hashmap,遍历 attributes 的速度会更快。
286+
</p>
263287

264288
<h3>[method:undefined setDrawRange] ( [param:Integer start], [param:Integer count] )</h3>
265-
<p>设置缓存的 [page:.drawRange]。详见相关属性说明</p>
289+
<p>设置 [page:.drawRange] 属性。对于非索引 BufferGeometry,count 是要渲染的顶点数。对于索引 BufferGeometry,count 是要渲染的索引数</p>
266290

267291
<h3>[method:this setFromPoints] ( [param:Array points] )</h3>
268-
<p>通过点队列设置该 BufferGeometry 的 attribute。</p>
292+
<p>通过基于给定的 points 设置几何图形的位置属性。该数组可以保存 Vector2 或 Vector3 的实例。使用二维数据时,所有顶点的 z 坐标均设置为 0。如果该方法与现有位置属性一起使用,则顶点数据将被数组中的数据覆盖。数组的长度必须与顶点数匹配。</p>
293+
294+
<h3>[method:this setIndex] ( [param:BufferAttribute index] )</h3>
295+
<p>设置缓存的 [page:.index]。</p>
269296

270297
<h3>[method:Object toJSON]()</h3>
271-
<p>返回代表该 BufferGeometry 的 JSON 对象。</p>
298+
<p>返回代表该 BufferGeometry 符合 [link:https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 Object/Scene 规范] 的 JSON 对象。</p>
272299

273300
<h3>[method:BufferGeometry toNonIndexed]()</h3>
274301
<p>返回已索引的 BufferGeometry 的非索引版本。</p>
275302

276303
<h3>[method:this translate] ( [param:Float x], [param:Float y], [param:Float z] )</h3>
277304
<p>
278-
移动几何体。该操作一般在一次处理中完成,不会循环处理。典型的用法是通过调用 [page:Object3D.rotation] 实时旋转几何体
305+
移动几何体。该操作一般在一次处理中完成,不会循环处理。典型的用法是通过调用 [page:Object3D.position] 实时移动几何体
279306
</p>
280307

281308
<h2>Source</h2>

0 commit comments

Comments
 (0)