Просмотр исходного кода

[Doc/zh]: Improve Chinese translation. (#30205)

puxiao 1 год назад
Родитель
Сommit
574e954b3c
2 измененных файлов с 71 добавлено и 34 удалено
  1. 15 5
      docs/api/zh/core/BufferAttribute.html
  2. 56 29
      docs/api/zh/core/BufferGeometry.html

+ 15 - 5
docs/api/zh/core/BufferAttribute.html

@@ -58,9 +58,9 @@
 
 		<h3>[property:Number gpuType]</h3>
 		<p>
-			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].
+			配置着色器中使用的绑定 GPU 类型。[page:BufferAttribute THREE.FloatType] 或 [page:BufferAttribute THREE.IntType],默认为 [page:BufferAttribute THREE.FloatType]。
 
-			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].
+			注意:这仅对整数数组有效,对于浮点数组不可配置。对于精度较低的浮点类型,请参阅 [page:BufferAttributeTypes THREE.Float16BufferAttribute]。
 		</p>
 
 		<h3>[property:Boolean isBufferAttribute]</h3>
@@ -123,6 +123,16 @@
 
 		<h3>[method:this transformDirection]( [param:Matrix4 m] )</h3>
 		<p>将矩阵[page:Matrix4 m]应用到此BufferAttribute的每一个Vector3元素中,并将所有元素解释为方向向量。</p>
+		
+		<h3>[method:this addUpdateRange]( [param:Integer start], [param:Integer count] )</h3>
+		<p>
+			在数据数组中添加要在 GPU 上更新的数据范围。将描述范围的对象添加到 [page:BufferAttribute.updateRanges updateRanges] 数组。
+		</p>
+
+		<h3>[method:this clearUpdateRanges]()</h3>
+		<p>
+			清除 [page:BufferAttribute.updateRanges updateRanges] 数组。
+		</p>
 
 		<h3>[method:BufferAttribute clone]() </h3>
 		<p>返回该 BufferAttribute 的拷贝。</p>
@@ -136,7 +146,7 @@
 		<p>将一个矢量从 bufferAttribute[index2] 拷贝到 [page:BufferAttribute.array array][index1] 中。</p>
 
 		<h3>[method:Number getComponent]( [param:Integer index], [param:Integer component] ) </h3>
-		<p>Returns the given component of the vector at the given index.</p>
+		<p>返回给定索引处的向量的给定分量。</p>
 
 		<h3>[method:Number getX]( [param:Integer index] ) </h3>
 		<p>获取给定索引的矢量的第一维元素 (即 X 值)。</p>
@@ -167,10 +177,10 @@
 		</p>
 
 		<h3>[method:this setUsage] ( [param:Usage value] ) </h3>
-		<p>Set [page:BufferAttribute.usage usage] to value. See usage [page:BufferAttributeUsage constants] for all possible input values.</p>
+		<p>设置 [page:BufferAttribute.usage usage] 值。查看所有可能的输入值的 usage [page:BufferAttributeUsage constants]。</p>
 
 		<h3>[method:Number setComponent]( [param:Integer index], [param:Integer component], [param:Float value] ) </h3>
-		<p>Sets the given component of the vector at the given index.</p>
+		<p>在给定索引处设置向量的给定分量。</p>
 
 		<h3>[method:this setX]( [param:Integer index], [param:Float x] ) </h3>
 		<p>设置给定索引的矢量的第一维数据(设置 X 值)。</p>

+ 56 - 29
docs/api/zh/core/BufferGeometry.html

@@ -37,6 +37,30 @@
 		const material = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
 		const mesh = new THREE.Mesh( geometry, material );
 		</code>
+		
+		<h2>代码示例 (索引Index)</h2>
+
+		<code>
+		const geometry = new THREE.BufferGeometry();
+
+		const vertices = new Float32Array( [
+			-1.0, -1.0,  1.0, // v0
+			 1.0, -1.0,  1.0, // v1
+			 1.0,  1.0,  1.0, // v2
+			-1.0,  1.0,  1.0, // v3
+		] );
+
+		const indices = [
+			0, 1, 2,
+			2, 3, 0,
+		];
+
+		geometry.setIndex( indices );
+		geometry.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
+
+		const material = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
+		const mesh = new THREE.Mesh( geometry, material );
+		</code>
 
 		<h2>例子</h2>
 		<p>
