Skip to content

Commit

Permalink
Merge pull request #10367 from Mugen87/dev
Browse files Browse the repository at this point in the history
Matrix3/Matrix4: Removed .applyToVector3Array()
  • Loading branch information
mrdoob authored Dec 15, 2016
2 parents 7206558 + 7b666bf commit 700d80e
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 84 deletions.
12 changes: 10 additions & 2 deletions docs/api/deprecated/DeprecatedList.html
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,11 @@ <h3>[page:Matrix3]</h3>

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>
Expand Down Expand Up @@ -327,7 +331,11 @@ <h3>[page:Matrix4]</h3>

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>


Expand Down
12 changes: 1 addition & 11 deletions docs/api/math/Matrix3.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,7 @@ <h3>[method:Array applyToBufferAttribute]( [page:BufferAttribute attribute] )</h

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>
Expand Down
13 changes: 1 addition & 12 deletions docs/api/math/Matrix4.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,7 @@ <h3>[method:Array applyToBufferAttribute]( [page:BufferAttribute attribute] )</h

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>
Expand Down
12 changes: 6 additions & 6 deletions editor/js/libs/tern-threejs/threejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
14 changes: 11 additions & 3 deletions examples/webgl_interactive_instances_gpu.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
10 changes: 10 additions & 0 deletions src/Three.Legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.' );

}

} );
Expand Down Expand Up @@ -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.' );

}

} );
Expand Down
4 changes: 2 additions & 2 deletions src/core/BufferGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {

if ( position !== undefined ) {

matrix.applyToVector3Array( position.array );
matrix.applyToBufferAttribute( position );
position.needsUpdate = true;

}
Expand All @@ -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;

}
Expand Down
24 changes: 0 additions & 24 deletions src/math/Matrix3.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
24 changes: 0 additions & 24 deletions src/math/Matrix4.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 700d80e

Please sign in to comment.