Three.Legacy.js 25.0 KB
Newer Older
M
Mr.doob 已提交
1 2 3 4
/**
 * @author mrdoob / http://mrdoob.com/
 */

5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
import { Audio } from './audio/Audio.js';
import { AudioAnalyser } from './audio/AudioAnalyser.js';
import { PerspectiveCamera } from './cameras/PerspectiveCamera.js';
import { CullFaceFront, CullFaceBack } from './constants.js';
import { BufferAttribute } from './core/BufferAttribute.js';
import { BufferGeometry } from './core/BufferGeometry.js';
import { EventDispatcher } from './core/EventDispatcher.js';
import { Face3 } from './core/Face3.js';
import { Object3D } from './core/Object3D.js';
import { BoxGeometry } from './extras/geometries/BoxGeometry.js';
import { Light } from './lights/Light.js';
import { AudioLoader } from './loaders/AudioLoader.js';
import { CubeTextureLoader } from './loaders/CubeTextureLoader.js';
import { TextureLoader } from './loaders/TextureLoader.js';
import { Material } from './materials/Material.js';
import { MeshPhongMaterial } from './materials/MeshPhongMaterial.js';
import { MultiMaterial } from './materials/MultiMaterial.js';
import { PointsMaterial } from './materials/PointsMaterial.js';
import { ShaderMaterial } from './materials/ShaderMaterial.js';
import { Box2 } from './math/Box2.js';
import { Box3 } from './math/Box3.js';
import { Color } from './math/Color.js';
import { Matrix3 } from './math/Matrix3.js';
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 { Vector3 } from './math/Vector3.js';
import { LOD } from './objects/LOD.js';
import { Points } from './objects/Points.js';
import { Sprite } from './objects/Sprite.js';
import { WebGLRenderer } from './renderers/WebGLRenderer.js';
import { WebGLRenderTarget } from './renderers/WebGLRenderTarget.js';
import { WebGLShadowMap } from './renderers/webgl/WebGLShadowMap.js';

export { BoxGeometry as CubeGeometry };

export function Face4 ( a, b, c, d, normal, color, materialIndex ) {
	console.warn( 'THREE.Face4 has been removed. A THREE.Face3 will be created instead.' );
	return new Face3( a, b, c, normal, color, materialIndex );
}

export const LineStrip = 0;

export const LinePieces = 1;

export { MultiMaterial as MeshFaceMaterial };

export function PointCloud ( geometry, material ) {
	console.warn( 'THREE.PointCloud has been renamed to THREE.Points.' );
	return new Points( geometry, material );
}

export { Sprite as Particle };

export function ParticleSystem ( geometry, material ) {
	console.warn( 'THREE.ParticleSystem has been renamed to THREE.Points.' );
	return new Points( geometry, material );
}

export function PointCloudMaterial ( parameters ) {
	console.warn( 'THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.' );
	return new PointsMaterial( parameters );
}

export function ParticleBasicMaterial ( parameters ) {
	console.warn( 'THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.' );
	return new PointsMaterial( parameters );
}

export function ParticleSystemMaterial ( parameters ) {
	console.warn( 'THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.' );
	return new PointsMaterial( parameters );
}

export function Vertex ( x, y, z ) {
	console.warn( 'THREE.Vertex has been removed. Use THREE.Vector3 instead.' );
	return new Vector3( x, y, z );
}
M
Mr.doob 已提交
84 85 86

//

87
Object.assign( Box2.prototype, {
M
Mr.doob 已提交
88 89 90
	empty: function () {
		console.warn( 'THREE.Box2: .empty() has been renamed to .isEmpty().' );
		return this.isEmpty();
91
	},
M
Mr.doob 已提交
92 93 94
	isIntersectionBox: function ( box ) {
		console.warn( 'THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().' );
		return this.intersectsBox( box );
M
Mr.doob 已提交
95 96 97
	}
} );

