浏览代码

InstancedMesh: Changed setMatrixAt parameter order.

Mr.doob 5 年之前
父节点
当前提交
6d8059c95d
共有 2 个文件被更改,包括 4 次插入4 次删除
  1. 1 1
      examples/webgl_instancing.html
  2. 3 3
      src/objects/InstancedMesh.js

+ 1 - 1
examples/webgl_instancing.html

@@ -57,7 +57,7 @@
 
 					dummy.updateMatrix();
 
-					mesh.setMatrixAt( dummy.matrix, i );
+					mesh.setMatrixAt( i, dummy.matrix );
 
 				}
 

+ 3 - 3
src/objects/InstancedMesh.js

@@ -25,11 +25,11 @@ InstancedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), {
 
 	raycast: function () {},
 
-	setMatrixAt: function ( matrix, offset ) {
+	setMatrixAt: function ( index, matrix ) {
 
-		matrix.toArray( this.instanceMatrix.array, offset * 16 );
+		matrix.toArray( this.instanceMatrix.array, index * 16 );
 
-		_matrix3.getNormalMatrix( matrix ).toArray( this.instanceNormalMatrix.array, offset * 9 );
+		_matrix3.getNormalMatrix( matrix ).toArray( this.instanceNormalMatrix.array, index * 9 );
 
 	},