@@ -82,6 +106,8 @@
 			<code>
 				{ start: 0, count: Infinity }
 			</code>
+			对于非索引 BufferGeometry,count 是要渲染的顶点数。
+			对于索引 BufferGeometry,count 是要渲染的索引数。
 		</p>
 
 		<h3>[property:Array groups]</h3>
@@ -94,8 +120,8 @@
 			start 表明当前 draw call 中的没有索引的几何体的几何体的第一个顶点;或者第一个三角面片的索引。
 			count 指明当前分割包含多少顶点(或 indices)。
 			materialIndex 指出当前用到的材质队列的索引。<br /><br />
-
-			通过 [page:.addGroup] 来增加组,而不是直接更改当前队列
+			通过 [page:.addGroup] 来增加组,而不是直接更改当前队列。<br /><br />
+			每个顶点和索引必须恰好属于一个组,不同组之间不得共享顶点或索引,并且不得留下未使用的顶点或索引
 		</p>
 
 
@@ -159,54 +185,52 @@
 
 		<p>[page:EventDispatcher EventDispatcher] 在该类上可用的所有方法。</p>
 
-		<h3>[method:this setAttribute]( [param:String name], [param:BufferAttribute attribute] )</h3>
-		<p>
-			为当前几何体设置一个 attribute 属性。在类的内部,有一个存储 [page:.attributes] 的 hashmap,
-			通过该 hashmap,遍历 attributes 的速度会更快。而使用该方法,可以向 hashmap 内部增加 attribute。
-			所以,你需要使用该方法来添加 attributes。
-		</p>
-
 		<h3>[method:undefined addGroup]( [param:Integer start], [param:Integer count], [param:Integer materialIndex] )</h3>
 		<p>
 			为当前几何体增加一个 group,详见 [page:BufferGeometry.groups groups] 属性。
 		</p>
 
-
 		<h3>[method:this applyMatrix4]( [param:Matrix4 matrix] )</h3>
 		<p> 用给定矩阵转换几何体的顶点坐标。</p>
 
+		<h3>[method:this applyQuaternion]( [param:Quaternion quaternion] )</h3>
+		<p>用给四元数表示的旋转应用于几何体的顶点坐标。</p>
+
 		<h3>[method:this center] ()</h3>
 		<p>根据边界矩形将几何体居中。</p>
+		
+		<h3>[method:undefined clearGroups]( )</h3>
+		<p>清空所有的 groups。</p>
 
 		<h3>[method:BufferGeometry clone]()</h3>
 		<p>克隆当前的 BufferGeometry。</p>
 
-		<h3>[method:this copy]( [param:BufferGeometry bufferGeometry] )</h3>
-		<p>将参数指定的 BufferGeometry 的值拷贝到当前 BufferGeometry 中。</p>
-
-		<h3>[method:undefined clearGroups]( )</h3>
-		<p>清空所有的 groups。</p>
-
 		<h3>[method:undefined computeBoundingBox]()</h3>
 		<p>
-			计算当前几何体的的边界矩形,该操作会更新已有 [param:.boundingBox]。<br />
+			计算当前几何体的的边界矩形,该操作会更新已有 [page:.boundingBox]。<br />
 			边界矩形不会默认计算,需要调用该接口指定计算边界矩形,否则保持默认值 *null*。
 		</p>
 
 		<h3>[method:undefined computeBoundingSphere]()</h3>
 		<p>
-			计算当前几何体的的边界球形,该操作会更新已有 [param:.boundingSphere]。<br />
+			计算当前几何体的的边界球形,该操作会更新已有 [page:.boundingSphere]。<br />
 			边界球形不会默认计算,需要调用该接口指定计算边界球形,否则保持默认值 *null*。
 		</p>
 
 		<h3>[method:undefined computeTangents]()</h3>
 		<p>
 		计算并向此geometry中添加tangent attribute。<br />
-		只支持索引化的几何体对象,并且必须拥有position(位置),normal(法向)和 uv attributes。如果使用了切线空间法向贴图,最好使用[page:BufferGeometryUtils.computeMikkTSpaceTangents]中的MikkTSpace算法。
+		只支持索引化的几何体对象,并且必须拥有position(位置),normal(法向)和 uv attributes。如果使用了切线空间法向贴图,最好使用 [page:BufferGeometryUtils.computeMikkTSpaceTangents] 中的MikkTSpace算法。
 		</p>
 
 		<h3>[method:undefined computeVertexNormals]()</h3>
