Kaynağa Gözat

SceneUtils: Add documentation for sortInstancedMesh() (#24833)

* Documentation: Add docs for SceneUtils.sortInstancedMesh

* SceneUtils: Update return type in docs, void -> undefined
Don McCurdy 2 yıl önce
ebeveyn
işleme
dbed98b30b

+ 19 - 0
docs/examples/en/utils/SceneUtils.html

@@ -40,6 +40,25 @@
 		This is mostly useful for objects that need both a material and a wireframe implementation.
 		This is mostly useful for objects that need both a material and a wireframe implementation.
 		</p>
 		</p>
 
 
+		<h3>[method:undefined sortInstancedMesh]( [param:InstancedMesh mesh], [param:Function compareFn] )</h3>
+		<p>
+		mesh -- InstancedMesh in which instances will be sorted. <br />
+		compareFn -- Comparator function defining the sort order.
+		</p>
+		<p>
+		Sorts the instances within an [page:InstancedMesh], according to a user-defined
+		callback. The callback will be provided with two arguments, <i>indexA</i>
+		and <i>indexB</i>, and must return a numerical value. See
+		[link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description Array.prototype.sort]
+		for more information on sorting callbacks and their return values.
+		</p>
+		<p>
+		Because of the high performance cost, three.js does not sort
+		[page:InstancedMesh] instances automatically. Manually sorting may be
+		helpful to improve display of alpha blended materials (back to front),
+		and to reduce overdraw in opaque materials (front to back).
+		</p>
+
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>

+ 19 - 0
docs/examples/zh/utils/SceneUtils.html

@@ -40,6 +40,25 @@
 			该方法对于同时需要材质和线框绘制的物体非常有用。
 			该方法对于同时需要材质和线框绘制的物体非常有用。
 		</p>
 		</p>
 
 
+		<h3>[method:undefined sortInstancedMesh]( [param:InstancedMesh mesh], [param:Function compareFn] )</h3>
+		<p>
+		mesh -- InstancedMesh in which instances will be sorted. <br />
+		compareFn -- Comparator function defining the sort order.
+		</p>
+		<p>
+		Sorts the instances within an [page:InstancedMesh], according to a user-defined
+		callback. The callback will be provided with two arguments, <i>indexA</i>
+		and <i>indexB</i>, and must return a numerical value. See
+		[link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description Array.prototype.sort]
+		for more information on sorting callbacks and their return values.
+		</p>
+		<p>
+		Because of the high performance cost, three.js does not sort
+		[page:InstancedMesh] instances automatically. Manually sorting may be
+		helpful to improve display of alpha blended materials (back to front),
+		and to reduce overdraw in opaque materials (front to back).
+		</p>
+
 		<h2>源代码</h2>
 		<h2>源代码</h2>
 
 
 		<p>
 		<p>