|
@@ -10,18 +10,17 @@
|
|
|
<body>
|
|
|
[page:Mesh] →
|
|
|
|
|
|
- <h1>[name]</h1>
|
|
|
+ <h1>实例化网格([name])</h1>
|
|
|
|
|
|
<p class="desc">
|
|
|
- A special version of [page:Mesh] with instanced rendering support. Use [name] if you have to render a large number of
|
|
|
- objects with the same geometry and material but with different world transformations. The usage of [name] will help you
|
|
|
- to reduce the number of draw calls and thus improve the overall rendering performance in your application.
|
|
|
+ 一种具有实例化渲染支持的特殊版本的[page:Mesh]。你可以使用 [name] 来渲染大量具有相同几何体与材质、但具有不同世界变换的物体。
|
|
|
+ 使用 [name] 将帮助你减少 draw call 的数量,从而提升你应用程序的整体渲染性能。
|
|
|
</p>
|
|
|
<p>
|
|
|
- The current implementation requires that materials are not shared between [name] and other 3D objects.
|
|
|
+ 当前的实现需要[name]和其它3D物体间不共享材质。
|
|
|
</p>
|
|
|
|
|
|
- <h2>Examples</h2>
|
|
|
+ <h2>示例</h2>
|
|
|
|
|
|
<p>
|
|
|
[example:webgl_instancing_dynamic WebGL / instancing / dynamic]<br />
|
|
@@ -31,60 +30,59 @@
|
|
|
[example:webgl_instancing_raycast WebGL / instancing / raycast]
|
|
|
</p>
|
|
|
|
|
|
- <h2>Constructor</h2>
|
|
|
+ <h2>构造函数</h2>
|
|
|
<h3>[name]( [param:BufferGeometry geometry], [param:Material material], [param:Integer count] )</h3>
|
|
|
<p>
|
|
|
- [page:Geometry geometry] - an instance of [page:BufferGeometry].<br />
|
|
|
- [page:Material material] - an instance of [page:Material]. Default is a new [page:MeshBasicMaterial].<br />
|
|
|
- [page:Integer count] - the number of instances.<br />
|
|
|
+ [page:Geometry geometry] - 一个 [page:BufferGeometry] 的实例。<br />
|
|
|
+ [page:Material material] - 一个 [page:Material] 的实例。默认为一个新的 [page:MeshBasicMaterial] 。<br />
|
|
|
+ [page:Integer count] - 实例的数量<br />
|
|
|
</p>
|
|
|
|
|
|
- <h2>Properties</h2>
|
|
|
+ <h2>属性</h2>
|
|
|
<p>See the base [page:Mesh] class for common properties.</p>
|
|
|
|
|
|
<h3>[property:Integer count]</h3>
|
|
|
<p>
|
|
|
- The number of instances. The *count* value passed into the constructor represents the maximum number of
|
|
|
- instances of this mesh. You can change the number of instances at runtime to an integer value
|
|
|
- in the range [0, count].
|
|
|
+ 实例的数量。被传入到构造函数中的*count*表示mesh实例数量的最大值。
|
|
|
+ 你可以在运行时改变这个数值到 [0, count] 区间的一个整数。
|
|
|
</p>
|
|
|
<p>
|
|
|
- If you need more instances than the original count value, you have to create a new [name].
|
|
|
+ 如果你需要比原先的数量更多的实例数量,你需要创建一个新的[name]。
|
|
|
</p>
|
|
|
|
|
|
<h3>[property:BufferAttribute instanceMatrix]</h3>
|
|
|
<p>
|
|
|
- Represents the local transformation of all instances.
|
|
|
- You have to set its [page:BufferAttribute.needsUpdate needsUpdate] flag to true if you modify instanced data via [page:.setMatrixAt]().
|
|
|
+ 表示所有实例的本地变换。
|
|
|
+ 如果你要通过 [page:.setMatrixAt]() 来修改实例数据,你必须将它的 [page:BufferAttribute.needsUpdate needsUpdate] 标识为 true 。
|
|
|
</p>
|
|
|
|
|
|
|
|
|
- <h2>Methods</h2>
|
|
|
+ <h2>方法</h2>
|
|
|
<p>See the base [page:Mesh] class for common methods.</p>
|
|
|
|
|
|
<h3>[method:null getMatrixAt]( [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].
|
|
|
+ [page:Integer index]: 实例的索引。值必须在 [0, count] 区间。
|
|
|
</p>
|
|
|
<p>
|
|
|
- [page:Matrix4 matrix]: This 4x4 matrix will be set to the local transformation matrix of the defined instance.
|
|
|
+ [page:Matrix4 matrix]: 该4x4矩阵将会被设为已定义实例的本地变换矩阵。
|
|
|
</p>
|
|
|
<p>
|
|
|
- Get the local transformation matrix of the defined instance.
|
|
|
+ 获得已定义实例的本地变换矩阵。
|
|
|
</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].
|
|
|
+ [page:Integer index]: 实例的索引。值必须在 [0, count] 区间。
|
|
|
</p>
|
|
|
<p>
|
|
|
- [page:Matrix4 matrix]: A 4x4 matrix representing the local transformation of a single instance.
|
|
|
+ [page:Matrix4 matrix]: 一个4x4矩阵,表示单个实例本地变换。
|
|
|
</p>
|
|
|
<p>
|
|
|
- Sets the given local transformation matrix to the defined instance.
|
|
|
+ 设置给定的本地变换矩阵到已定义的实例。
|
|
|
</p>
|
|
|
|
|
|
- <h2>Source</h2>
|
|
|
+ <h2>源代码</h2>
|
|
|
|
|
|
<p>
|
|
|
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|