98
Object.assign( Box3.prototype, {
M
Mr.doob 已提交
99 100 101
	empty: function () {
		console.warn( 'THREE.Box3: .empty() has been renamed to .isEmpty().' );
		return this.isEmpty();
102
	},
M
Mr.doob 已提交
103 104 105
	isIntersectionBox: function ( box ) {
		console.warn( 'THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().' );
		return this.intersectsBox( box );
M
Mr.doob 已提交
106
	},
M
Mr.doob 已提交
107 108 109
	isIntersectionSphere: function ( sphere ) {
		console.warn( 'THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().' );
		return this.intersectsSphere( sphere );
M
Mr.doob 已提交
110 111 112
	}
} );

113
Object.assign( Matrix3.prototype, {
M
Mr.doob 已提交
114 115 116
	multiplyVector3: function ( vector ) {
		console.warn( 'THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.' );
		return vector.applyMatrix3( this );
M
Mr.doob 已提交
117
	},
M
Mr.doob 已提交
118 119 120
	multiplyVector3Array: function ( a ) {
		console.warn( 'THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' );
		return this.applyToVector3Array( a );
M
Mr.doob 已提交
121 122 123
	}
} );

124
Object.assign( Matrix4.prototype, {
M
Mr.doob 已提交
125 126 127
	extractPosition: function ( m ) {
		console.warn( 'THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().' );
		return this.copyPosition( m );
M
Mr.doob 已提交
128
	},
M
Mr.doob 已提交
129 130 131
	setRotationFromQuaternion: function ( q ) {
		console.warn( 'THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().' );
		return this.makeRotationFromQuaternion( q );
M
Mr.doob 已提交
132
	},
M
Mr.doob 已提交
133 134 135
	multiplyVector3: function ( vector ) {
		console.warn( 'THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.' );
		return vector.applyProjection( this );
M
Mr.doob 已提交
136
	},
M
Mr.doob 已提交
137 138 139
	multiplyVector4: function ( vector ) {
		console.warn( 'THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.' );
		return vector.applyMatrix4( this );
M
Mr.doob 已提交
140
	},
M
Mr.doob 已提交
141 142 143
	multiplyVector3Array: function ( a ) {
		console.warn( 'THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' );
		return this.applyToVector3Array( a );
M
Mr.doob 已提交
144
	},
M
Mr.doob 已提交
145 146 147
	rotateAxis: function ( v ) {
		console.warn( 'THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.' );
		v.transformDirection( this );
M
Mr.doob 已提交
148
	},
M
Mr.doob 已提交
149 150 151
	crossVector: function ( vector ) {
		console.warn( 'THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.' );
		return vector.applyMatrix4( this );
M
Mr.doob 已提交
152
	},
M
Mr.doob 已提交
153 154
	translate: function ( v ) {
		console.error( 'THREE.Matrix4: .translate() has been removed.' );
M
Mr.doob 已提交
155
	},
M
Mr.doob 已提交
156 157
	rotateX: function ( angle ) {
		console.error( 'THREE.Matrix4: .rotateX() has been removed.' );
M
Mr.doob 已提交
158
	},
M
Mr.doob 已提交
159 160
	rotateY: function ( angle ) {
		console.error( 'THREE.Matrix4: .rotateY() has been removed.' );
M
Mr.doob 已提交
161
	},
M
Mr.doob 已提交
162 163
	rotateZ: function ( angle ) {
		console.error( 'THREE.Matrix4: .rotateZ() has been removed.' );
M
Mr.doob 已提交
164
	},
M
Mr.doob 已提交
165 166
	rotateByAxis: function ( axis, angle ) {
		console.error( 'THREE.Matrix4: .rotateByAxis() has been removed.' );
M
Mr.doob 已提交
167 168 169
	}
} );

170
Object.assign( Plane.prototype, {
M
Mr.doob 已提交
171 172 173
	isIntersectionLine: function ( line ) {
		console.warn( 'THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().' );
		return this.intersectsLine( line );
M
Mr.doob 已提交
174
	}
M
Mr.doob 已提交
175 176
} );

177
Object.assign( Quaternion.prototype, {
M
Mr.doob 已提交
178 179 180
	multiplyVector3: function ( vector ) {
		console.warn( 'THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.' );
		return vector.applyQuaternion( this );
M
Mr.doob 已提交
181 182 183
	}
} );

