Three.Legacy.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. import { Audio } from './audio/Audio.js';
  5. import { AudioAnalyser } from './audio/AudioAnalyser.js';
  6. import { PerspectiveCamera } from './cameras/PerspectiveCamera.js';
  7. import { CullFaceFront, CullFaceBack } from './constants.js';
  8. import { BufferAttribute } from './core/BufferAttribute.js';
  9. import { BufferGeometry } from './core/BufferGeometry.js';
  10. import { EventDispatcher } from './core/EventDispatcher.js';
  11. import { Face3 } from './core/Face3.js';
  12. import { Object3D } from './core/Object3D.js';
  13. import { BoxGeometry } from './extras/geometries/BoxGeometry.js';
  14. import { Light } from './lights/Light.js';
  15. import { AudioLoader } from './loaders/AudioLoader.js';
  16. import { CubeTextureLoader } from './loaders/CubeTextureLoader.js';
  17. import { TextureLoader } from './loaders/TextureLoader.js';
  18. import { Material } from './materials/Material.js';
  19. import { MeshPhongMaterial } from './materials/MeshPhongMaterial.js';
  20. import { MultiMaterial } from './materials/MultiMaterial.js';
  21. import { PointsMaterial } from './materials/PointsMaterial.js';
  22. import { ShaderMaterial } from './materials/ShaderMaterial.js';
  23. import { Box2 } from './math/Box2.js';
  24. import { Box3 } from './math/Box3.js';
  25. import { Color } from './math/Color.js';
  26. import { Matrix3 } from './math/Matrix3.js';
  27. import { Matrix4 } from './math/Matrix4.js';
  28. import { Plane } from './math/Plane.js';
  29. import { Quaternion } from './math/Quaternion.js';
  30. import { Ray } from './math/Ray.js';
  31. import { Vector3 } from './math/Vector3.js';
  32. import { LOD } from './objects/LOD.js';
  33. import { Points } from './objects/Points.js';
  34. import { Sprite } from './objects/Sprite.js';
  35. import { WebGLRenderer } from './renderers/WebGLRenderer.js';
  36. import { WebGLRenderTarget } from './renderers/WebGLRenderTarget.js';
  37. import { WebGLShadowMap } from './renderers/webgl/WebGLShadowMap.js';
  38. export { BoxGeometry as CubeGeometry };
  39. export function Face4 ( a, b, c, d, normal, color, materialIndex ) {
  40. console.warn( 'THREE.Face4 has been removed. A THREE.Face3 will be created instead.' );
  41. return new Face3( a, b, c, normal, color, materialIndex );
  42. }
  43. export var LineStrip = 0;
  44. export var LinePieces = 1;
  45. export { MultiMaterial as MeshFaceMaterial };
  46. export function PointCloud ( geometry, material ) {
  47. console.warn( 'THREE.PointCloud has been renamed to THREE.Points.' );
  48. return new Points( geometry, material );
  49. }
  50. export { Sprite as Particle };
  51. export function ParticleSystem ( geometry, material ) {
  52. console.warn( 'THREE.ParticleSystem has been renamed to THREE.Points.' );
  53. return new Points( geometry, material );
  54. }
  55. export function PointCloudMaterial ( parameters ) {
  56. console.warn( 'THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.' );
  57. return new PointsMaterial( parameters );
  58. }
  59. export function ParticleBasicMaterial ( parameters ) {
  60. console.warn( 'THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.' );
  61. return new PointsMaterial( parameters );
  62. }
  63. export function ParticleSystemMaterial ( parameters ) {
  64. console.warn( 'THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.' );
  65. return new PointsMaterial( parameters );
  66. }
  67. export function Vertex ( x, y, z ) {
  68. console.warn( 'THREE.Vertex has been removed. Use THREE.Vector3 instead.' );
  69. return new Vector3( x, y, z );
  70. }
  71. //
  72. Object.assign( Box2.prototype, {
  73. empty: function () {
  74. console.warn( 'THREE.Box2: .empty() has been renamed to .isEmpty().' );
  75. return this.isEmpty();
  76. },
  77. isIntersectionBox: function ( box ) {
  78. console.warn( 'THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().' );
  79. return this.intersectsBox( box );
  80. }
  81. } );
  82. Object.assign( Box3.prototype, {
  83. empty: function () {
  84. console.warn( 'THREE.Box3: .empty() has been renamed to .isEmpty().' );
  85. return this.isEmpty();
  86. },
  87. isIntersectionBox: function ( box ) {
  88. console.warn( 'THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().' );
  89. return this.intersectsBox( box );
  90. },
  91. isIntersectionSphere: function ( sphere ) {
  92. console.warn( 'THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().' );
  93. return this.intersectsSphere( sphere );
  94. }
  95. } );
  96. Object.assign( Matrix3.prototype, {
  97. multiplyVector3: function ( vector ) {
  98. console.warn( 'THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.' );
  99. return vector.applyMatrix3( this );
  100. },
  101. multiplyVector3Array: function ( a ) {
  102. console.warn( 'THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' );
  103. return this.applyToVector3Array( a );
  104. }
  105. } );
  106. Object.assign( Matrix4.prototype, {
  107. extractPosition: function ( m ) {
  108. console.warn( 'THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().' );
  109. return this.copyPosition( m );
  110. },
  111. setRotationFromQuaternion: function ( q ) {
  112. console.warn( 'THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().' );
  113. return this.makeRotationFromQuaternion( q );
  114. },
  115. multiplyVector3: function ( vector ) {
  116. console.warn( 'THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.' );
  117. return vector.applyProjection( this );
  118. },
  119. multiplyVector4: function ( vector ) {
  120. console.warn( 'THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.' );
  121. return vector.applyMatrix4( this );
  122. },
  123. multiplyVector3Array: function ( a ) {
  124. console.warn( 'THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' );
  125. return this.applyToVector3Array( a );
  126. },
  127. rotateAxis: function ( v ) {
  128. console.warn( 'THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.' );
  129. v.transformDirection( this );
  130. },
  131. crossVector: function ( vector ) {
  132. console.warn( 'THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.' );
  133. return vector.applyMatrix4( this );
  134. },
  135. translate: function ( v ) {
  136. console.error( 'THREE.Matrix4: .translate() has been removed.' );
  137. },
  138. rotateX: function ( angle ) {
  139. console.error( 'THREE.Matrix4: .rotateX() has been removed.' );
  140. },
  141. rotateY: function ( angle ) {
  142. console.error( 'THREE.Matrix4: .rotateY() has been removed.' );
  143. },
  144. rotateZ: function ( angle ) {
  145. console.error( 'THREE.Matrix4: .rotateZ() has been removed.' );
  146. },
  147. rotateByAxis: function ( axis, angle ) {
  148. console.error( 'THREE.Matrix4: .rotateByAxis() has been removed.' );
  149. }
  150. } );
  151. Object.assign( Plane.prototype, {
  152. isIntersectionLine: function ( line ) {
  153. console.warn( 'THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().' );
  154. return this.intersectsLine( line );
  155. }
  156. } );
  157. Object.assign( Quaternion.prototype, {
  158. multiplyVector3: function ( vector ) {
  159. console.warn( 'THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.' );
  160. return vector.applyQuaternion( this );
  161. }
  162. } );
  163. Object.assign( Ray.prototype, {
  164. isIntersectionBox: function ( box ) {
  165. console.warn( 'THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().' );
  166. return this.intersectsBox( box );
  167. },
  168. isIntersectionPlane: function ( plane ) {
  169. console.warn( 'THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().' );
  170. return this.intersectsPlane( plane );
  171. },
  172. isIntersectionSphere: function ( sphere ) {
  173. console.warn( 'THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().' );
  174. return this.intersectsSphere( sphere );
  175. }
  176. } );
  177. Object.assign( Vector3.prototype, {
  178. setEulerFromRotationMatrix: function () {
  179. console.error( 'THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.' );
  180. },
  181. setEulerFromQuaternion: function () {
  182. console.error( 'THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.' );
  183. },
  184. getPositionFromMatrix: function ( m ) {
  185. console.warn( 'THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().' );
  186. return this.setFromMatrixPosition( m );
  187. },
  188. getScaleFromMatrix: function ( m ) {
  189. console.warn( 'THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().' );
  190. return this.setFromMatrixScale( m );
  191. },
  192. getColumnFromMatrix: function ( index, matrix ) {
  193. console.warn( 'THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().' );
  194. return this.setFromMatrixColumn( matrix, index );
  195. }
  196. } );
  197. //
  198. Object.assign( Object3D.prototype, {
  199. getChildByName: function ( name ) {
  200. console.warn( 'THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().' );
  201. return this.getObjectByName( name );
  202. },
  203. renderDepth: function ( value ) {
  204. console.warn( 'THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.' );
  205. },
  206. translate: function ( distance, axis ) {
  207. console.warn( 'THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.' );
  208. return this.translateOnAxis( axis, distance );
  209. }
  210. } );
  211. Object.defineProperties( Object3D.prototype, {
  212. eulerOrder: {
  213. get: function () {
  214. console.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' );
  215. return this.rotation.order;
  216. },
  217. set: function ( value ) {
  218. console.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' );
  219. this.rotation.order = value;
  220. }
  221. },
  222. useQuaternion: {
  223. get: function () {
  224. console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );
  225. },
  226. set: function ( value ) {
  227. console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );
  228. }
  229. }
  230. } );
  231. Object.defineProperties( LOD.prototype, {
  232. objects: {
  233. get: function () {
  234. console.warn( 'THREE.LOD: .objects has been renamed to .levels.' );
  235. return this.levels;
  236. }
  237. }
  238. } );
  239. //
  240. PerspectiveCamera.prototype.setLens = function ( focalLength, filmGauge ) {
  241. console.warn( "THREE.PerspectiveCamera.setLens is deprecated. " +
  242. "Use .setFocalLength and .filmGauge for a photographic setup." );
  243. if ( filmGauge !== undefined ) this.filmGauge = filmGauge;
  244. this.setFocalLength( focalLength );
  245. };
  246. //
  247. Object.defineProperties( Light.prototype, {
  248. onlyShadow: {
  249. set: function ( value ) {
  250. console.warn( 'THREE.Light: .onlyShadow has been removed.' );
  251. }
  252. },
  253. shadowCameraFov: {
  254. set: function ( value ) {
  255. console.warn( 'THREE.Light: .shadowCameraFov is now .shadow.camera.fov.' );
  256. this.shadow.camera.fov = value;
  257. }
  258. },
  259. shadowCameraLeft: {
  260. set: function ( value ) {
  261. console.warn( 'THREE.Light: .shadowCameraLeft is now .shadow.camera.left.' );
  262. this.shadow.camera.left = value;
  263. }
  264. },
  265. shadowCameraRight: {
  266. set: function ( value ) {
  267. console.warn( 'THREE.Light: .shadowCameraRight is now .shadow.camera.right.' );
  268. this.shadow.camera.right = value;
  269. }
  270. },
  271. shadowCameraTop: {
  272. set: function ( value ) {
  273. console.warn( 'THREE.Light: .shadowCameraTop is now .shadow.camera.top.' );
  274. this.shadow.camera.top = value;
  275. }
  276. },
  277. shadowCameraBottom: {
  278. set: function ( value ) {
  279. console.warn( 'THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.' );
  280. this.shadow.camera.bottom = value;
  281. }
  282. },
  283. shadowCameraNear: {
  284. set: function ( value ) {
  285. console.warn( 'THREE.Light: .shadowCameraNear is now .shadow.camera.near.' );
  286. this.shadow.camera.near = value;
  287. }
  288. },
  289. shadowCameraFar: {
  290. set: function ( value ) {
  291. console.warn( 'THREE.Light: .shadowCameraFar is now .shadow.camera.far.' );
  292. this.shadow.camera.far = value;
  293. }
  294. },
  295. shadowCameraVisible: {
  296. set: function ( value ) {
  297. console.warn( 'THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.' );
  298. }
  299. },
  300. shadowBias: {
  301. set: function ( value ) {
  302. console.warn( 'THREE.Light: .shadowBias is now .shadow.bias.' );
  303. this.shadow.bias = value;
  304. }
  305. },
  306. shadowDarkness: {
  307. set: function ( value ) {
  308. console.warn( 'THREE.Light: .shadowDarkness has been removed.' );
  309. }
  310. },
  311. shadowMapWidth: {
  312. set: function ( value ) {
  313. console.warn( 'THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.' );
  314. this.shadow.mapSize.width = value;
  315. }
  316. },
  317. shadowMapHeight: {
  318. set: function ( value ) {
  319. console.warn( 'THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.' );
  320. this.shadow.mapSize.height = value;
  321. }
  322. }
  323. } );
  324. //
  325. Object.defineProperties( BufferAttribute.prototype, {
  326. length: {
  327. get: function () {
  328. console.warn( 'THREE.BufferAttribute: .length has been deprecated. Please use .count.' );
  329. return this.array.length;
  330. }
  331. }
  332. } );
  333. Object.assign( BufferGeometry.prototype, {
  334. addIndex: function ( index ) {
  335. console.warn( 'THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().' );
  336. this.setIndex( index );
  337. },
  338. addDrawCall: function ( start, count, indexOffset ) {
  339. if ( indexOffset !== undefined ) {
  340. console.warn( 'THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.' );
  341. }
  342. console.warn( 'THREE.BufferGeometry: .addDrawCall() is now .addGroup().' );
  343. this.addGroup( start, count );
  344. },
  345. clearDrawCalls: function () {
  346. console.warn( 'THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().' );
  347. this.clearGroups();
  348. },
  349. computeTangents: function () {
  350. console.warn( 'THREE.BufferGeometry: .computeTangents() has been removed.' );
  351. },
  352. computeOffsets: function () {
  353. console.warn( 'THREE.BufferGeometry: .computeOffsets() has been removed.' );
  354. }
  355. } );
  356. Object.defineProperties( BufferGeometry.prototype, {
  357. drawcalls: {
  358. get: function () {
  359. console.error( 'THREE.BufferGeometry: .drawcalls has been renamed to .groups.' );
  360. return this.groups;
  361. }
  362. },
  363. offsets: {
  364. get: function () {
  365. console.warn( 'THREE.BufferGeometry: .offsets has been renamed to .groups.' );
  366. return this.groups;
  367. }
  368. }
  369. } );
  370. //
  371. Object.defineProperties( Material.prototype, {
  372. wrapAround: {
  373. get: function () {
  374. console.warn( 'THREE.' + this.type + ': .wrapAround has been removed.' );
  375. },
  376. set: function ( value ) {
  377. console.warn( 'THREE.' + this.type + ': .wrapAround has been removed.' );
  378. }
  379. },
  380. wrapRGB: {
  381. get: function () {
  382. console.warn( 'THREE.' + this.type + ': .wrapRGB has been removed.' );
  383. return new Color();
  384. }
  385. }
  386. } );
  387. Object.defineProperties( MeshPhongMaterial.prototype, {
  388. metal: {
  389. get: function () {
  390. console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.' );
  391. return false;
  392. },
  393. set: function ( value ) {
  394. console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead' );
  395. }
  396. }
  397. } );
  398. Object.defineProperties( ShaderMaterial.prototype, {
  399. derivatives: {
  400. get: function () {
  401. console.warn( 'THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' );
  402. return this.extensions.derivatives;
  403. },
  404. set: function ( value ) {
  405. console.warn( 'THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' );
  406. this.extensions.derivatives = value;
  407. }
  408. }
  409. } );
  410. //
  411. EventDispatcher.prototype = Object.assign( Object.create( {
  412. // Note: Extra base ensures these properties are not 'assign'ed.
  413. constructor: EventDispatcher,
  414. apply: function ( target ) {
  415. console.warn( "THREE.EventDispatcher: .apply is deprecated, " +
  416. "just inherit or Object.assign the prototype to mix-in." );
  417. Object.assign( target, this );
  418. }
  419. } ), EventDispatcher.prototype );
  420. //
  421. Object.assign( WebGLRenderer.prototype, {
  422. supportsFloatTextures: function () {
  423. console.warn( 'THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \'OES_texture_float\' ).' );
  424. return this.extensions.get( 'OES_texture_float' );
  425. },
  426. supportsHalfFloatTextures: function () {
  427. console.warn( 'THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \'OES_texture_half_float\' ).' );
  428. return this.extensions.get( 'OES_texture_half_float' );
  429. },
  430. supportsStandardDerivatives: function () {
  431. console.warn( 'THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \'OES_standard_derivatives\' ).' );
  432. return this.extensions.get( 'OES_standard_derivatives' );
  433. },
  434. supportsCompressedTextureS3TC: function () {
  435. console.warn( 'THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \'WEBGL_compressed_texture_s3tc\' ).' );
  436. return this.extensions.get( 'WEBGL_compressed_texture_s3tc' );
  437. },
  438. supportsCompressedTexturePVRTC: function () {
  439. console.warn( 'THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \'WEBGL_compressed_texture_pvrtc\' ).' );
  440. return this.extensions.get( 'WEBGL_compressed_texture_pvrtc' );
  441. },
  442. supportsBlendMinMax: function () {
  443. console.warn( 'THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \'EXT_blend_minmax\' ).' );
  444. return this.extensions.get( 'EXT_blend_minmax' );
  445. },
  446. supportsVertexTextures: function () {
  447. return this.capabilities.vertexTextures;
  448. },
  449. supportsInstancedArrays: function () {
  450. console.warn( 'THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \'ANGLE_instanced_arrays\' ).' );
  451. return this.extensions.get( 'ANGLE_instanced_arrays' );
  452. },
  453. enableScissorTest: function ( boolean ) {
  454. console.warn( 'THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().' );
  455. this.setScissorTest( boolean );
  456. },
  457. initMaterial: function () {
  458. console.warn( 'THREE.WebGLRenderer: .initMaterial() has been removed.' );
  459. },
  460. addPrePlugin: function () {
  461. console.warn( 'THREE.WebGLRenderer: .addPrePlugin() has been removed.' );
  462. },
  463. addPostPlugin: function () {
  464. console.warn( 'THREE.WebGLRenderer: .addPostPlugin() has been removed.' );
  465. },
  466. updateShadowMap: function () {
  467. console.warn( 'THREE.WebGLRenderer: .updateShadowMap() has been removed.' );
  468. }
  469. } );
  470. Object.defineProperties( WebGLRenderer.prototype, {
  471. shadowMapEnabled: {
  472. get: function () {
  473. return this.shadowMap.enabled;
  474. },
  475. set: function ( value ) {
  476. console.warn( 'THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.' );
  477. this.shadowMap.enabled = value;
  478. }
  479. },
  480. shadowMapType: {
  481. get: function () {
  482. return this.shadowMap.type;
  483. },
  484. set: function ( value ) {
  485. console.warn( 'THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.' );
  486. this.shadowMap.type = value;
  487. }
  488. },
  489. shadowMapCullFace: {
  490. get: function () {
  491. return this.shadowMap.cullFace;
  492. },
  493. set: function ( value ) {
  494. console.warn( 'THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.' );
  495. this.shadowMap.cullFace = value;
  496. }
  497. }
  498. } );
  499. Object.defineProperties( WebGLShadowMap.prototype, {
  500. cullFace: {
  501. get: function () {
  502. return this.renderReverseSided ? CullFaceFront : CullFaceBack;
  503. },
  504. set: function ( cullFace ) {
  505. var value = ( cullFace !== CullFaceBack );
  506. console.warn( "WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to " + value + "." );
  507. this.renderReverseSided = value;
  508. }
  509. }
  510. } );
  511. //
  512. Object.defineProperties( WebGLRenderTarget.prototype, {
  513. wrapS: {
  514. get: function () {
  515. console.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' );
  516. return this.texture.wrapS;
  517. },
  518. set: function ( value ) {
  519. console.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' );
  520. this.texture.wrapS = value;
  521. }
  522. },
  523. wrapT: {
  524. get: function () {
  525. console.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' );
  526. return this.texture.wrapT;
  527. },
  528. set: function ( value ) {
  529. console.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' );
  530. this.texture.wrapT = value;
  531. }
  532. },
  533. magFilter: {
  534. get: function () {
  535. console.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' );
  536. return this.texture.magFilter;
  537. },
  538. set: function ( value ) {
  539. console.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' );
  540. this.texture.magFilter = value;
  541. }
  542. },
  543. minFilter: {
  544. get: function () {
  545. console.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' );
  546. return this.texture.minFilter;
  547. },
  548. set: function ( value ) {
  549. console.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' );
  550. this.texture.minFilter = value;
  551. }
  552. },
  553. anisotropy: {
  554. get: function () {
  555. console.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' );
  556. return this.texture.anisotropy;
  557. },
  558. set: function ( value ) {
  559. console.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' );
  560. this.texture.anisotropy = value;
  561. }
  562. },
  563. offset: {
  564. get: function () {
  565. console.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' );
  566. return this.texture.offset;
  567. },
  568. set: function ( value ) {
  569. console.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' );
  570. this.texture.offset = value;
  571. }
  572. },
  573. repeat: {
  574. get: function () {
  575. console.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' );
  576. return this.texture.repeat;
  577. },
  578. set: function ( value ) {
  579. console.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' );
  580. this.texture.repeat = value;
  581. }
  582. },
  583. format: {
  584. get: function () {
  585. console.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' );
  586. return this.texture.format;
  587. },
  588. set: function ( value ) {
  589. console.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' );
  590. this.texture.format = value;
  591. }
  592. },
  593. type: {
  594. get: function () {
  595. console.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' );
  596. return this.texture.type;
  597. },
  598. set: function ( value ) {
  599. console.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' );
  600. this.texture.type = value;
  601. }
  602. },
  603. generateMipmaps: {
  604. get: function () {
  605. console.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' );
  606. return this.texture.generateMipmaps;
  607. },
  608. set: function ( value ) {
  609. console.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' );
  610. this.texture.generateMipmaps = value;
  611. }
  612. }
  613. } );
  614. //
  615. Object.assign( Audio.prototype, {
  616. load: function ( file ) {
  617. console.warn( 'THREE.Audio: .load has been deprecated. Please use THREE.AudioLoader.' );
  618. var scope = this;
  619. var audioLoader = new AudioLoader();
  620. audioLoader.load( file, function ( buffer ) {
  621. scope.setBuffer( buffer );
  622. } );
  623. return this;
  624. }
  625. } );
  626. Object.assign( AudioAnalyser.prototype, {
  627. getData: function ( file ) {
  628. console.warn( 'THREE.AudioAnalyser: .getData() is now .getFrequencyData().' );
  629. return this.getFrequencyData();
  630. }
  631. } );
  632. //
  633. export var GeometryUtils = {
  634. merge: function ( geometry1, geometry2, materialIndexOffset ) {
  635. console.warn( 'THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.' );
  636. var matrix;
  637. if ( geometry2.isMesh ) {
  638. geometry2.matrixAutoUpdate && geometry2.updateMatrix();
  639. matrix = geometry2.matrix;
  640. geometry2 = geometry2.geometry;
  641. }
  642. geometry1.merge( geometry2, matrix, materialIndexOffset );
  643. },
  644. center: function ( geometry ) {
  645. console.warn( 'THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.' );
  646. return geometry.center();
  647. }
  648. };
  649. export var ImageUtils = {
  650. crossOrigin: undefined,
  651. loadTexture: function ( url, mapping, onLoad, onError ) {
  652. console.warn( 'THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.' );
  653. var loader = new TextureLoader();
  654. loader.setCrossOrigin( this.crossOrigin );
  655. var texture = loader.load( url, onLoad, undefined, onError );
  656. if ( mapping ) texture.mapping = mapping;
  657. return texture;
  658. },
  659. loadTextureCube: function ( urls, mapping, onLoad, onError ) {
  660. console.warn( 'THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.' );
  661. var loader = new CubeTextureLoader();
  662. loader.setCrossOrigin( this.crossOrigin );
  663. var texture = loader.load( urls, onLoad, undefined, onError );
  664. if ( mapping ) texture.mapping = mapping;
  665. return texture;
  666. },
  667. loadCompressedTexture: function () {
  668. console.error( 'THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.' );
  669. },
  670. loadCompressedTextureCube: function () {
  671. console.error( 'THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.' );
  672. }
  673. };
  674. //
  675. export function Projector () {
  676. console.error( 'THREE.Projector has been moved to /examples/js/renderers/Projector.js.' );
  677. this.projectVector = function ( vector, camera ) {
  678. console.warn( 'THREE.Projector: .projectVector() is now vector.project().' );
  679. vector.project( camera );
  680. };
  681. this.unprojectVector = function ( vector, camera ) {
  682. console.warn( 'THREE.Projector: .unprojectVector() is now vector.unproject().' );
  683. vector.unproject( camera );
  684. };
  685. this.pickingRay = function ( vector, camera ) {
  686. console.error( 'THREE.Projector: .pickingRay() is now raycaster.setFromCamera().' );
  687. };
  688. }
  689. //
  690. export function CanvasRenderer () {
  691. console.error( 'THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js' );
  692. this.domElement = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' );
  693. this.clear = function () {};
  694. this.render = function () {};
  695. this.setClearColor = function () {};
  696. this.setSize = function () {};
  697. }
粤ICP备19079148号