浏览代码

Merge pull request #10121 from looeee/moveWarningsToLegacy

Move various deprecated functions to Three.Legacy.js
Mr.doob 8 年之前
父节点
当前提交
1878540416

+ 59 - 0
src/Three.Legacy.js

@@ -21,8 +21,11 @@ import {
 import { BufferGeometry } from './core/BufferGeometry.js';
 import { BufferGeometry } from './core/BufferGeometry.js';
 import { EventDispatcher } from './core/EventDispatcher.js';
 import { EventDispatcher } from './core/EventDispatcher.js';
 import { Face3 } from './core/Face3.js';
 import { Face3 } from './core/Face3.js';
+import { Geometry } from './core/Geometry';
 import { Object3D } from './core/Object3D.js';
 import { Object3D } from './core/Object3D.js';
 import { Uniform } from './core/Uniform';
 import { Uniform } from './core/Uniform';
+import { CatmullRomCurve3 } from './extras/curves/CatmullRomCurve3.js';
+import { GridHelper } from './extras/helpers/GridHelper.js';
 import { BoxGeometry } from './geometries/BoxGeometry.js';
 import { BoxGeometry } from './geometries/BoxGeometry.js';
 import { EdgesGeometry } from './geometries/EdgesGeometry.js';
 import { EdgesGeometry } from './geometries/EdgesGeometry.js';
 import { ExtrudeGeometry } from './geometries/ExtrudeGeometry.js';
 import { ExtrudeGeometry } from './geometries/ExtrudeGeometry.js';
@@ -43,6 +46,7 @@ import { Box2 } from './math/Box2.js';
 import { Box3 } from './math/Box3.js';
 import { Box3 } from './math/Box3.js';
 import { Color } from './math/Color.js';
 import { Color } from './math/Color.js';
 import { Line3 } from './math/Line3.js';
 import { Line3 } from './math/Line3.js';
+import { _Math } from './math/Math.js';
 import { Matrix3 } from './math/Matrix3.js';
 import { Matrix3 } from './math/Matrix3.js';
 import { Matrix4 } from './math/Matrix4.js';
 import { Matrix4 } from './math/Matrix4.js';
 import { Plane } from './math/Plane.js';
 import { Plane } from './math/Plane.js';
@@ -155,6 +159,21 @@ export function Float64Attribute( array, itemSize ) {
 	return new Float64BufferAttribute( array, itemSize );
 	return new Float64BufferAttribute( array, itemSize );
 }
 }
 
 
+//
+
+export function ClosedSplineCurve3( points ) {
+
+	console.warn( 'THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3.' );
+
+	CatmullRomCurve3.call( this, points );
+	this.type = 'catmullrom';
+	this.closed = true;
+
+}
+
+ClosedSplineCurve3.prototype = Object.create( CatmullRomCurve3.prototype );
+
+
 //
 //
 
 
 export function EdgesHelper( object, hex ) {
 export function EdgesHelper( object, hex ) {
@@ -162,6 +181,12 @@ export function EdgesHelper( object, hex ) {
 	return new LineSegments( new EdgesGeometry( object.geometry ), new LineBasicMaterial( { color: hex !== undefined ? hex : 0xffffff } ) );
 	return new LineSegments( new EdgesGeometry( object.geometry ), new LineBasicMaterial( { color: hex !== undefined ? hex : 0xffffff } ) );
 }
 }
 
 
+Object.assign( GridHelper.prototype, {
+	setColors: function () {
+		console.error( 'THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.' );
+	}
+} )
+
 export function WireframeHelper( object, hex ) {
 export function WireframeHelper( object, hex ) {
 	console.warn( 'THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead.' );
 	console.warn( 'THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead.' );
 	return new LineSegments( new WireframeGeometry( object.geometry ), new LineBasicMaterial( { color: hex !== undefined ? hex : 0xffffff } ) );
 	return new LineSegments( new WireframeGeometry( object.geometry ), new LineBasicMaterial( { color: hex !== undefined ? hex : 0xffffff } ) );
@@ -225,7 +250,18 @@ Object.assign( Line3.prototype, {
 	}
 	}
 } );
 } );
 
 