184
Object.assign( Ray.prototype, {
M
Mr.doob 已提交
185 186 187
	isIntersectionBox: function ( box ) {
		console.warn( 'THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().' );
		return this.intersectsBox( box );
M
Mr.doob 已提交
188
	},
M
Mr.doob 已提交
189 190 191
	isIntersectionPlane: function ( plane ) {
		console.warn( 'THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().' );
		return this.intersectsPlane( plane );
M
Mr.doob 已提交
192
	},
M
Mr.doob 已提交
193 194 195
	isIntersectionSphere: function ( sphere ) {
		console.warn( 'THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().' );
		return this.intersectsSphere( sphere );
M
Mr.doob 已提交
196 197 198
	}
} );

199
Object.assign( Vector3.prototype, {
M
Mr.doob 已提交
200 201
	setEulerFromRotationMatrix: function () {
		console.error( 'THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.' );
M
Mr.doob 已提交
202
	},
M
Mr.doob 已提交
203 204
	setEulerFromQuaternion: function () {
		console.error( 'THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.' );
M
Mr.doob 已提交
205
	},
M
Mr.doob 已提交
206 207 208
	getPositionFromMatrix: function ( m ) {
		console.warn( 'THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().' );
		return this.setFromMatrixPosition( m );
M
Mr.doob 已提交
209
	},
M
Mr.doob 已提交
210 211 212
	getScaleFromMatrix: function ( m ) {
		console.warn( 'THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().' );
		return this.setFromMatrixScale( m );
M
Mr.doob 已提交
213
	},
M
Mr.doob 已提交
214 215 216
	getColumnFromMatrix: function ( index, matrix ) {
		console.warn( 'THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().' );
		return this.setFromMatrixColumn( matrix, index );
M
Mr.doob 已提交
217 218 219 220 221
	}
} );

//

222
Object.assign( Object3D.prototype, {
M
Mr.doob 已提交
223 224 225 226 227 228 229 230 231 232 233 234
	getChildByName: function ( name ) {
		console.warn( 'THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().' );
		return this.getObjectByName( name );
	},
	renderDepth: function ( value ) {
		console.warn( 'THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.' );
	},
	translate: function ( distance, axis ) {
		console.warn( 'THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.' );
		return this.translateOnAxis( axis, distance );
	}
} );
M
Mr.doob 已提交
235

236
Object.defineProperties( Object3D.prototype, {
M
Mr.doob 已提交
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
	eulerOrder: {
		get: function () {
			console.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' );
			return this.rotation.order;
		},
		set: function ( value ) {
			console.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' );
			this.rotation.order = value;
		}
	},
	useQuaternion: {
		get: function () {
			console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );
		},
		set: function ( value ) {
			console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );
		}
	}
} );

257
Object.defineProperties( LOD.prototype, {
M
Mr.doob 已提交
258 259 260 261 262 263 264 265
	objects: {
		get: function () {
			console.warn( 'THREE.LOD: .objects has been renamed to .levels.' );
			return this.levels;
		}
	}
} );

M
Mr.doob 已提交
266 267
//

268
PerspectiveCamera.prototype.setLens = function ( focalLength, filmGauge ) {
269 270 271 272 273 274 275 276 277 278 279

	console.warn( "THREE.PerspectiveCamera.setLens is deprecated. " +
			"Use .setFocalLength and .filmGauge for a photographic setup." );

	if ( filmGauge !== undefined ) this.filmGauge = filmGauge;
	this.setFocalLength( focalLength );

};

//

