Browse Source

InstancedMesh: Add docs for setColorAt().

Mugen87 4 năm trước cách đây
mục cha
commit
4920a3848c

+ 18 - 0
docs/api/en/objects/InstancedMesh.html

@@ -51,6 +51,12 @@
 			If you need more instances than the original count value, you have to create a new [name].
 		</p>
 
+		<h3>[property:BufferAttribute instanceColor]</h3>
+		<p>
+			Represents the colors of all instances. *null* by default.
+			You have to set its [page:BufferAttribute.needsUpdate needsUpdate] flag to true if you modify instanced data via [page:.setColorAt]().
+		</p>
+
 		<h3>[property:BufferAttribute instanceMatrix]</h3>
 		<p>
 			Represents the local transformation of all instances.
@@ -71,6 +77,18 @@
 			Get the local transformation matrix of the defined instance.
 		</p>
 
+		<h3>[method:null setColorAt]( [param:Integer index], [param:Color color] )</h3>
+		<p>
+			[page:Integer index]: The index of an instance. Values have to be in the range [0, count].
+		</p>
+		<p>
+			[page:Color color]: The color of a single instance.
+		</p>
+		<p>
+			Sets the given color to the defined instance.
+			Make sure you set [page:.instanceColor][page:BufferAttribute.needsUpdate .needsUpdate] to true after updating all the colors.
+		</p>
+
 		<h3>[method:null setMatrixAt]( [param:Integer index], [param:Matrix4 matrix] )</h3>
 		<p>
 			[page:Integer index]: The index of an instance. Values have to be in the range [0, count].

+ 18 - 0
docs/api/zh/objects/InstancedMesh.html

@@ -49,6 +49,12 @@
 			如果你需要比原先的数量更多的实例数量,你需要创建一个新的[name]。
 		</p>
 
+		<h3>[property:BufferAttribute instanceColor]</h3>
+		<p>
+			Represents the colors of all instances. *null* by default.
+			You have to set its [page:BufferAttribute.needsUpdate needsUpdate] flag to true if you modify instanced data via [page:.setColorAt]().
+		</p>
+
 		<h3>[property:BufferAttribute instanceMatrix]</h3>
 		<p>
 			表示所有实例的本地变换。
@@ -70,6 +76,18 @@
 			获得已定义实例的本地变换矩阵。
 		</p>
 
+		<h3>[method:null setColorAt]( [param:Integer index], [param:Color color] )</h3>
+		<p>
+			[page:Integer index]: The index of an instance. Values have to be in the range [0, count].
+		</p>
+		<p>
+			[page:Color color]: The color of a single instance.
+		</p>
+		<p>
+			Sets the given color to the defined instance.
+			Make sure you set [page:.instanceColor][page:BufferAttribute.needsUpdate .needsUpdate] to true after updating all the colors.
+		</p>
+
 		<h3>[method:null setMatrixAt]( [param:Integer index], [param:Matrix4 matrix] )</h3>
 		<p>
 			[page:Integer index]: 实例的索引。值必须在 [0, count] 区间。

+ 1 - 0
src/objects/InstancedMesh.d.ts

@@ -18,6 +18,7 @@ export class InstancedMesh <
 	);
 
 	count: number;
+	instanceColor: null | BufferAttribute;
 	instanceMatrix: BufferAttribute;
 	readonly isInstancedMesh: true;