Three.Legacy.js 38 KB

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