280
Object.defineProperties( Light.prototype, {
M
Mr.doob 已提交
281 282 283 284 285 286 287
	onlyShadow: {
		set: function ( value ) {
			console.warn( 'THREE.Light: .onlyShadow has been removed.' );
		}
	},
	shadowCameraFov: {
		set: function ( value ) {
288
			console.warn( 'THREE.Light: .shadowCameraFov is now .shadow.camera.fov.' );
M
Mr.doob 已提交
289 290 291 292 293
			this.shadow.camera.fov = value;
		}
	},
	shadowCameraLeft: {
		set: function ( value ) {
294
			console.warn( 'THREE.Light: .shadowCameraLeft is now .shadow.camera.left.' );
M
Mr.doob 已提交
295 296 297 298 299
			this.shadow.camera.left = value;
		}
	},
	shadowCameraRight: {
		set: function ( value ) {
300
			console.warn( 'THREE.Light: .shadowCameraRight is now .shadow.camera.right.' );
M
Mr.doob 已提交
301 302 303 304 305
			this.shadow.camera.right = value;
		}
	},
	shadowCameraTop: {
		set: function ( value ) {
306
			console.warn( 'THREE.Light: .shadowCameraTop is now .shadow.camera.top.' );
M
Mr.doob 已提交
307 308 309 310 311
			this.shadow.camera.top = value;
		}
	},
	shadowCameraBottom: {
		set: function ( value ) {
312
			console.warn( 'THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.' );
M
Mr.doob 已提交
313 314 315 316 317
			this.shadow.camera.bottom = value;
		}
	},
	shadowCameraNear: {
		set: function ( value ) {
318
			console.warn( 'THREE.Light: .shadowCameraNear is now .shadow.camera.near.' );
M
Mr.doob 已提交
319 320 321 322 323
			this.shadow.camera.near = value;
		}
	},
	shadowCameraFar: {
		set: function ( value ) {
324
			console.warn( 'THREE.Light: .shadowCameraFar is now .shadow.camera.far.' );
M
Mr.doob 已提交
325 326 327 328 329
			this.shadow.camera.far = value;
		}
	},
	shadowCameraVisible: {
		set: function ( value ) {
330
			console.warn( 'THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.' );
M
Mr.doob 已提交
331 332 333 334
		}
	},
	shadowBias: {
		set: function ( value ) {
335
			console.warn( 'THREE.Light: .shadowBias is now .shadow.bias.' );
M
Mr.doob 已提交
336 337 338 339 340
			this.shadow.bias = value;
		}
	},
	shadowDarkness: {
		set: function ( value ) {
M
Mr.doob 已提交
341
			console.warn( 'THREE.Light: .shadowDarkness has been removed.' );
M
Mr.doob 已提交
342 343 344 345
		}
	},
	shadowMapWidth: {
		set: function ( value ) {
346
			console.warn( 'THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.' );
M
Mr.doob 已提交
347 348 349 350 351
			this.shadow.mapSize.width = value;
		}
	},
	shadowMapHeight: {
		set: function ( value ) {
352
			console.warn( 'THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.' );
M
Mr.doob 已提交
353 354 355 356 357 358
			this.shadow.mapSize.height = value;
		}
	}
} );

//
M
Mr.doob 已提交
359

360
Object.defineProperties( BufferAttribute.prototype, {
M
Mr.doob 已提交
361 362 363 364 365 366 367 368
	length: {
		get: function () {
			console.warn( 'THREE.BufferAttribute: .length has been deprecated. Please use .count.' );
			return this.array.length;
		}
	}
} );

369
Object.assign( BufferGeometry.prototype, {
M
Mr.doob 已提交
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392
	addIndex: function ( index ) {
		console.warn( 'THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().' );
		this.setIndex( index );
	},
	addDrawCall: function ( start, count, indexOffset ) {
		if ( indexOffset !== undefined ) {
			console.warn( 'THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.' );
		}
		console.warn( 'THREE.BufferGeometry: .addDrawCall() is now .addGroup().' );
		this.addGroup( start, count );
	},
	clearDrawCalls: function () {
		console.warn( 'THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().' );
		this.clearGroups();
	},
	computeTangents: function () {
		console.warn( 'THREE.BufferGeometry: .computeTangents() has been removed.' );
	},
	computeOffsets: function () {
		console.warn( 'THREE.BufferGeometry: .computeOffsets() has been removed.' );
	}
} );

393
Object.defineProperties( BufferGeometry.prototype, {
394 395 396 397 398 399 400 401 402 403 404 405 406 407
	drawcalls: {
		get: function () {
			console.error( 'THREE.BufferGeometry: .drawcalls has been renamed to .groups.' );
			return this.groups;
		}
	},
	offsets: {
		get: function () {
			console.warn( 'THREE.BufferGeometry: .offsets has been renamed to .groups.' );
			return this.groups;
		}
	}
} );

M
Mr.doob 已提交
408 409
//

