Procházet zdrojové kódy

Merge pull request #10412 from Mugen87/dev

Vector2/3/4: Renamed .fromAttribute() to .fromBufferAttribute()
Mr.doob před 8 roky
rodič
revize
cc8c356847

+ 12 - 1
docs/api/deprecated/DeprecatedList.html

@@ -355,6 +355,10 @@
 			Ray.isIntersectionSphere has been renamed to [page:Ray.intersectsSphere].
 		</div>
 
+		<h3>[page:Vector2]</h3>
+		<div>
+			Vector2.fromAttribute() has been renamed to [page:Vector2.fromBufferAttribute]().
+		</div>
 
 		<h3>[page:Vector3]</h3>
 		<div>
@@ -366,7 +370,14 @@
 
 			Vector3.getScaleFromMatrix() has been renamed to [page:Vector3.setFromMatrixScale]().<br /><br />
 
-			Vector3.getColumnFromMatrix() has been renamed to [page:Vector3.setFromMatrixColumn]().
+			Vector3.getColumnFromMatrix() has been renamed to [page:Vector3.setFromMatrixColumn]().<br /><br />
+
+			Vector3.fromAttribute() has been renamed to [page:Vector3.fromBufferAttribute]().
+		</div>
+
+		<h3>[page:Vector4]</h3>
+		<div>
+			Vector4.fromAttribute() has been renamed to [page:Vector4.fromBufferAttribute]().
 		</div>
 
 		<h3>[page:Vertex]</h3>

+ 1 - 2
docs/api/math/Vector2.html

@@ -184,11 +184,10 @@
 		Sets this vector's [page:.x x] value to be array[0] and [page:.y y] value to be array[1].
 		</div>
 
-		<h3>[method:Vector2 fromAttribute]( [page:BufferAttribute attribute], [page:Integer index], [page:Integer offset] )</h3>
+		<h3>[method:Vector2 fromBufferAttribute]( [page:BufferAttribute attribute], [page:Integer index] )</h3>
 		<div>
 		[page:BufferAttribute attribute] - the source attribute.<br />
 		[page:Integer index] - index in the attribute.<br /><br />
-		[page:Integer offset] - (optional) offset into the attribute. Default is 0.<br /><br />
 
 		Sets this vector's [page:.x x] and [page:.y y] values from the [page:BufferAttribute attribute].
 		</div>

+ 1 - 2
docs/api/math/Vector3.html

@@ -242,11 +242,10 @@ m, n, o
 		and [page:.z z] value to be array[ offset + 2 ].
 		</div>
 
-		<h3>[method:Vector3 fromAttribute]( [page:BufferAttribute attribute], [page:Integer index], [page:Integer offset] )</h3>
+		<h3>[method:Vector3 fromBufferAttribute]( [page:BufferAttribute attribute], [page:Integer index] )</h3>
 		<div>
 		[page:BufferAttribute attribute] - the source attribute.<br />
 		[page:Integer index] - index in the attribute.<br /><br />
-		[page:Integer offset] - (optional) offset into the attribute. Default is 0.<br /><br />
 
 		Sets this vector's [page:.x x], [page:.y y] and [page:.z z] values from the [page:BufferAttribute attribute].
 		</div>

+ 1 - 2
docs/api/math/Vector4.html

@@ -157,11 +157,10 @@ var d = a.distanceTo( b );
 		[page:.z z] value to be array[ offset + 2 ] and [page:.w w ] value to be array[ offset + 3 ].
 		</div>
 
-		<h3>[method:Vector4 fromAttribute]( [page:BufferAttribute attribute], [page:Integer index], [page:Integer offset] )</h3>
+		<h3>[method:Vector4 fromBufferAttribute]( [page:BufferAttribute attribute], [page:Integer index] )</h3>
 		<div>
 		[page:BufferAttribute attribute] - the source attribute.<br />
 		[page:Integer index] - index in the attribute.<br /><br />
-		[page:Integer offset] - (optional) offset into the attribute. Default is 0.<br /><br />
 
 		Sets this vector's [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values from the [page:BufferAttribute attribute].
 		</div>

+ 31 - 0
src/Three.Legacy.js

@@ -52,7 +52,9 @@ import { Matrix4 } from './math/Matrix4.js';
 import { Plane } from './math/Plane.js';
 import { Quaternion } from './math/Quaternion.js';
 import { Ray } from './math/Ray.js';