-		<p>通过面片法向量的平均值计算每个顶点的法向量。</p>
+		<p>通过面片法向量的平均值计算每个顶点的法向量。对于索引几何体,该方法将每个顶点法线设置为共享该顶点的面的面法线的平均值。对于非索引几何体,顶点不共享,该方法将每个顶点法线设置为与面法线相同。</p>
+
+		<h3>[method:this copy]( [param:BufferGeometry bufferGeometry] )</h3>
+		<p>将参数指定的 BufferGeometry 的值拷贝到当前 BufferGeometry 中。</p>
+		
+		<h3>[method:BufferAttribute deleteAttribute]( [param:String name] )</h3>
+		<p>删除具有指定名称的 [page:BufferAttribute attribute]。</p>
 
 		<h3>[method:undefined dispose]()</h3>
 		<p>
@@ -235,9 +259,6 @@
 			几何体中的每个法向量长度将会为 1。这样操作会更正光线在表面的效果。
 		</p>
 
-		<h3>[method:BufferAttribute deleteAttribute]( [param:String name] )</h3>
-		<p>删除具有指定名称的 [page:BufferAttribute attribute]。</p>
-
 		<h3>[method:this rotateX] ( [param:Float radians] )</h3>
 		<p>
 			在 X 轴上旋转几何体。该操作一般在一次处理中完成,不会循环处理。典型的用法是通过调用 [page:Object3D.rotation] 实时旋转几何体。
@@ -258,24 +279,30 @@
 			缩放几何体。该操作一般在一次处理中完成,不会循环处理。典型的用法是通过调用 [page:Object3D.scale] 实时旋转几何体。
 		</p>
 
-		<h3>[method:this setIndex] ( [param:BufferAttribute index] )</h3>
-		<p>设置缓存的 [page:.index]。</p>
+		<h3>[method:this setAttribute]( [param:String name], [param:BufferAttribute attribute] )</h3>
+		<p>
+			为当前几何体设置一个 attribute 属性。在类的内部,有一个存储 [page:.attributes] 的 hashmap,
+			通过该 hashmap,遍历 attributes 的速度会更快。
+		</p>
 
 		<h3>[method:undefined setDrawRange] ( [param:Integer start], [param:Integer count] )</h3>
-		<p>设置缓存的 [page:.drawRange]。详见相关属性说明。</p>
+		<p>设置 [page:.drawRange] 属性。对于非索引 BufferGeometry,count 是要渲染的顶点数。对于索引 BufferGeometry,count 是要渲染的索引数。</p>
 
 		<h3>[method:this setFromPoints] ( [param:Array points] )</h3>
-		<p>通过点队列设置该 BufferGeometry 的 attribute。</p>
+		<p>通过基于给定的 points 设置几何图形的位置属性。该数组可以保存 Vector2 或 Vector3 的实例。使用二维数据时,所有顶点的 z 坐标均设置为 0。如果该方法与现有位置属性一起使用,则顶点数据将被数组中的数据覆盖。数组的长度必须与顶点数匹配。</p>
+
+		<h3>[method:this setIndex] ( [param:BufferAttribute index] )</h3>
+		<p>设置缓存的 [page:.index]。</p>
 
 		<h3>[method:Object toJSON]()</h3>
-		<p>返回代表该 BufferGeometry 的 JSON 对象。</p>
+		<p>返回代表该 BufferGeometry 符合 [link:https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 Object/Scene 规范] 的 JSON 对象。</p>
 
 		<h3>[method:BufferGeometry toNonIndexed]()</h3>
 		<p>返回已索引的 BufferGeometry 的非索引版本。</p>
 
 		<h3>[method:this translate] ( [param:Float x], [param:Float y], [param:Float z] )</h3>
 		<p>
-			移动几何体。该操作一般在一次处理中完成,不会循环处理。典型的用法是通过调用 [page:Object3D.rotation] 实时旋转几何体。
+			移动几何体。该操作一般在一次处理中完成,不会循环处理。典型的用法是通过调用 [page:Object3D.position] 实时移动几何体。
 		</p>
 
 		<h2>Source</h2>

粤ICP备19079148号