410
Object.defineProperties( Material.prototype, {
M
Mr.doob 已提交
411 412 413 414 415 416 417 418 419 420 421
	wrapAround: {
		get: function () {
			console.warn( 'THREE.' + this.type + ': .wrapAround has been removed.' );
		},
		set: function ( value ) {
			console.warn( 'THREE.' + this.type + ': .wrapAround has been removed.' );
		}
	},
	wrapRGB: {
		get: function () {
			console.warn( 'THREE.' + this.type + ': .wrapRGB has been removed.' );
422
			return new Color();
M
Mr.doob 已提交
423 424 425 426
		}
	}
} );

427
Object.defineProperties( MeshPhongMaterial.prototype, {
428 429
	metal: {
		get: function () {
430
			console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.' );
431 432 433
			return false;
		},
		set: function ( value ) {
434
			console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead' );
435 436 437 438
		}
	}
} );

439
Object.defineProperties( ShaderMaterial.prototype, {
M
Mr.doob 已提交
440
	derivatives: {
M
Mr.doob 已提交
441
		get: function () {
442
			console.warn( 'THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' );
M
Mr.doob 已提交
443
			return this.extensions.derivatives;
M
Mr.doob 已提交
444
		},
M
Mr.doob 已提交
445 446 447 448 449 450 451 452
		set: function ( value ) {
			console.warn( 'THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' );
			this.extensions.derivatives = value;
		}
	}
} );

//
M
Mr.doob 已提交
453

454
EventDispatcher.prototype = Object.assign( Object.create( {
T
tschw 已提交
455

M
Mr.doob 已提交
456
	// Note: Extra base ensures these properties are not 'assign'ed.
T
tschw 已提交
457

458
	constructor: EventDispatcher,
T
tschw 已提交
459

M
Mr.doob 已提交
460
	apply: function ( target ) {
T
tschw 已提交
461 462 463 464 465 466 467 468

		console.warn( "THREE.EventDispatcher: .apply is deprecated, " +
				"just inherit or Object.assign the prototype to mix-in." );

		Object.assign( target, this );

	}

469
} ), EventDispatcher.prototype );
T
tschw 已提交
470 471 472

//

473
Object.assign( WebGLRenderer.prototype, {
M
Mr.doob 已提交
474 475 476
	supportsFloatTextures: function () {
		console.warn( 'THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \'OES_texture_float\' ).' );
		return this.extensions.get( 'OES_texture_float' );
M
Mr.doob 已提交
477
	},
M
Mr.doob 已提交
478 479 480
	supportsHalfFloatTextures: function () {
		console.warn( 'THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \'OES_texture_half_float\' ).' );
		return this.extensions.get( 'OES_texture_half_float' );
M
Mr.doob 已提交
481
	},
M
Mr.doob 已提交
482 483 484
	supportsStandardDerivatives: function () {
		console.warn( 'THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \'OES_standard_derivatives\' ).' );
		return this.extensions.get( 'OES_standard_derivatives' );
M
Mr.doob 已提交
485
	},
M
Mr.doob 已提交
486 487 488
	supportsCompressedTextureS3TC: function () {
		console.warn( 'THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \'WEBGL_compressed_texture_s3tc\' ).' );
		return this.extensions.get( 'WEBGL_compressed_texture_s3tc' );
M
Mr.doob 已提交
489
	},
M
Mr.doob 已提交
490 491 492
	supportsCompressedTexturePVRTC: function () {
		console.warn( 'THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \'WEBGL_compressed_texture_pvrtc\' ).' );
		return this.extensions.get( 'WEBGL_compressed_texture_pvrtc' );
M
Mr.doob 已提交
493
	},
M
Mr.doob 已提交
494 495 496
	supportsBlendMinMax: function () {
		console.warn( 'THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \'EXT_blend_minmax\' ).' );
		return this.extensions.get( 'EXT_blend_minmax' );
M
Mr.doob 已提交
497
	},
M
Mr.doob 已提交
498 499
	supportsVertexTextures: function () {
		return this.capabilities.vertexTextures;
M
Mr.doob 已提交
500
	},
M
Mr.doob 已提交
501 502 503
	supportsInstancedArrays: function () {
		console.warn( 'THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \'ANGLE_instanced_arrays\' ).' );
		return this.extensions.get( 'ANGLE_instanced_arrays' );
504
	},
M
Mr.doob 已提交
505 506 507
	enableScissorTest: function ( boolean ) {
		console.warn( 'THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().' );
		this.setScissorTest( boolean );
M
Mr.doob 已提交
508
	},
M
Mr.doob 已提交
509 510
	initMaterial: function () {
		console.warn( 'THREE.WebGLRenderer: .initMaterial() has been removed.' );
M
Mr.doob 已提交
511
	},
M
Mr.doob 已提交
512 513
	addPrePlugin: function () {
		console.warn( 'THREE.WebGLRenderer: .addPrePlugin() has been removed.' );
M
Mr.doob 已提交
514
	},
M
Mr.doob 已提交
515 516
	addPostPlugin: function () {
		console.warn( 'THREE.WebGLRenderer: .addPostPlugin() has been removed.' );
M
Mr.doob 已提交
517
	},
M
Mr.doob 已提交
518 519 520 521 522
	updateShadowMap: function () {
		console.warn( 'THREE.WebGLRenderer: .updateShadowMap() has been removed.' );
	}
} );