+import { Vector2 } from './math/Vector2.js';
 import { Vector3 } from './math/Vector3.js';
+import { Vector4 } from './math/Vector4.js';
 import { LineSegments } from './objects/LineSegments.js';
 import { LOD } from './objects/LOD.js';
 import { Points } from './objects/Points.js';
@@ -541,6 +543,17 @@ Object.assign( Shape.prototype, {
 
 } );
 
+Object.assign( Vector2.prototype, {
+
+	fromAttribute: function ( attribute, index, offset ) {
+
+		console.error( 'THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().' );
+		return this.fromBufferAttribute( attribute, index, offset );
+
+	}
+
+} );
+
 Object.assign( Vector3.prototype, {
 
 	setEulerFromRotationMatrix: function () {
@@ -570,6 +583,24 @@ Object.assign( Vector3.prototype, {
 		console.warn( 'THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().' );
 		return this.setFromMatrixColumn( matrix, index );
 
+	},
+
+	fromAttribute: function ( attribute, index, offset ) {
+
+		console.error( 'THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().' );
+		return this.fromBufferAttribute( attribute, index, offset );
+
+	}
+
+} );
+
+Object.assign( Vector4.prototype, {
+
+	fromAttribute: function ( attribute, index, offset ) {
+
+		console.error( 'THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().' );
+		return this.fromBufferAttribute( attribute, index, offset );
+
 	}
 
 } );

+ 1 - 1
src/math/Box3.js

@@ -165,7 +165,7 @@ Box3.prototype = {
 
 							for ( i = 0, l = attribute.count; i < l; i ++ ) {
 
-								v1.fromAttribute( attribute, i ).applyMatrix4( node.matrixWorld );
+								v1.fromBufferAttribute( attribute, i ).applyMatrix4( node.matrixWorld );
 
 								scope.expandByPoint( v1 );
 

+ 2 - 2
src/math/Vector2.js

@@ -453,11 +453,11 @@ Vector2.prototype = {
 
 	},
 
-	fromAttribute: function ( attribute, index, offset ) {
+	fromBufferAttribute: function ( attribute, index, offset ) {
 
 		if ( offset !== undefined ) {
 
-			console.warn( 'THREE.Vector2: offset has been removed from .fromAttribute().' );
+			console.warn( 'THREE.Vector2: offset has been removed from .fromBufferAttribute().' );
 
 		}
 

+ 2 - 2
src/math/Vector3.js

@@ -761,11 +761,11 @@ Vector3.prototype = {
 
 	},
 
-	fromAttribute: function ( attribute, index, offset ) {
+	fromBufferAttribute: function ( attribute, index, offset ) {
 
 		if ( offset !== undefined ) {
 
-			console.warn( 'THREE.Vector3: offset has been removed from .fromAttribute().' );
+			console.warn( 'THREE.Vector3: offset has been removed from .fromBufferAttribute().' );
 
 		}
 

+ 2 - 2
src/math/Vector4.js

@@ -611,11 +611,11 @@ Vector4.prototype = {
 
 	},
 
-	fromAttribute: function ( attribute, index, offset ) {
+	fromBufferAttribute: function ( attribute, index, offset ) {
 
 		if ( offset !== undefined ) {
 
-			console.warn( 'THREE.Vector4: offset has been removed from .fromAttribute().' );
+			console.warn( 'THREE.Vector4: offset has been removed from .fromBufferAttribute().' );
 
 		}
 

+ 6 - 6
src/objects/Mesh.js

@@ -145,9 +145,9 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 		function checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {
 
-			vA.fromAttribute( position, a );
-			vB.fromAttribute( position, b );
-			vC.fromAttribute( position, c );
+			vA.fromBufferAttribute( position, a );
+			vB.fromBufferAttribute( position, b );
+			vC.fromBufferAttribute( position, c );
 
 			var intersection = checkIntersection( object, raycaster, ray, vA, vB, vC, intersectionPoint );
 
@@ -155,9 +155,9 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 				if ( uv ) {
 
-					uvA.fromAttribute( uv, a );
-					uvB.fromAttribute( uv, b );
-					uvC.fromAttribute( uv, c );
+					uvA.fromBufferAttribute( uv, a );
+					uvB.fromBufferAttribute( uv, b );
+					uvC.fromBufferAttribute( uv, c );
 
 					intersection.uv = uvIntersection( intersectionPoint,  vA, vB, vC, uvA, uvB, uvC );