+Object.assign( _Math, {
+	random16: function () {
+		console.warn( 'THREE.Math.random16() has been deprecated. Use Math.random() instead.' );
+		return Math.random();
+	},
+} );
+
 Object.assign( Matrix3.prototype, {
 Object.assign( Matrix3.prototype, {
+	flattenToArrayOffset: function ( array, offset ) {
+		console.warn( "THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead." );
+		return this.toArray( array, offset );
+	},
 	multiplyVector3: function ( vector ) {
 	multiplyVector3: function ( vector ) {
 		console.warn( 'THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.' );
 		console.warn( 'THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.' );
 		return vector.applyMatrix3( this );
 		return vector.applyMatrix3( this );
@@ -241,6 +277,22 @@ Object.assign( Matrix4.prototype, {
 		console.warn( 'THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().' );
 		console.warn( 'THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().' );
 		return this.copyPosition( m );
 		return this.copyPosition( m );
 	},
 	},
+	flattenToArrayOffset: function ( array, offset ) {
+		console.warn( "THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead." );
+
+		return this.toArray( array, offset );
+	},
+	getPosition: function () {
+
+		var v1;
+
+		return function getPosition() {
+			if ( v1 === undefined ) v1 = new Vector3();
+			console.warn( 'THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.' );
+			return v1.setFromMatrixColumn( this, 3 );
+		};
+
+	}(),
 	setRotationFromQuaternion: function ( q ) {
 	setRotationFromQuaternion: function ( q ) {
 		console.warn( 'THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().' );
 		console.warn( 'THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().' );
 		return this.makeRotationFromQuaternion( q );
 		return this.makeRotationFromQuaternion( q );
@@ -345,6 +397,13 @@ Object.assign( Vector3.prototype, {
 
 
 //
 //
 
 
+Object.assign( Geometry.prototype, {
+	computeTangents: function () {
+		console.warn( 'THREE.Geometry: .computeTangents() has been removed.' );
+	},
+
+} );
+
 Object.assign( Object3D.prototype, {
 Object.assign( Object3D.prototype, {
 	getChildByName: function ( name ) {
 	getChildByName: function ( name ) {
 		console.warn( 'THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().' );
 		console.warn( 'THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().' );

+ 0 - 1
src/Three.js

@@ -145,7 +145,6 @@ export { BoundingBoxHelper } from './extras/helpers/BoundingBoxHelper.js';
 export { BoxHelper } from './extras/helpers/BoxHelper.js';
 export { BoxHelper } from './extras/helpers/BoxHelper.js';
 export { ArrowHelper } from './extras/helpers/ArrowHelper.js';
 export { ArrowHelper } from './extras/helpers/ArrowHelper.js';
 export { AxisHelper } from './extras/helpers/AxisHelper.js';
 export { AxisHelper } from './extras/helpers/AxisHelper.js';
-export { ClosedSplineCurve3 } from './extras/curves/ClosedSplineCurve3.js';
 export { CatmullRomCurve3 } from './extras/curves/CatmullRomCurve3.js';
 export { CatmullRomCurve3 } from './extras/curves/CatmullRomCurve3.js';
 export { SplineCurve3 } from './extras/curves/SplineCurve3.js';
 export { SplineCurve3 } from './extras/curves/SplineCurve3.js';
 export { CubicBezierCurve3 } from './extras/curves/CubicBezierCurve3.js';
 export { CubicBezierCurve3 } from './extras/curves/CubicBezierCurve3.js';

+ 0 - 6
src/core/Geometry.js

@@ -656,12 +656,6 @@ Object.assign( Geometry.prototype, EventDispatcher.prototype, {
 
 
 	},
 	},
 
 
-	computeTangents: function () {
-
-		console.warn( 'THREE.Geometry: .computeTangents() has been removed.' );
-
-	},
-
 	computeLineDistances: function () {
 	computeLineDistances: function () {
 
 
 		var d = 0;
 		var d = 0;

+ 0 - 21
src/extras/curves/ClosedSplineCurve3.js

@@ -1,21 +0,0 @@
-import { CatmullRomCurve3 } from './CatmullRomCurve3';
-
-/**************************************************************
- *	Closed Spline 3D curve
- **************************************************************/
-
-
-function ClosedSplineCurve3( points ) {
-
-	console.warn( 'THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3.' );
-
-	CatmullRomCurve3.call( this, points );
-	this.type = 'catmullrom';
-	this.closed = true;
-
-}
-
-ClosedSplineCurve3.prototype = Object.create( CatmullRomCurve3.prototype );
-
-
-export { ClosedSplineCurve3 };

+ 0 - 7
src/extras/helpers/GridHelper.js

@@ -46,11 +46,4 @@ function GridHelper( size, divisions, color1, color2 ) {
 GridHelper.prototype = Object.create( LineSegments.prototype );
 GridHelper.prototype = Object.create( LineSegments.prototype );
 GridHelper.prototype.constructor = GridHelper;
 GridHelper.prototype.constructor = GridHelper;
 
 
-GridHelper.prototype.setColors = function () {
-
-	console.error( 'THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.' );
-
-};
-
-
 export { GridHelper };
 export { GridHelper };

+ 0 - 7
src/math/Math.js

@@ -100,13 +100,6 @@ var _Math = {
 
 
 	},
 	},
 
 
-	random16: function () {
-
-		console.warn( 'THREE.Math.random16() has been deprecated. Use Math.random() instead.' );
-		return Math.random();
-
-	},
-
 	// Random integer from <low, high> interval
 	// Random integer from <low, high> interval
 
 
 	randInt: function ( low, high ) {
 	randInt: function ( low, high ) {

+ 0 - 9
src/math/Matrix3.js

@@ -239,15 +239,6 @@ Matrix3.prototype = {
 
 
 	},
 	},
 
 
-	flattenToArrayOffset: function ( array, offset ) {
-
-		console.warn( "THREE.Matrix3: .flattenToArrayOffset is deprecated " +
-				"- just use .toArray instead." );
-
-		return this.toArray( array, offset );
-
-	},
-
 	getNormalMatrix: function ( matrix4 ) {
 	getNormalMatrix: function ( matrix4 ) {
 
 
 		return this.setFromMatrix4( matrix4 ).getInverse( this ).transpose();
 		return this.setFromMatrix4( matrix4 ).getInverse( this ).transpose();

+ 0 - 24
src/math/Matrix4.js

@@ -567,30 +567,6 @@ Matrix4.prototype = {
 
 
 	},
 	},
 
 
-	flattenToArrayOffset: function ( array, offset ) {
-
-		console.warn( "THREE.Matrix3: .flattenToArrayOffset is deprecated " +
-				"- just use .toArray instead." );
-
-		return this.toArray( array, offset );
-
-	},
-
-	getPosition: function () {
-
-		var v1;
-
-		return function getPosition() {
-
-			if ( v1 === undefined ) v1 = new Vector3();
-			console.warn( 'THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.' );
-
-			return v1.setFromMatrixColumn( this, 3 );
-
-		};
-
-	}(),
-
 	setPosition: function ( v ) {
 	setPosition: function ( v ) {
 
 
 		var te = this.elements;
 		var te = this.elements;