523
Object.defineProperties( WebGLRenderer.prototype, {
M
Mr.doob 已提交
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552
	shadowMapEnabled: {
		get: function () {
			return this.shadowMap.enabled;
		},
		set: function ( value ) {
			console.warn( 'THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.' );
			this.shadowMap.enabled = value;
		}
	},
	shadowMapType: {
		get: function () {
			return this.shadowMap.type;
		},
		set: function ( value ) {
			console.warn( 'THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.' );
			this.shadowMap.type = value;
		}
	},
	shadowMapCullFace: {
		get: function () {
			return this.shadowMap.cullFace;
		},
		set: function ( value ) {
			console.warn( 'THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.' );
			this.shadowMap.cullFace = value;
		}
	}
} );

553
Object.defineProperties( WebGLShadowMap.prototype, {
M
Mr.doob 已提交
554 555
	cullFace: {
		get: function () {
556
			return this.renderReverseSided ? CullFaceFront : CullFaceBack;
M
Mr.doob 已提交
557 558
		},
		set: function ( cullFace ) {
559
			var value = ( cullFace !== CullFaceBack );
M
Mr.doob 已提交
560 561 562
			console.warn( "WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to " + value + "." );
			this.renderReverseSided = value;
		}
563 564 565
	}
} );

M
Mr.doob 已提交
566 567
//

568
Object.defineProperties( WebGLRenderTarget.prototype, {
M
Mr.doob 已提交
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672
	wrapS: {
		get: function () {
			console.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' );
			return this.texture.wrapS;
		},
		set: function ( value ) {
			console.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' );
			this.texture.wrapS = value;
		}
	},
	wrapT: {
		get: function () {
			console.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' );
			return this.texture.wrapT;
		},
		set: function ( value ) {
			console.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' );
			this.texture.wrapT = value;
		}
	},
	magFilter: {
		get: function () {
			console.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' );
			return this.texture.magFilter;
		},
		set: function ( value ) {
			console.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' );
			this.texture.magFilter = value;
		}
	},
	minFilter: {
		get: function () {
			console.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' );
			return this.texture.minFilter;
		},
		set: function ( value ) {
			console.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' );
			this.texture.minFilter = value;
		}
	},
	anisotropy: {
		get: function () {
			console.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' );
			return this.texture.anisotropy;
		},
		set: function ( value ) {
			console.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' );
			this.texture.anisotropy = value;
		}
	},
	offset: {
		get: function () {
			console.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' );
			return this.texture.offset;
		},
		set: function ( value ) {
			console.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' );
			this.texture.offset = value;
		}
	},
	repeat: {
		get: function () {
			console.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' );
			return this.texture.repeat;
		},
		set: function ( value ) {
			console.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' );
			this.texture.repeat = value;
		}
	},
	format: {
		get: function () {
			console.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' );
			return this.texture.format;
		},
		set: function ( value ) {
			console.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' );
			this.texture.format = value;
		}
	},
	type: {
		get: function () {
			console.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' );
			return this.texture.type;
		},
		set: function ( value ) {
			console.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' );
			this.texture.type = value;
		}
	},
	generateMipmaps: {
		get: function () {
			console.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' );
			return this.texture.generateMipmaps;
		},
		set: function ( value ) {
			console.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' );
			this.texture.generateMipmaps = value;
		}
	}
} );

