提交 c85879e1 编写于 作者: M Mugen87

Matrix3/Matrix4: Simplify .applyToBufferAttribute()

上级 e863f01a
......@@ -74,9 +74,7 @@ m.elements = [ 11, 21, 31,
<h3>[method:Array applyToBufferAttribute]( [page:BufferAttribute attribute], [page:Number offset], [page:Number count] )</h3>
<div>
[page:BufferAttribute attribute] - An attribute of floats that represent 3D vectors.<br />
[page:Number offset] - (optional) index in the attribute of the first vector. Default is 0.<br />
[page:Number count] - (optional) number of vectors that are processed. Default is attribute.count.<br /><br />
[page:BufferAttribute attribute] - An attribute of floats that represent 3D vectors.<br /><br />
Multiplies (applies) this matrix to every 3D vector in the [page:BufferAttribute attribute].
</div>
......
......@@ -112,9 +112,7 @@ m.elements = [ 11, 21, 31, 41,
<h3>[method:Array applyToBufferAttribute]( [page:BufferAttribute attribute], [page:Number offset], [page:Number count] )</h3>
<div>
[page:BufferAttribute attribute] - An attribute of floats that represent 3D vectors.<br />
[page:Number offset] - (optional) index in the attribute of the first vector. Default is 0.<br />
[page:Number count] - (optional) number of vectors that are processed. Default is attribute.count.<br /><br />
[page:BufferAttribute attribute] - An attribute of floats that represent 3D vectors.<br /><br />
Multiplies (applies) this matrix to every 3D vector in the [page:BufferAttribute attribute].
</div>
......
......@@ -356,8 +356,8 @@ Object.assign( Matrix3.prototype, {
},
applyToBuffer: function( buffer, offset, length ) {
console.warn( 'THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute, offset, count ) instead.' );
return this.applyToBufferAttribute( buffer, offset, length );
console.warn( 'THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.' );
return this.applyToBufferAttribute( buffer );
}
......@@ -453,8 +453,8 @@ Object.assign( Matrix4.prototype, {
},
applyToBuffer: function( buffer, offset, length ) {
console.warn( 'THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute, offset, count ) instead.' );
return this.applyToBufferAttribute( buffer, offset, length );
console.warn( 'THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.' );
return this.applyToBufferAttribute( buffer );
}
......
......@@ -123,21 +123,19 @@ Matrix3.prototype = {
var v1;
return function applyToBufferAttribute( attribute, offset, count ) {
return function applyToBufferAttribute( attribute ) {
if ( v1 === undefined ) v1 = new Vector3();
if ( offset === undefined ) offset = 0;
if ( count === undefined ) count = attribute.count;
for ( var i = 0, j = offset; i < count; i ++, j ++ ) {
for ( var i = 0, l = attribute.count; i < l; i ++ ) {
v1.x = attribute.getX( j );
v1.y = attribute.getY( j );
v1.z = attribute.getZ( j );
v1.x = attribute.getX( i );
v1.y = attribute.getY( i );
v1.z = attribute.getZ( i );
v1.applyMatrix3( this );
attribute.setXYZ( j, v1.x, v1.y, v1.z );
attribute.setXYZ( i, v1.x, v1.y, v1.z );
}
......
......@@ -476,21 +476,19 @@ Matrix4.prototype = {
var v1;
return function applyToBufferAttribute( attribute, offset, count ) {
return function applyToBufferAttribute( attribute ) {
if ( v1 === undefined ) v1 = new Vector3();
if ( offset === undefined ) offset = 0;
if ( count === undefined ) count = attribute.count;
for ( var i = 0, j = offset; i < count; i ++, j ++ ) {
for ( var i = 0, l = attribute.count; i < l; i ++ ) {
v1.x = attribute.getX( j );
v1.y = attribute.getY( j );
v1.z = attribute.getZ( j );
v1.x = attribute.getX( i );
v1.y = attribute.getY( i );
v1.z = attribute.getZ( i );
v1.applyMatrix4( this );
attribute.setXYZ( j, v1.x, v1.y, v1.z );
attribute.setXYZ( i, v1.x, v1.y, v1.z );
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册