提交 f9160a17 编写于 作者: M Mugen87

Matrix3/Matrix4: Removed .applyToVector3Array()

上级 5a24dac5
......@@ -297,7 +297,11 @@
Matrix3.multiplyVector3 has been removed. Use vector.applyMatrix3( matrix ) instead.<br /><br />
Matrix3.multiplyVector3Array has been renamed to [page:Matrix3.applyToVector3Array]( array ).
Matrix3.multiplyVector3Array has been renamed to [page:Matrix3.applyToVector3Array]( array ).<br /><br />
Matrix3.applyToBuffer has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.<br /><br />
Matrix3.applyToVector3Array has been removed.
<div>
<h3>[page:Matrix4]</h3>
......@@ -327,7 +331,11 @@
Matrix4.rotateZ has been removed.<br /><br />
Matrix4.rotateByAxis has been removed.
Matrix4.rotateByAxis has been removed.<br /><br />
Matrix4.applyToBuffer has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.<br /><br />
Matrix4.applyToVector3Array has been removed.
</div>
......
......@@ -78,17 +78,7 @@ m.elements = [ 11, 21, 31,
Multiplies (applies) this matrix to every 3D vector in the [page:BufferAttribute attribute].
</div>
<h3>[method:Array applyToVector3Array]( [page:Array array], [page:Number offset], [page:Number length] )</h3>
<div>
[page:Array array] - An array of floats in the form [vector1x, vector1y, vector1z, vector2x, vector2y, vector2z, ...],
that represent 3D vectors.<br />
[page:Number offset] - (optional) index in the array of the first vector's x component. Default is 0.<br />
[page:Number length] - (optional) index in the array of the last vector's z component.
Default is the last element in the array.<br /><br />
Multiplies (applies) this matrix to every 3D vector in the [page:Array array].
</div>
<h3>[method:Matrix3 clone]()</h3>
<div>Creates a new Matrix3 and with identical elements to this one.</div>
......
......@@ -116,18 +116,7 @@ m.elements = [ 11, 21, 31, 41,
Multiplies (applies) this matrix to every 3D vector in the [page:BufferAttribute attribute].
</div>
<h3>[method:Array applyToVector3Array]( [page:Array array], [page:Number offset], [page:Number length] )</h3>
<div>
[page:Array array] - An array of floats in the form [vector1x, vector1y, vector1z, vector2x, vector2y, vector2z, ...],
that represent 3D vectors.<br />
[page:Number offset] - (optional) index in the array of the first vector's x component. Default is 0.<br />
[page:Number length] - (optional) index in the array of the last vector's z component.
Default is the last element in the array.<br /><br />
Multiplies (applies) the upper 3x3 matrix of this matrix to every 3D vector in the [page:Array array].
</div>
<h3>[method:Matrix4 clone]()</h3>
<div>Creates a new Matrix4 with identical [page:.elements elements] to this one.</div>
......
......@@ -3774,9 +3774,9 @@
"!type": "fn(scalar: number) -> +THREE.Matrix3",
"!doc": "Multiply every component of the matrix by a scalar value."
},
"applyToVector3Array": {
"!type": "fn(array: []) -> []",
"!doc": "Multiply (apply) this matrix to every vector3 in the array."
"applyToBufferAttribute": {
"!type": "fn(attribute: []) -> +THREE.BufferAttribute",
"!doc": "Multiply (apply) this matrix to every vector3 in the attribute."
},
"getNormalMatrix": {
"!type": "fn(matrix4: +THREE.Matrix4) -> +THREE.Matrix3",
......@@ -3937,9 +3937,9 @@
"!type": "fn() -> +THREE.Matrix4",
"!doc": "Clones this matrix."
},
"applyToVector3Array": {
"!type": "fn(a: []) -> []",
"!doc": "Multiply (apply) this matrix to every vector3 in the array."
"applyToBufferAttribute": {
"!type": "fn(attribute: []) -> +THREE.BufferAttribute",
"!doc": "Multiply (apply) this matrix to every vector3 in the attribute."
},
"getMaxScaleOnAxis": {
"!type": "fn() -> number",
......
......@@ -718,16 +718,24 @@
var vertices = new THREE.BufferAttribute(
new Float32Array( instanceCount * posLen ), 3
);
var vertex = new THREE.Vector3();
var matrix = new THREE.Matrix4();
for ( var i = 0, ul = instanceCount; i < ul; i ++ ) {
var offset = i * posLen;
randomizeMatrix( matrix );
var object = new THREE.Object3D();
objectCount ++;
object.applyMatrix( matrix );
pickingData[ i + 1 ] = object;
vertices.set( pos.array, i * posLen );
matrix.applyToVector3Array( vertices.array, i * posLen, posLen )
vertices.set( pos.array, offset );
for ( var k = 0, l = offset; k < posLen; k += 3, l += 3 ) {
vertex.fromArray( vertices.array, l );
vertex.applyMatrix4( matrix );
vertex.toArray( vertices.array, l );
}
}
mgeo.addAttribute( 'position', vertices );
......
......@@ -359,6 +359,11 @@ Object.assign( Matrix3.prototype, {
console.warn( 'THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.' );
return this.applyToBufferAttribute( buffer );
},
applyToVector3Array: function( array, offset, length ) {
console.error( 'THREE.Matrix3: .applyToVector3Array() has been removed.' );
}
} );
......@@ -456,6 +461,11 @@ Object.assign( Matrix4.prototype, {
console.warn( 'THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.' );
return this.applyToBufferAttribute( buffer );
},
applyToVector3Array: function( array, offset, length ) {
console.error( 'THREE.Matrix4: .applyToVector3Array() has been removed.' );
}
} );
......
......@@ -126,7 +126,7 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
if ( position !== undefined ) {
matrix.applyToVector3Array( position.array );
matrix.applyToBufferAttribute( position );
position.needsUpdate = true;
}
......@@ -137,7 +137,7 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
var normalMatrix = new Matrix3().getNormalMatrix( matrix );
normalMatrix.applyToVector3Array( normal.array );
normalMatrix.applyToBufferAttribute( normal );
normal.needsUpdate = true;
}
......
......@@ -95,30 +95,6 @@ Matrix3.prototype = {
},
applyToVector3Array: function () {
var v1;
return function applyToVector3Array( array, offset, length ) {
if ( v1 === undefined ) v1 = new Vector3();
if ( offset === undefined ) offset = 0;
if ( length === undefined ) length = array.length;
for ( var i = 0, j = offset; i < length; i += 3, j += 3 ) {
v1.fromArray( array, j );
v1.applyMatrix3( this );
v1.toArray( array, j );
}
return array;
};
}(),
applyToBufferAttribute: function () {
var v1;
......
......@@ -448,30 +448,6 @@ Matrix4.prototype = {
},
applyToVector3Array: function () {
var v1;
return function applyToVector3Array( array, offset, length ) {
if ( v1 === undefined ) v1 = new Vector3();
if ( offset === undefined ) offset = 0;
if ( length === undefined ) length = array.length;
for ( var i = 0, j = offset; i < length; i += 3, j += 3 ) {
v1.fromArray( array, j );
v1.applyMatrix4( this );
v1.toArray( array, j );
}
return array;
};
}(),
applyToBufferAttribute: function () {
var v1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册