Three.Legacy.js 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438
  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 {
  9. Float64BufferAttribute,
  10. Float32BufferAttribute,
  11. Uint32BufferAttribute,
  12. Int32BufferAttribute,
  13. Uint16BufferAttribute,
  14. Int16BufferAttribute,
  15. Uint8ClampedBufferAttribute,
  16. Uint8BufferAttribute,
  17. Int8BufferAttribute,
  18. BufferAttribute
  19. } from './core/BufferAttribute.js';
  20. import { BufferGeometry } from './core/BufferGeometry.js';
  21. import { Face3 } from './core/Face3.js';
  22. import { Geometry } from './core/Geometry';
  23. import { Object3D } from './core/Object3D.js';
  24. import { Uniform } from './core/Uniform';
  25. import { CatmullRomCurve3 } from './extras/curves/CatmullRomCurve3.js';
  26. import { BoxHelper } from './extras/helpers/BoxHelper';
  27. import { GridHelper } from './extras/helpers/GridHelper.js';
  28. import { BoxGeometry } from './geometries/BoxGeometry.js';
  29. import { EdgesGeometry } from './geometries/EdgesGeometry.js';
  30. import { ExtrudeGeometry } from './geometries/ExtrudeGeometry.js';
  31. import { ShapeGeometry } from './geometries/ShapeGeometry.js';
  32. import { WireframeGeometry } from './geometries/WireframeGeometry.js';
  33. import { Light } from './lights/Light.js';
  34. import { FileLoader } from './loaders/FileLoader.js';
  35. import { AudioLoader } from './loaders/AudioLoader.js';
  36. import { CubeTextureLoader } from './loaders/CubeTextureLoader.js';
  37. import { DataTextureLoader } from './loaders/DataTextureLoader.js';
  38. import { TextureLoader } from './loaders/TextureLoader.js';
  39. import { Material } from './materials/Material.js';
  40. import { LineBasicMaterial } from './materials/LineBasicMaterial.js';
  41. import { MeshPhongMaterial } from './materials/MeshPhongMaterial.js';
  42. import { MultiMaterial } from './materials/MultiMaterial.js';
  43. import { PointsMaterial } from './materials/PointsMaterial.js';
  44. import { ShaderMaterial } from './materials/ShaderMaterial.js';
  45. import { Box2 } from './math/Box2.js';
  46. import { Box3 } from './math/Box3.js';
  47. import { Color } from './math/Color.js';
  48. import { Line3 } from './math/Line3.js';
  49. import { _Math } from './math/Math.js';
  50. import { Matrix3 } from './math/Matrix3.js';
  51. import { Matrix4 } from './math/Matrix4.js';
  52. import { Plane } from './math/Plane.js';
  53. import { Quaternion } from './math/Quaternion.js';
  54. import { Ray } from './math/Ray.js';
  55. import { Vector2 } from './math/Vector2.js';
  56. import { Vector3 } from './math/Vector3.js';
  57. import { Vector4 } from './math/Vector4.js';
  58. import { LineSegments } from './objects/LineSegments.js';
  59. import { LOD } from './objects/LOD.js';
  60. import { Points } from './objects/Points.js';
  61. import { Sprite } from './objects/Sprite.js';
  62. import { WebGLRenderer } from './renderers/WebGLRenderer.js';
  63. import { WebGLRenderTarget } from './renderers/WebGLRenderTarget.js';
  64. import { WebGLShadowMap } from './renderers/webgl/WebGLShadowMap.js';
  65. import { Shape } from './extras/core/Shape.js';
  66. export { BoxGeometry as CubeGeometry };
  67. export function Face4( a, b, c, d, normal, color, materialIndex ) {
  68. console.warn( 'THREE.Face4 has been removed. A THREE.Face3 will be created instead.' );
  69. return new Face3( a, b, c, normal, color, materialIndex );
  70. }
  71. export var LineStrip = 0;
  72. export var LinePieces = 1;
  73. export function MeshFaceMaterial( materials ) {
  74. console.warn( 'THREE.MeshFaceMaterial has been renamed to THREE.MultiMaterial.' );
  75. return new MultiMaterial( materials );
  76. }
  77. export function PointCloud( geometry, material ) {
  78. console.warn( 'THREE.PointCloud has been renamed to THREE.Points.' );
  79. return new Points( geometry, material );
  80. }
  81. export function Particle( material ) {
  82. console.warn( 'THREE.Particle has been renamed to THREE.Sprite.' );
  83. return new Sprite( material );
  84. }
  85. export function ParticleSystem( geometry, material ) {
  86. console.warn( 'THREE.ParticleSystem has been renamed to THREE.Points.' );
  87. return new Points( geometry, material );
  88. }
  89. export function PointCloudMaterial( parameters ) {
  90. console.warn( 'THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.' );
  91. return new PointsMaterial( parameters );
  92. }
  93. export function ParticleBasicMaterial( parameters ) {
  94. console.warn( 'THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.' );
  95. return new PointsMaterial( parameters );
  96. }
  97. export function ParticleSystemMaterial( parameters ) {
  98. console.warn( 'THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.' );
  99. return new PointsMaterial( parameters );
  100. }
  101. export function Vertex( x, y, z ) {
  102. console.warn( 'THREE.Vertex has been removed. Use THREE.Vector3 instead.' );
  103. return new Vector3( x, y, z );
  104. }
  105. //
  106. export function DynamicBufferAttribute( array, itemSize ) {
  107. console.warn( 'THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead.' );
  108. return new BufferAttribute( array, itemSize ).setDynamic( true );
  109. }
  110. export function Int8Attribute( array, itemSize ) {
  111. console.warn( 'THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead.' );
  112. return new Int8BufferAttribute( array, itemSize );
  113. }
  114. export function Uint8Attribute( array, itemSize ) {
  115. console.warn( 'THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead.' );
  116. return new Uint8BufferAttribute( array, itemSize );
  117. }
  118. export function Uint8ClampedAttribute( array, itemSize ) {
  119. console.warn( 'THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead.' );
  120. return new Uint8ClampedBufferAttribute( array, itemSize );
  121. }
  122. export function Int16Attribute( array, itemSize ) {
  123. console.warn( 'THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead.' );
  124. return new Int16BufferAttribute( array, itemSize );
  125. }
  126. export function Uint16Attribute( array, itemSize ) {
  127. console.warn( 'THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead.' );
  128. return new Uint16BufferAttribute( array, itemSize );
  129. }
  130. export function Int32Attribute( array, itemSize ) {
  131. console.warn( 'THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead.' );
  132. return new Int32BufferAttribute( array, itemSize );
  133. }
  134. export function Uint32Attribute( array, itemSize ) {
  135. console.warn( 'THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead.' );
  136. return new Uint32BufferAttribute( array, itemSize );
  137. }
  138. export function Float32Attribute( array, itemSize ) {
  139. console.warn( 'THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead.' );
  140. return new Float32BufferAttribute( array, itemSize );
  141. }
  142. export function Float64Attribute( array, itemSize ) {
  143. console.warn( 'THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead.' );
  144. return new Float64BufferAttribute( array, itemSize );
  145. }
  146. //
  147. export function ClosedSplineCurve3( points ) {
  148. console.warn( 'THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.' );
  149. CatmullRomCurve3.call( this, points );
  150. this.type = 'catmullrom';
  151. this.closed = true;
  152. }
  153. ClosedSplineCurve3.prototype = Object.create( CatmullRomCurve3.prototype );
  154. //
  155. export function SplineCurve3( points ) {
  156. console.warn( 'THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.' );
  157. CatmullRomCurve3.call( this, points );
  158. this.type = 'catmullrom';
  159. }
  160. SplineCurve3.prototype = Object.create( CatmullRomCurve3.prototype );
  161. //
  162. export function Spline( points ) {
  163. console.warn( 'THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.' );
  164. CatmullRomCurve3.call( this, points );
  165. this.type = 'catmullrom';
  166. }
  167. Spline.prototype = Object.create( CatmullRomCurve3.prototype );
  168. Object.assign( Spline.prototype, {
  169. initFromArray: function ( a ) {
  170. console.error( 'THREE.Spline: .initFromArray() has been removed.' );
  171. },
  172. getControlPointsArray: function ( optionalTarget ) {
  173. console.error( 'THREE.Spline: .getControlPointsArray() has been removed.' );
  174. },
  175. reparametrizeByArcLength: function ( samplingCoef ) {
  176. console.error( 'THREE.Spline: .reparametrizeByArcLength() has been removed.' );
  177. }
  178. } );
  179. //
  180. export function BoundingBoxHelper( object, color ) {
  181. console.warn( 'THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead.' );
  182. return new BoxHelper( object, color );
  183. }
  184. export function EdgesHelper( object, hex ) {
  185. console.warn( 'THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead.' );
  186. return new LineSegments( new EdgesGeometry( object.geometry ), new LineBasicMaterial( { color: hex !== undefined ? hex : 0xffffff } ) );
  187. }
  188. GridHelper.prototype.setColors = function () {
  189. console.error( 'THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.' );
  190. };
  191. export function WireframeHelper( object, hex ) {
  192. console.warn( 'THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead.' );
  193. return new LineSegments( new WireframeGeometry( object.geometry ), new LineBasicMaterial( { color: hex !== undefined ? hex : 0xffffff } ) );
  194. }
  195. //
  196. export function XHRLoader( manager ) {
  197. console.warn( 'THREE.XHRLoader has been renamed to THREE.FileLoader.' );
  198. return new FileLoader( manager );
  199. }
  200. export function BinaryTextureLoader( manager ) {
  201. console.warn( 'THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader.' );
  202. return new DataTextureLoader( manager );
  203. }
  204. //
  205. Object.assign( Box2.prototype, {
  206. center: function ( optionalTarget ) {
  207. console.warn( 'THREE.Box2: .center() has been renamed to .getCenter().' );
  208. return this.getCenter( optionalTarget );
  209. },
  210. empty: function () {
  211. console.warn( 'THREE.Box2: .empty() has been renamed to .isEmpty().' );
  212. return this.isEmpty();
  213. },
  214. isIntersectionBox: function ( box ) {
  215. console.warn( 'THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().' );
  216. return this.intersectsBox( box );
  217. },
  218. size: function ( optionalTarget ) {
  219. console.warn( 'THREE.Box2: .size() has been renamed to .getSize().' );
  220. return this.getSize( optionalTarget );
  221. }
  222. } );
  223. Object.assign( Box3.prototype, {
  224. center: function ( optionalTarget ) {
  225. console.warn( 'THREE.Box3: .center() has been renamed to .getCenter().' );
  226. return this.getCenter( optionalTarget );
  227. },
  228. empty: function () {
  229. console.warn( 'THREE.Box3: .empty() has been renamed to .isEmpty().' );
  230. return this.isEmpty();
  231. },
  232. isIntersectionBox: function ( box ) {
  233. console.warn( 'THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().' );
  234. return this.intersectsBox( box );
  235. },
  236. isIntersectionSphere: function ( sphere ) {
  237. console.warn( 'THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().' );
  238. return this.intersectsSphere( sphere );
  239. },
  240. size: function ( optionalTarget ) {
  241. console.warn( 'THREE.Box3: .size() has been renamed to .getSize().' );
  242. return this.getSize( optionalTarget );
  243. }
  244. } );
  245. Line3.prototype.center = function ( optionalTarget ) {
  246. console.warn( 'THREE.Line3: .center() has been renamed to .getCenter().' );
  247. return this.getCenter( optionalTarget );
  248. };
  249. _Math.random16 = function () {
  250. console.warn( 'THREE.Math.random16() has been deprecated. Use Math.random() instead.' );
  251. return Math.random();
  252. };
  253. Object.assign( Matrix3.prototype, {
  254. flattenToArrayOffset: function ( array, offset ) {
  255. console.warn( "THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead." );
  256. return this.toArray( array, offset );
  257. },
  258. multiplyVector3: function ( vector ) {
  259. console.warn( 'THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.' );
  260. return vector.applyMatrix3( this );
  261. },
  262. multiplyVector3Array: function ( a ) {
  263. console.warn( 'THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' );
  264. return this.applyToVector3Array( a );
  265. },
  266. applyToBuffer: function( buffer, offset, length ) {
  267. console.warn( 'THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.' );
  268. return this.applyToBufferAttribute( buffer );
  269. },
  270. applyToVector3Array: function( array, offset, length ) {
  271. console.error( 'THREE.Matrix3: .applyToVector3Array() has been removed.' );
  272. }
  273. } );
  274. Object.assign( Matrix4.prototype, {
  275. extractPosition: function ( m ) {
  276. console.warn( 'THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().' );
  277. return this.copyPosition( m );
  278. },
  279. flattenToArrayOffset: function ( array, offset ) {
  280. console.warn( "THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead." );
  281. return this.toArray( array, offset );
  282. },
  283. getPosition: function () {
  284. var v1;
  285. return function getPosition() {
  286. if ( v1 === undefined ) v1 = new Vector3();
  287. console.warn( 'THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.' );
  288. return v1.setFromMatrixColumn( this, 3 );
  289. };
  290. }(),
  291. setRotationFromQuaternion: function ( q ) {
  292. console.warn( 'THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().' );
  293. return this.makeRotationFromQuaternion( q );
  294. },
  295. multiplyVector3: function ( vector ) {
  296. console.warn( 'THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.' );
  297. return vector.applyMatrix4( this );
  298. },
  299. multiplyVector4: function ( vector ) {
  300. console.warn( 'THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.' );
  301. return vector.applyMatrix4( this );
  302. },
  303. multiplyVector3Array: function ( a ) {
  304. console.warn( 'THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' );
  305. return this.applyToVector3Array( a );
  306. },
  307. rotateAxis: function ( v ) {
  308. console.warn( 'THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.' );
  309. v.transformDirection( this );
  310. },
  311. crossVector: function ( vector ) {
  312. console.warn( 'THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.' );
  313. return vector.applyMatrix4( this );
  314. },
  315. translate: function () {
  316. console.error( 'THREE.Matrix4: .translate() has been removed.' );
  317. },
  318. rotateX: function () {
  319. console.error( 'THREE.Matrix4: .rotateX() has been removed.' );
  320. },
  321. rotateY: function () {
  322. console.error( 'THREE.Matrix4: .rotateY() has been removed.' );
  323. },
  324. rotateZ: function () {
  325. console.error( 'THREE.Matrix4: .rotateZ() has been removed.' );
  326. },
  327. rotateByAxis: function () {
  328. console.error( 'THREE.Matrix4: .rotateByAxis() has been removed.' );
  329. },
  330. applyToBuffer: function( buffer, offset, length ) {
  331. console.warn( 'THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.' );
  332. return this.applyToBufferAttribute( buffer );
  333. },
  334. applyToVector3Array: function( array, offset, length ) {
  335. console.error( 'THREE.Matrix4: .applyToVector3Array() has been removed.' );
  336. },
  337. makeFrustum: function( left, right, bottom, top, near, far ) {
  338. console.warn( 'THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.' );
  339. return this.makePerspective( left, right, top, bottom, near, far );
  340. }
  341. } );
  342. Plane.prototype.isIntersectionLine = function ( line ) {
  343. console.warn( 'THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().' );
  344. return this.intersectsLine( line );
  345. };
  346. Quaternion.prototype.multiplyVector3 = function ( vector ) {
  347. console.warn( 'THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.' );
  348. return vector.applyQuaternion( this );
  349. };
  350. Object.assign( Ray.prototype, {
  351. isIntersectionBox: function ( box ) {
  352. console.warn( 'THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().' );
  353. return this.intersectsBox( box );
  354. },
  355. isIntersectionPlane: function ( plane ) {
  356. console.warn( 'THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().' );
  357. return this.intersectsPlane( plane );
  358. },
  359. isIntersectionSphere: function ( sphere ) {
  360. console.warn( 'THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().' );
  361. return this.intersectsSphere( sphere );
  362. }
  363. } );
  364. Object.assign( Shape.prototype, {
  365. extrude: function ( options ) {
  366. console.warn( 'THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.' );
  367. return new ExtrudeGeometry( this, options );
  368. },
  369. makeGeometry: function ( options ) {
  370. console.warn( 'THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.' );
  371. return new ShapeGeometry( this, options );
  372. }
  373. } );
  374. Object.assign( Vector2.prototype, {
  375. fromAttribute: function ( attribute, index, offset ) {
  376. console.error( 'THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().' );
  377. return this.fromBufferAttribute( attribute, index, offset );
  378. }
  379. } );
  380. Object.assign( Vector3.prototype, {
  381. setEulerFromRotationMatrix: function () {
  382. console.error( 'THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.' );
  383. },
  384. setEulerFromQuaternion: function () {
  385. console.error( 'THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.' );
  386. },
  387. getPositionFromMatrix: function ( m ) {
  388. console.warn( 'THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().' );
  389. return this.setFromMatrixPosition( m );
  390. },
  391. getScaleFromMatrix: function ( m ) {
  392. console.warn( 'THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().' );
  393. return this.setFromMatrixScale( m );
  394. },
  395. getColumnFromMatrix: function ( index, matrix ) {
  396. console.warn( 'THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().' );
  397. return this.setFromMatrixColumn( matrix, index );
  398. },
  399. applyProjection: function ( m ) {
  400. console.warn( 'THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.' );
  401. return this.applyMatrix4( m );
  402. },
  403. fromAttribute: function ( attribute, index, offset ) {
  404. console.error( 'THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().' );
  405. return this.fromBufferAttribute( attribute, index, offset );
  406. }
  407. } );
  408. Object.assign( Vector4.prototype, {
  409. fromAttribute: function ( attribute, index, offset ) {
  410. console.error( 'THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().' );
  411. return this.fromBufferAttribute( attribute, index, offset );
  412. }
  413. } );
  414. //
  415. Geometry.prototype.computeTangents = function () {
  416. console.warn( 'THREE.Geometry: .computeTangents() has been removed.' );
  417. };
  418. Object.assign( Object3D.prototype, {
  419. getChildByName: function ( name ) {
  420. console.warn( 'THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().' );
  421. return this.getObjectByName( name );
  422. },
  423. renderDepth: function () {
  424. console.warn( 'THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.' );
  425. },
  426. translate: function ( distance, axis ) {
  427. console.warn( 'THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.' );
  428. return this.translateOnAxis( axis, distance );
  429. }
  430. } );
  431. Object.defineProperties( Object3D.prototype, {
  432. eulerOrder: {
  433. get: function () {
  434. console.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' );
  435. return this.rotation.order;
  436. },
  437. set: function ( value ) {
  438. console.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' );
  439. this.rotation.order = value;
  440. }
  441. },
  442. useQuaternion: {
  443. get: function () {
  444. console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );
  445. },
  446. set: function () {
  447. console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );
  448. }
  449. }
  450. } );
  451. Object.defineProperties( LOD.prototype, {
  452. objects: {
  453. get: function () {
  454. console.warn( 'THREE.LOD: .objects has been renamed to .levels.' );
  455. return this.levels;
  456. }
  457. }
  458. } );
  459. //
  460. PerspectiveCamera.prototype.setLens = function ( focalLength, filmGauge ) {
  461. console.warn( "THREE.PerspectiveCamera.setLens is deprecated. " +
  462. "Use .setFocalLength and .filmGauge for a photographic setup." );
  463. if ( filmGauge !== undefined ) this.filmGauge = filmGauge;
  464. this.setFocalLength( focalLength );
  465. };
  466. //
  467. Object.defineProperties( Light.prototype, {
  468. onlyShadow: {
  469. set: function () {
  470. console.warn( 'THREE.Light: .onlyShadow has been removed.' );
  471. }
  472. },
  473. shadowCameraFov: {
  474. set: function ( value ) {
  475. console.warn( 'THREE.Light: .shadowCameraFov is now .shadow.camera.fov.' );
  476. this.shadow.camera.fov = value;
  477. }
  478. },
  479. shadowCameraLeft: {
  480. set: function ( value ) {
  481. console.warn( 'THREE.Light: .shadowCameraLeft is now .shadow.camera.left.' );
  482. this.shadow.camera.left = value;
  483. }
  484. },
  485. shadowCameraRight: {
  486. set: function ( value ) {
  487. console.warn( 'THREE.Light: .shadowCameraRight is now .shadow.camera.right.' );
  488. this.shadow.camera.right = value;
  489. }
  490. },
  491. shadowCameraTop: {
  492. set: function ( value ) {
  493. console.warn( 'THREE.Light: .shadowCameraTop is now .shadow.camera.top.' );
  494. this.shadow.camera.top = value;
  495. }
  496. },
  497. shadowCameraBottom: {
  498. set: function ( value ) {
  499. console.warn( 'THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.' );
  500. this.shadow.camera.bottom = value;
  501. }
  502. },
  503. shadowCameraNear: {
  504. set: function ( value ) {
  505. console.warn( 'THREE.Light: .shadowCameraNear is now .shadow.camera.near.' );
  506. this.shadow.camera.near = value;
  507. }
  508. },
  509. shadowCameraFar: {
  510. set: function ( value ) {
  511. console.warn( 'THREE.Light: .shadowCameraFar is now .shadow.camera.far.' );
  512. this.shadow.camera.far = value;
  513. }
  514. },
  515. shadowCameraVisible: {
  516. set: function () {
  517. console.warn( 'THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.' );
  518. }
  519. },
  520. shadowBias: {
  521. set: function ( value ) {
  522. console.warn( 'THREE.Light: .shadowBias is now .shadow.bias.' );
  523. this.shadow.bias = value;
  524. }
  525. },
  526. shadowDarkness: {
  527. set: function () {
  528. console.warn( 'THREE.Light: .shadowDarkness has been removed.' );
  529. }
  530. },
  531. shadowMapWidth: {
  532. set: function ( value ) {
  533. console.warn( 'THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.' );
  534. this.shadow.mapSize.width = value;
  535. }
  536. },
  537. shadowMapHeight: {
  538. set: function ( value ) {
  539. console.warn( 'THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.' );
  540. this.shadow.mapSize.height = value;
  541. }
  542. }
  543. } );
  544. //
  545. Object.defineProperties( BufferAttribute.prototype, {
  546. length: {
  547. get: function () {
  548. console.warn( 'THREE.BufferAttribute: .length has been deprecated. Use .count instead.' );
  549. return this.array.length;
  550. }
  551. }
  552. } );
  553. Object.assign( BufferGeometry.prototype, {
  554. addIndex: function ( index ) {
  555. console.warn( 'THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().' );
  556. this.setIndex( index );
  557. },
  558. addDrawCall: function ( start, count, indexOffset ) {
  559. if ( indexOffset !== undefined ) {
  560. console.warn( 'THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.' );
  561. }
  562. console.warn( 'THREE.BufferGeometry: .addDrawCall() is now .addGroup().' );
  563. this.addGroup( start, count );
  564. },
  565. clearDrawCalls: function () {
  566. console.warn( 'THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().' );
  567. this.clearGroups();
  568. },
  569. computeTangents: function () {
  570. console.warn( 'THREE.BufferGeometry: .computeTangents() has been removed.' );
  571. },
  572. computeOffsets: function () {
  573. console.warn( 'THREE.BufferGeometry: .computeOffsets() has been removed.' );
  574. }
  575. } );
  576. Object.defineProperties( BufferGeometry.prototype, {
  577. drawcalls: {
  578. get: function () {
  579. console.error( 'THREE.BufferGeometry: .drawcalls has been renamed to .groups.' );
  580. return this.groups;
  581. }
  582. },
  583. offsets: {
  584. get: function () {
  585. console.warn( 'THREE.BufferGeometry: .offsets has been renamed to .groups.' );
  586. return this.groups;
  587. }
  588. }
  589. } );
  590. //
  591. Object.defineProperties( Uniform.prototype, {
  592. dynamic: {
  593. set: function () {
  594. console.warn( 'THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.' );
  595. }
  596. },
  597. onUpdate: {
  598. value: function () {
  599. console.warn( 'THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.' );
  600. return this;
  601. }
  602. }
  603. } );
  604. //
  605. Object.defineProperties( Material.prototype, {
  606. wrapAround: {
  607. get: function () {
  608. console.warn( 'THREE.' + this.type + ': .wrapAround has been removed.' );
  609. },
  610. set: function () {
  611. console.warn( 'THREE.' + this.type + ': .wrapAround has been removed.' );
  612. }
  613. },
  614. wrapRGB: {
  615. get: function () {
  616. console.warn( 'THREE.' + this.type + ': .wrapRGB has been removed.' );
  617. return new Color();
  618. }
  619. }
  620. } );
  621. Object.defineProperties( MeshPhongMaterial.prototype, {
  622. metal: {
  623. get: function () {
  624. console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.' );
  625. return false;
  626. },
  627. set: function () {
  628. console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead' );
  629. }
  630. }
  631. } );
  632. Object.defineProperties( ShaderMaterial.prototype, {
  633. derivatives: {
  634. get: function () {
  635. console.warn( 'THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' );
  636. return this.extensions.derivatives;
  637. },
  638. set: function ( value ) {
  639. console.warn( 'THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' );
  640. this.extensions.derivatives = value;
  641. }
  642. }
  643. } );
  644. //
  645. Object.assign( WebGLRenderer.prototype, {
  646. supportsFloatTextures: function () {
  647. console.warn( 'THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \'OES_texture_float\' ).' );
  648. return this.extensions.get( 'OES_texture_float' );
  649. },
  650. supportsHalfFloatTextures: function () {
  651. console.warn( 'THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \'OES_texture_half_float\' ).' );
  652. return this.extensions.get( 'OES_texture_half_float' );
  653. },
  654. supportsStandardDerivatives: function () {
  655. console.warn( 'THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \'OES_standard_derivatives\' ).' );
  656. return this.extensions.get( 'OES_standard_derivatives' );
  657. },
  658. supportsCompressedTextureS3TC: function () {
  659. console.warn( 'THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \'WEBGL_compressed_texture_s3tc\' ).' );
  660. return this.extensions.get( 'WEBGL_compressed_texture_s3tc' );
  661. },
  662. supportsCompressedTexturePVRTC: function () {
  663. console.warn( 'THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \'WEBGL_compressed_texture_pvrtc\' ).' );
  664. return this.extensions.get( 'WEBGL_compressed_texture_pvrtc' );
  665. },
  666. supportsBlendMinMax: function () {
  667. console.warn( 'THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \'EXT_blend_minmax\' ).' );
  668. return this.extensions.get( 'EXT_blend_minmax' );
  669. },
  670. supportsVertexTextures: function () {
  671. console.warn( 'THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.' );
  672. return this.capabilities.vertexTextures;
  673. },
  674. supportsInstancedArrays: function () {
  675. console.warn( 'THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \'ANGLE_instanced_arrays\' ).' );
  676. return this.extensions.get( 'ANGLE_instanced_arrays' );
  677. },
  678. enableScissorTest: function ( boolean ) {
  679. console.warn( 'THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().' );
  680. this.setScissorTest( boolean );
  681. },
  682. initMaterial: function () {
  683. console.warn( 'THREE.WebGLRenderer: .initMaterial() has been removed.' );
  684. },
  685. addPrePlugin: function () {
  686. console.warn( 'THREE.WebGLRenderer: .addPrePlugin() has been removed.' );
  687. },
  688. addPostPlugin: function () {
  689. console.warn( 'THREE.WebGLRenderer: .addPostPlugin() has been removed.' );
  690. },
  691. updateShadowMap: function () {
  692. console.warn( 'THREE.WebGLRenderer: .updateShadowMap() has been removed.' );
  693. }
  694. } );
  695. Object.defineProperties( WebGLRenderer.prototype, {
  696. shadowMapEnabled: {
  697. get: function () {
  698. return this.shadowMap.enabled;
  699. },
  700. set: function ( value ) {
  701. console.warn( 'THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.' );
  702. this.shadowMap.enabled = value;
  703. }
  704. },
  705. shadowMapType: {
  706. get: function () {
  707. return this.shadowMap.type;
  708. },
  709. set: function ( value ) {
  710. console.warn( 'THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.' );
  711. this.shadowMap.type = value;
  712. }
  713. },
  714. shadowMapCullFace: {
  715. get: function () {
  716. return this.shadowMap.cullFace;
  717. },
  718. set: function ( value ) {
  719. console.warn( 'THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.' );
  720. this.shadowMap.cullFace = value;
  721. }
  722. }
  723. } );
  724. Object.defineProperties( WebGLShadowMap.prototype, {
  725. cullFace: {
  726. get: function () {
  727. return this.renderReverseSided ? CullFaceFront : CullFaceBack;
  728. },
  729. set: function ( cullFace ) {
  730. var value = ( cullFace !== CullFaceBack );
  731. console.warn( "WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to " + value + "." );
  732. this.renderReverseSided = value;
  733. }
  734. }
  735. } );
  736. //
  737. Object.defineProperties( WebGLRenderTarget.prototype, {
  738. wrapS: {
  739. get: function () {
  740. console.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' );
  741. return this.texture.wrapS;
  742. },
  743. set: function ( value ) {
  744. console.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' );
  745. this.texture.wrapS = value;
  746. }
  747. },
  748. wrapT: {
  749. get: function () {
  750. console.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' );
  751. return this.texture.wrapT;
  752. },
  753. set: function ( value ) {
  754. console.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' );
  755. this.texture.wrapT = value;
  756. }
  757. },
  758. magFilter: {
  759. get: function () {
  760. console.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' );
  761. return this.texture.magFilter;
  762. },
  763. set: function ( value ) {
  764. console.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' );
  765. this.texture.magFilter = value;
  766. }
  767. },
  768. minFilter: {
  769. get: function () {
  770. console.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' );
  771. return this.texture.minFilter;
  772. },
  773. set: function ( value ) {
  774. console.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' );
  775. this.texture.minFilter = value;
  776. }
  777. },
  778. anisotropy: {
  779. get: function () {
  780. console.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' );
  781. return this.texture.anisotropy;
  782. },
  783. set: function ( value ) {
  784. console.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' );
  785. this.texture.anisotropy = value;
  786. }
  787. },
  788. offset: {
  789. get: function () {
  790. console.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' );
  791. return this.texture.offset;
  792. },
  793. set: function ( value ) {
  794. console.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' );
  795. this.texture.offset = value;
  796. }
  797. },
  798. repeat: {
  799. get: function () {
  800. console.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' );
  801. return this.texture.repeat;
  802. },
  803. set: function ( value ) {
  804. console.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' );
  805. this.texture.repeat = value;
  806. }
  807. },
  808. format: {
  809. get: function () {
  810. console.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' );
  811. return this.texture.format;
  812. },
  813. set: function ( value ) {
  814. console.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' );
  815. this.texture.format = value;
  816. }
  817. },
  818. type: {
  819. get: function () {
  820. console.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' );
  821. return this.texture.type;
  822. },
  823. set: function ( value ) {
  824. console.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' );
  825. this.texture.type = value;
  826. }
  827. },
  828. generateMipmaps: {
  829. get: function () {
  830. console.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' );
  831. return this.texture.generateMipmaps;
  832. },
  833. set: function ( value ) {
  834. console.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' );
  835. this.texture.generateMipmaps = value;
  836. }
  837. }
  838. } );
  839. //
  840. Audio.prototype.load = function ( file ) {
  841. console.warn( 'THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.' );
  842. var scope = this;
  843. var audioLoader = new AudioLoader();
  844. audioLoader.load( file, function ( buffer ) {
  845. scope.setBuffer( buffer );
  846. } );
  847. return this;
  848. };
  849. AudioAnalyser.prototype.getData = function () {
  850. console.warn( 'THREE.AudioAnalyser: .getData() is now .getFrequencyData().' );
  851. return this.getFrequencyData();
  852. };
  853. //
  854. export var GeometryUtils = {
  855. merge: function ( geometry1, geometry2, materialIndexOffset ) {
  856. console.warn( 'THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.' );
  857. var matrix;
  858. if ( geometry2.isMesh ) {
  859. geometry2.matrixAutoUpdate && geometry2.updateMatrix();
  860. matrix = geometry2.matrix;
  861. geometry2 = geometry2.geometry;
  862. }
  863. geometry1.merge( geometry2, matrix, materialIndexOffset );
  864. },
  865. center: function ( geometry ) {
  866. console.warn( 'THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.' );
  867. return geometry.center();
  868. }
  869. };
  870. export var ImageUtils = {
  871. crossOrigin: undefined,
  872. loadTexture: function ( url, mapping, onLoad, onError ) {
  873. console.warn( 'THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.' );
  874. var loader = new TextureLoader();
  875. loader.setCrossOrigin( this.crossOrigin );
  876. var texture = loader.load( url, onLoad, undefined, onError );
  877. if ( mapping ) texture.mapping = mapping;
  878. return texture;
  879. },
  880. loadTextureCube: function ( urls, mapping, onLoad, onError ) {
  881. console.warn( 'THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.' );
  882. var loader = new CubeTextureLoader();
  883. loader.setCrossOrigin( this.crossOrigin );
  884. var texture = loader.load( urls, onLoad, undefined, onError );
  885. if ( mapping ) texture.mapping = mapping;
  886. return texture;
  887. },
  888. loadCompressedTexture: function () {
  889. console.error( 'THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.' );
  890. },
  891. loadCompressedTextureCube: function () {
  892. console.error( 'THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.' );
  893. }
  894. };
  895. //
  896. export function Projector() {
  897. console.error( 'THREE.Projector has been moved to /examples/js/renderers/Projector.js.' );
  898. this.projectVector = function ( vector, camera ) {
  899. console.warn( 'THREE.Projector: .projectVector() is now vector.project().' );
  900. vector.project( camera );
  901. };
  902. this.unprojectVector = function ( vector, camera ) {
  903. console.warn( 'THREE.Projector: .unprojectVector() is now vector.unproject().' );
  904. vector.unproject( camera );
  905. };
  906. this.pickingRay = function () {
  907. console.error( 'THREE.Projector: .pickingRay() is now raycaster.setFromCamera().' );
  908. };
  909. }
  910. //
  911. export function CanvasRenderer() {
  912. console.error( 'THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js' );
  913. this.domElement = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' );
  914. this.clear = function () {};
  915. this.render = function () {};
  916. this.setClearColor = function () {};
  917. this.setSize = function () {};
  918. }
粤ICP备19079148号