//

673
Object.assign( Audio.prototype, {
M
Mr.doob 已提交
674 675 676
	load: function ( file ) {
		console.warn( 'THREE.Audio: .load has been deprecated. Please use THREE.AudioLoader.' );
		var scope = this;
677
		var audioLoader = new AudioLoader();
M
Mr.doob 已提交
678 679 680 681
		audioLoader.load( file, function ( buffer ) {
			scope.setBuffer( buffer );
		} );
		return this;
682 683 684
	}
} );

685
Object.assign( AudioAnalyser.prototype, {
M
Mr.doob 已提交
686 687 688
	getData: function ( file ) {
		console.warn( 'THREE.AudioAnalyser: .getData() is now .getFrequencyData().' );
		return this.getFrequencyData();
689 690 691
	}
} );

692 693
//

694
export const GeometryUtils = {
695 696 697 698 699 700 701

	merge: function ( geometry1, geometry2, materialIndexOffset ) {

		console.warn( 'THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.' );

		var matrix;

702
		if ( geometry2.isMesh ) {
703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723

			geometry2.matrixAutoUpdate && geometry2.updateMatrix();

			matrix = geometry2.matrix;
			geometry2 = geometry2.geometry;

		}

		geometry1.merge( geometry2, matrix, materialIndexOffset );

	},

	center: function ( geometry ) {

		console.warn( 'THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.' );
		return geometry.center();

	}

};

724
export const ImageUtils = {
725 726 727 728 729 730 731

	crossOrigin: undefined,

	loadTexture: function ( url, mapping, onLoad, onError ) {

		console.warn( 'THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.' );

732
		var loader = new TextureLoader();
733 734 735 736 737 738 739 740 741 742 743 744 745 746
		loader.setCrossOrigin( this.crossOrigin );

		var texture = loader.load( url, onLoad, undefined, onError );

		if ( mapping ) texture.mapping = mapping;

		return texture;

	},

	loadTextureCube: function ( urls, mapping, onLoad, onError ) {

		console.warn( 'THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.' );

747
		var loader = new CubeTextureLoader();
748 749 750 751 752 753 754 755 756 757 758 759
		loader.setCrossOrigin( this.crossOrigin );

		var texture = loader.load( urls, onLoad, undefined, onError );

		if ( mapping ) texture.mapping = mapping;

		return texture;

	},

	loadCompressedTexture: function () {

M
Mr.doob 已提交
760
		console.error( 'THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.' );
761 762 763 764 765

	},

	loadCompressedTextureCube: function () {

M
Mr.doob 已提交
766
		console.error( 'THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.' );
767 768 769 770 771 772 773

	}

};

//

774
export function Projector () {
M
Mr.doob 已提交
775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797

	console.error( 'THREE.Projector has been moved to /examples/js/renderers/Projector.js.' );

	this.projectVector = function ( vector, camera ) {

		console.warn( 'THREE.Projector: .projectVector() is now vector.project().' );
		vector.project( camera );

	};

	this.unprojectVector = function ( vector, camera ) {

		console.warn( 'THREE.Projector: .unprojectVector() is now vector.unproject().' );
		vector.unproject( camera );

	};

	this.pickingRay = function ( vector, camera ) {

		console.error( 'THREE.Projector: .pickingRay() is now raycaster.setFromCamera().' );

	};

798
}
M
Mr.doob 已提交
799

M
Mr.doob 已提交
800 801
//

802
export function CanvasRenderer () {
M
Mr.doob 已提交
803 804 805

	console.error( 'THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js' );

E
Eli Grey 已提交
806
	this.domElement = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' );
M
Mr.doob 已提交
807 808 809 810 811
	this.clear = function () {};
	this.render = function () {};
	this.setClearColor = function () {};
	this.setSize = function () {};

812
}