Three.Legacy.js 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166
  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 {
  8. FlatShading,
  9. sRGBEncoding,
  10. LinearEncoding,
  11. StaticDrawUsage,
  12. DynamicDrawUsage,
  13. TrianglesDrawMode
  14. } from './constants.js';
  15. import {
  16. Float64BufferAttribute,
  17. Float32BufferAttribute,
  18. Uint32BufferAttribute,
  19. Int32BufferAttribute,
  20. Uint16BufferAttribute,
  21. Int16BufferAttribute,
  22. Uint8ClampedBufferAttribute,
  23. Uint8BufferAttribute,
  24. Int8BufferAttribute,
  25. BufferAttribute
  26. } from './core/BufferAttribute.js';
  27. import { BufferGeometry } from './core/BufferGeometry.js';
  28. import { InterleavedBuffer } from './core/InterleavedBuffer.js';
  29. import { Face3 } from './core/Face3.js';
  30. import { Geometry } from './core/Geometry.js';
  31. import { Object3D } from './core/Object3D.js';
  32. import { Uniform } from './core/Uniform.js';
  33. import { Raycaster } from './core/Raycaster.js';
  34. import { Curve } from './extras/core/Curve.js';
  35. import { CurvePath } from './extras/core/CurvePath.js';
  36. import { Path } from './extras/core/Path.js';
  37. import { CatmullRomCurve3 } from './extras/curves/CatmullRomCurve3.js';
  38. import { AxesHelper } from './helpers/AxesHelper.js';
  39. import { BoxHelper } from './helpers/BoxHelper.js';
  40. import { GridHelper } from './helpers/GridHelper.js';
  41. import { SkeletonHelper } from './helpers/SkeletonHelper.js';
  42. import { BoxGeometry } from './geometries/BoxGeometry.js';
  43. import { EdgesGeometry } from './geometries/EdgesGeometry.js';
  44. import { ExtrudeGeometry } from './geometries/ExtrudeGeometry.js';
  45. import { ExtrudeBufferGeometry } from './geometries/ExtrudeGeometry.js';
  46. import { ShapeGeometry } from './geometries/ShapeGeometry.js';
  47. import { WireframeGeometry } from './geometries/WireframeGeometry.js';
  48. import { Light } from './lights/Light.js';
  49. import { Loader } from './loaders/Loader.js';
  50. import { LoaderUtils } from './loaders/LoaderUtils.js';
  51. import { FileLoader } from './loaders/FileLoader.js';
  52. import { AudioLoader } from './loaders/AudioLoader.js';
  53. import { CubeTextureLoader } from './loaders/CubeTextureLoader.js';
  54. import { DataTextureLoader } from './loaders/DataTextureLoader.js';
  55. import { ObjectLoader } from './loaders/ObjectLoader.js';
  56. import { TextureLoader } from './loaders/TextureLoader.js';
  57. import { Material } from './materials/Material.js';
  58. import { LineBasicMaterial } from './materials/LineBasicMaterial.js';
  59. import { MeshPhongMaterial } from './materials/MeshPhongMaterial.js';
  60. import { PointsMaterial } from './materials/PointsMaterial.js';
  61. import { ShaderMaterial } from './materials/ShaderMaterial.js';
  62. import { Box2 } from './math/Box2.js';
  63. import { Box3 } from './math/Box3.js';
  64. import { Color } from './math/Color.js';
  65. import { Frustum } from './math/Frustum.js';
  66. import { Line3 } from './math/Line3.js';
  67. import { MathUtils } from './math/MathUtils.js';
  68. import { Matrix3 } from './math/Matrix3.js';
  69. import { Matrix4 } from './math/Matrix4.js';
  70. import { Plane } from './math/Plane.js';
  71. import { Quaternion } from './math/Quaternion.js';
  72. import { Ray } from './math/Ray.js';
  73. import { Triangle } from './math/Triangle.js';
  74. import { Vector2 } from './math/Vector2.js';
  75. import { Vector3 } from './math/Vector3.js';
  76. import { Vector4 } from './math/Vector4.js';
  77. import { Mesh } from './objects/Mesh.js';
  78. import { LineSegments } from './objects/LineSegments.js';
  79. import { LOD } from './objects/LOD.js';
  80. import { Points } from './objects/Points.js';
  81. import { Sprite } from './objects/Sprite.js';
  82. import { Skeleton } from './objects/Skeleton.js';
  83. import { SkinnedMesh } from './objects/SkinnedMesh.js';
  84. import { WebGLRenderer } from './renderers/WebGLRenderer.js';
  85. import { WebGLRenderTarget } from './renderers/WebGLRenderTarget.js';
  86. import { WebGLCubeRenderTarget } from './renderers/WebGLCubeRenderTarget.js';
  87. import { WebGLShadowMap } from './renderers/webgl/WebGLShadowMap.js';
  88. import { ImageUtils } from './extras/ImageUtils.js';
  89. import { Shape } from './extras/core/Shape.js';
  90. import { CubeCamera } from './cameras/CubeCamera.js';
  91. export { BoxGeometry as CubeGeometry };
  92. export { MathUtils as Math };
  93. export function Face4( a, b, c, d, normal, color, materialIndex ) {
  94. console.warn( 'THREE.Face4 has been removed. A THREE.Face3 will be created instead.' );
  95. return new Face3( a, b, c, normal, color, materialIndex );
  96. }
  97. export var LineStrip = 0;
  98. export var LinePieces = 1;
  99. export var NoColors = 0;
  100. export var FaceColors = 1;
  101. export var VertexColors = 2;
  102. export function MeshFaceMaterial( materials ) {
  103. console.warn( 'THREE.MeshFaceMaterial has been removed. Use an Array instead.' );
  104. return materials;
  105. }
  106. export function MultiMaterial( materials ) {
  107. if ( materials === undefined ) materials = [];
  108. console.warn( 'THREE.MultiMaterial has been removed. Use an Array instead.' );
  109. materials.isMultiMaterial = true;
  110. materials.materials = materials;
  111. materials.clone = function () {
  112. return materials.slice();
  113. };
  114. return materials;
  115. }
  116. export function PointCloud( geometry, material ) {
  117. console.warn( 'THREE.PointCloud has been renamed to THREE.Points.' );
  118. return new Points( geometry, material );
  119. }
  120. export function Particle( material ) {
  121. console.warn( 'THREE.Particle has been renamed to THREE.Sprite.' );
  122. return new Sprite( material );
  123. }
  124. export function ParticleSystem( geometry, material ) {
  125. console.warn( 'THREE.ParticleSystem has been renamed to THREE.Points.' );
  126. return new Points( geometry, material );
  127. }
  128. export function PointCloudMaterial( parameters ) {
  129. console.warn( 'THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.' );
  130. return new PointsMaterial( parameters );
  131. }
  132. export function ParticleBasicMaterial( parameters ) {
  133. console.warn( 'THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.' );
  134. return new PointsMaterial( parameters );
  135. }
  136. export function ParticleSystemMaterial( parameters ) {
  137. console.warn( 'THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.' );
  138. return new PointsMaterial( parameters );
  139. }
  140. export function Vertex( x, y, z ) {
  141. console.warn( 'THREE.Vertex has been removed. Use THREE.Vector3 instead.' );
  142. return new Vector3( x, y, z );
  143. }
  144. //
  145. export function DynamicBufferAttribute( array, itemSize ) {
  146. console.warn( 'THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead.' );
  147. return new BufferAttribute( array, itemSize ).setUsage( DynamicDrawUsage );
  148. }
  149. export function Int8Attribute( array, itemSize ) {
  150. console.warn( 'THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead.' );
  151. return new Int8BufferAttribute( array, itemSize );
  152. }
  153. export function Uint8Attribute( array, itemSize ) {
  154. console.warn( 'THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead.' );
  155. return new Uint8BufferAttribute( array, itemSize );
  156. }
  157. export function Uint8ClampedAttribute( array, itemSize ) {
  158. console.warn( 'THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead.' );
  159. return new Uint8ClampedBufferAttribute( array, itemSize );
  160. }
  161. export function Int16Attribute( array, itemSize ) {
  162. console.warn( 'THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead.' );
  163. return new Int16BufferAttribute( array, itemSize );
  164. }
  165. export function Uint16Attribute( array, itemSize ) {
  166. console.warn( 'THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead.' );
  167. return new Uint16BufferAttribute( array, itemSize );
  168. }
  169. export function Int32Attribute( array, itemSize ) {
  170. console.warn( 'THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead.' );
  171. return new Int32BufferAttribute( array, itemSize );
  172. }
  173. export function Uint32Attribute( array, itemSize ) {
  174. console.warn( 'THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead.' );
  175. return new Uint32BufferAttribute( array, itemSize );
  176. }
  177. export function Float32Attribute( array, itemSize ) {
  178. console.warn( 'THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead.' );
  179. return new Float32BufferAttribute( array, itemSize );
  180. }
  181. export function Float64Attribute( array, itemSize ) {
  182. console.warn( 'THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead.' );
  183. return new Float64BufferAttribute( array, itemSize );
  184. }
  185. //
  186. Curve.create = function ( construct, getPoint ) {
  187. console.log( 'THREE.Curve.create() has been deprecated' );
  188. construct.prototype = Object.create( Curve.prototype );
  189. construct.prototype.constructor = construct;
  190. construct.prototype.getPoint = getPoint;
  191. return construct;
  192. };
  193. //
  194. Object.assign( CurvePath.prototype, {
  195. createPointsGeometry: function ( divisions ) {
  196. console.warn( 'THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.' );
  197. // generate geometry from path points (for Line or Points objects)
  198. var pts = this.getPoints( divisions );
  199. return this.createGeometry( pts );
  200. },
  201. createSpacedPointsGeometry: function ( divisions ) {
  202. console.warn( 'THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.' );
  203. // generate geometry from equidistant sampling along the path
  204. var pts = this.getSpacedPoints( divisions );
  205. return this.createGeometry( pts );
  206. },
  207. createGeometry: function ( points ) {
  208. console.warn( 'THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.' );
  209. var geometry = new Geometry();
  210. for ( var i = 0, l = points.length; i < l; i ++ ) {
  211. var point = points[ i ];
  212. geometry.vertices.push( new Vector3( point.x, point.y, point.z || 0 ) );
  213. }
  214. return geometry;
  215. }
  216. } );
  217. //
  218. Object.assign( Path.prototype, {
  219. fromPoints: function ( points ) {
  220. console.warn( 'THREE.Path: .fromPoints() has been renamed to .setFromPoints().' );
  221. return this.setFromPoints( points );
  222. }
  223. } );
  224. //
  225. export function ClosedSplineCurve3( points ) {
  226. console.warn( 'THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.' );
  227. CatmullRomCurve3.call( this, points );
  228. this.type = 'catmullrom';
  229. this.closed = true;
  230. }
  231. ClosedSplineCurve3.prototype = Object.create( CatmullRomCurve3.prototype );
  232. //
  233. export function SplineCurve3( points ) {
  234. console.warn( 'THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.' );
  235. CatmullRomCurve3.call( this, points );
  236. this.type = 'catmullrom';
  237. }
  238. SplineCurve3.prototype = Object.create( CatmullRomCurve3.prototype );
  239. //
  240. export function Spline( points ) {
  241. console.warn( 'THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.' );
  242. CatmullRomCurve3.call( this, points );
  243. this.type = 'catmullrom';
  244. }
  245. Spline.prototype = Object.create( CatmullRomCurve3.prototype );
  246. Object.assign( Spline.prototype, {
  247. initFromArray: function ( /* a */ ) {
  248. console.error( 'THREE.Spline: .initFromArray() has been removed.' );
  249. },
  250. getControlPointsArray: function ( /* optionalTarget */ ) {
  251. console.error( 'THREE.Spline: .getControlPointsArray() has been removed.' );
  252. },
  253. reparametrizeByArcLength: function ( /* samplingCoef */ ) {
  254. console.error( 'THREE.Spline: .reparametrizeByArcLength() has been removed.' );
  255. }
  256. } );
  257. //
  258. export function AxisHelper( size ) {
  259. console.warn( 'THREE.AxisHelper has been renamed to THREE.AxesHelper.' );
  260. return new AxesHelper( size );
  261. }
  262. export function BoundingBoxHelper( object, color ) {
  263. console.warn( 'THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead.' );
  264. return new BoxHelper( object, color );
  265. }
  266. export function EdgesHelper( object, hex ) {
  267. console.warn( 'THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead.' );
  268. return new LineSegments( new EdgesGeometry( object.geometry ), new LineBasicMaterial( { color: hex !== undefined ? hex : 0xffffff } ) );
  269. }
  270. GridHelper.prototype.setColors = function () {
  271. console.error( 'THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.' );
  272. };
  273. SkeletonHelper.prototype.update = function () {
  274. console.error( 'THREE.SkeletonHelper: update() no longer needs to be called.' );
  275. };
  276. export function WireframeHelper( object, hex ) {
  277. console.warn( 'THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead.' );
  278. return new LineSegments( new WireframeGeometry( object.geometry ), new LineBasicMaterial( { color: hex !== undefined ? hex : 0xffffff } ) );
  279. }
  280. //
  281. Object.assign( Loader.prototype, {
  282. extractUrlBase: function ( url ) {
  283. console.warn( 'THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead.' );
  284. return LoaderUtils.extractUrlBase( url );
  285. }
  286. } );
  287. Loader.Handlers = {
  288. add: function ( /* regex, loader */ ) {
  289. console.error( 'THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.' );
  290. },
  291. get: function ( /* file */ ) {
  292. console.error( 'THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.' );
  293. }
  294. };
  295. export function XHRLoader( manager ) {
  296. console.warn( 'THREE.XHRLoader has been renamed to THREE.FileLoader.' );
  297. return new FileLoader( manager );
  298. }
  299. export function BinaryTextureLoader( manager ) {
  300. console.warn( 'THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader.' );
  301. return new DataTextureLoader( manager );
  302. }
  303. Object.assign( ObjectLoader.prototype, {
  304. setTexturePath: function ( value ) {
  305. console.warn( 'THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().' );
  306. return this.setResourcePath( value );
  307. }
  308. } );
  309. //
  310. Object.assign( Box2.prototype, {
  311. center: function ( optionalTarget ) {
  312. console.warn( 'THREE.Box2: .center() has been renamed to .getCenter().' );
  313. return this.getCenter( optionalTarget );
  314. },
  315. empty: function () {
  316. console.warn( 'THREE.Box2: .empty() has been renamed to .isEmpty().' );
  317. return this.isEmpty();
  318. },
  319. isIntersectionBox: function ( box ) {
  320. console.warn( 'THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().' );
  321. return this.intersectsBox( box );
  322. },
  323. size: function ( optionalTarget ) {
  324. console.warn( 'THREE.Box2: .size() has been renamed to .getSize().' );
  325. return this.getSize( optionalTarget );
  326. }
  327. } );
  328. Object.assign( Box3.prototype, {
  329. center: function ( optionalTarget ) {
  330. console.warn( 'THREE.Box3: .center() has been renamed to .getCenter().' );
  331. return this.getCenter( optionalTarget );
  332. },
  333. empty: function () {
  334. console.warn( 'THREE.Box3: .empty() has been renamed to .isEmpty().' );
  335. return this.isEmpty();
  336. },
  337. isIntersectionBox: function ( box ) {
  338. console.warn( 'THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().' );
  339. return this.intersectsBox( box );
  340. },
  341. isIntersectionSphere: function ( sphere ) {
  342. console.warn( 'THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().' );
  343. return this.intersectsSphere( sphere );
  344. },
  345. size: function ( optionalTarget ) {
  346. console.warn( 'THREE.Box3: .size() has been renamed to .getSize().' );
  347. return this.getSize( optionalTarget );
  348. }
  349. } );
  350. Frustum.prototype.setFromMatrix = function ( m ) {
  351. console.warn( 'THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix().' );
  352. return this.setFromProjectionMatrix( m );
  353. };
  354. Line3.prototype.center = function ( optionalTarget ) {
  355. console.warn( 'THREE.Line3: .center() has been renamed to .getCenter().' );
  356. return this.getCenter( optionalTarget );
  357. };
  358. Object.assign( MathUtils, {
  359. random16: function () {
  360. console.warn( 'THREE.Math: .random16() has been deprecated. Use Math.random() instead.' );
  361. return Math.random();
  362. },
  363. nearestPowerOfTwo: function ( value ) {
  364. console.warn( 'THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo().' );
  365. return MathUtils.floorPowerOfTwo( value );
  366. },
  367. nextPowerOfTwo: function ( value ) {
  368. console.warn( 'THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo().' );
  369. return MathUtils.ceilPowerOfTwo( value );
  370. }
  371. } );
  372. Object.assign( Matrix3.prototype, {
  373. flattenToArrayOffset: function ( array, offset ) {
  374. console.warn( "THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead." );
  375. return this.toArray( array, offset );
  376. },
  377. multiplyVector3: function ( vector ) {
  378. console.warn( 'THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.' );
  379. return vector.applyMatrix3( this );
  380. },
  381. multiplyVector3Array: function ( /* a */ ) {
  382. console.error( 'THREE.Matrix3: .multiplyVector3Array() has been removed.' );
  383. },
  384. applyToBufferAttribute: function ( attribute ) {
  385. console.warn( 'THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead.' );
  386. return attribute.applyMatrix3( this );
  387. },
  388. applyToVector3Array: function ( /* array, offset, length */ ) {
  389. console.error( 'THREE.Matrix3: .applyToVector3Array() has been removed.' );
  390. }
  391. } );
  392. Object.assign( Matrix4.prototype, {
  393. extractPosition: function ( m ) {
  394. console.warn( 'THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().' );
  395. return this.copyPosition( m );
  396. },
  397. flattenToArrayOffset: function ( array, offset ) {
  398. console.warn( "THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead." );
  399. return this.toArray( array, offset );
  400. },
  401. getPosition: function () {
  402. console.warn( 'THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.' );
  403. return new Vector3().setFromMatrixColumn( this, 3 );
  404. },
  405. setRotationFromQuaternion: function ( q ) {
  406. console.warn( 'THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().' );
  407. return this.makeRotationFromQuaternion( q );
  408. },
  409. multiplyToArray: function () {
  410. console.warn( 'THREE.Matrix4: .multiplyToArray() has been removed.' );
  411. },
  412. multiplyVector3: function ( vector ) {
  413. console.warn( 'THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.' );
  414. return vector.applyMatrix4( this );
  415. },
  416. multiplyVector4: function ( vector ) {
  417. console.warn( 'THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.' );
  418. return vector.applyMatrix4( this );
  419. },
  420. multiplyVector3Array: function ( /* a */ ) {
  421. console.error( 'THREE.Matrix4: .multiplyVector3Array() has been removed.' );
  422. },
  423. rotateAxis: function ( v ) {
  424. console.warn( 'THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.' );
  425. v.transformDirection( this );
  426. },
  427. crossVector: function ( vector ) {
  428. console.warn( 'THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.' );
  429. return vector.applyMatrix4( this );
  430. },
  431. translate: function () {
  432. console.error( 'THREE.Matrix4: .translate() has been removed.' );
  433. },
  434. rotateX: function () {
  435. console.error( 'THREE.Matrix4: .rotateX() has been removed.' );
  436. },
  437. rotateY: function () {
  438. console.error( 'THREE.Matrix4: .rotateY() has been removed.' );
  439. },
  440. rotateZ: function () {
  441. console.error( 'THREE.Matrix4: .rotateZ() has been removed.' );
  442. },
  443. rotateByAxis: function () {
  444. console.error( 'THREE.Matrix4: .rotateByAxis() has been removed.' );
  445. },
  446. applyToBufferAttribute: function ( attribute ) {
  447. console.warn( 'THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead.' );
  448. return attribute.applyMatrix4( this );
  449. },
  450. applyToVector3Array: function ( /* array, offset, length */ ) {
  451. console.error( 'THREE.Matrix4: .applyToVector3Array() has been removed.' );
  452. },
  453. makeFrustum: function ( left, right, bottom, top, near, far ) {
  454. console.warn( 'THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.' );
  455. return this.makePerspective( left, right, top, bottom, near, far );
  456. }
  457. } );
  458. Plane.prototype.isIntersectionLine = function ( line ) {
  459. console.warn( 'THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().' );
  460. return this.intersectsLine( line );
  461. };
  462. Quaternion.prototype.multiplyVector3 = function ( vector ) {
  463. console.warn( 'THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.' );
  464. return vector.applyQuaternion( this );
  465. };
  466. Object.assign( Ray.prototype, {
  467. isIntersectionBox: function ( box ) {
  468. console.warn( 'THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().' );
  469. return this.intersectsBox( box );
  470. },
  471. isIntersectionPlane: function ( plane ) {
  472. console.warn( 'THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().' );
  473. return this.intersectsPlane( plane );
  474. },
  475. isIntersectionSphere: function ( sphere ) {
  476. console.warn( 'THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().' );
  477. return this.intersectsSphere( sphere );
  478. }
  479. } );
  480. Object.assign( Triangle.prototype, {
  481. area: function () {
  482. console.warn( 'THREE.Triangle: .area() has been renamed to .getArea().' );
  483. return this.getArea();
  484. },
  485. barycoordFromPoint: function ( point, target ) {
  486. console.warn( 'THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().' );
  487. return this.getBarycoord( point, target );
  488. },
  489. midpoint: function ( target ) {
  490. console.warn( 'THREE.Triangle: .midpoint() has been renamed to .getMidpoint().' );
  491. return this.getMidpoint( target );
  492. },
  493. normal: function ( target ) {
  494. console.warn( 'THREE.Triangle: .normal() has been renamed to .getNormal().' );
  495. return this.getNormal( target );
  496. },
  497. plane: function ( target ) {
  498. console.warn( 'THREE.Triangle: .plane() has been renamed to .getPlane().' );
  499. return this.getPlane( target );
  500. }
  501. } );
  502. Object.assign( Triangle, {
  503. barycoordFromPoint: function ( point, a, b, c, target ) {
  504. console.warn( 'THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().' );
  505. return Triangle.getBarycoord( point, a, b, c, target );
  506. },
  507. normal: function ( a, b, c, target ) {
  508. console.warn( 'THREE.Triangle: .normal() has been renamed to .getNormal().' );
  509. return Triangle.getNormal( a, b, c, target );
  510. }
  511. } );
  512. Object.assign( Shape.prototype, {
  513. extractAllPoints: function ( divisions ) {
  514. console.warn( 'THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead.' );
  515. return this.extractPoints( divisions );
  516. },
  517. extrude: function ( options ) {
  518. console.warn( 'THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.' );
  519. return new ExtrudeGeometry( this, options );
  520. },
  521. makeGeometry: function ( options ) {
  522. console.warn( 'THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.' );
  523. return new ShapeGeometry( this, options );
  524. }
  525. } );
  526. Object.assign( Vector2.prototype, {
  527. fromAttribute: function ( attribute, index, offset ) {
  528. console.warn( 'THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().' );
  529. return this.fromBufferAttribute( attribute, index, offset );
  530. },
  531. distanceToManhattan: function ( v ) {
  532. console.warn( 'THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo().' );
  533. return this.manhattanDistanceTo( v );
  534. },
  535. lengthManhattan: function () {
  536. console.warn( 'THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength().' );
  537. return this.manhattanLength();
  538. }
  539. } );
  540. Object.assign( Vector3.prototype, {
  541. setEulerFromRotationMatrix: function () {
  542. console.error( 'THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.' );
  543. },
  544. setEulerFromQuaternion: function () {
  545. console.error( 'THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.' );
  546. },
  547. getPositionFromMatrix: function ( m ) {
  548. console.warn( 'THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().' );
  549. return this.setFromMatrixPosition( m );
  550. },
  551. getScaleFromMatrix: function ( m ) {
  552. console.warn( 'THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().' );
  553. return this.setFromMatrixScale( m );
  554. },
  555. getColumnFromMatrix: function ( index, matrix ) {
  556. console.warn( 'THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().' );
  557. return this.setFromMatrixColumn( matrix, index );
  558. },
  559. applyProjection: function ( m ) {
  560. console.warn( 'THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.' );
  561. return this.applyMatrix4( m );
  562. },
  563. fromAttribute: function ( attribute, index, offset ) {
  564. console.warn( 'THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().' );
  565. return this.fromBufferAttribute( attribute, index, offset );
  566. },
  567. distanceToManhattan: function ( v ) {
  568. console.warn( 'THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo().' );
  569. return this.manhattanDistanceTo( v );
  570. },
  571. lengthManhattan: function () {
  572. console.warn( 'THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength().' );
  573. return this.manhattanLength();
  574. }
  575. } );
  576. Object.assign( Vector4.prototype, {
  577. fromAttribute: function ( attribute, index, offset ) {
  578. console.warn( 'THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().' );
  579. return this.fromBufferAttribute( attribute, index, offset );
  580. },
  581. lengthManhattan: function () {
  582. console.warn( 'THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength().' );
  583. return this.manhattanLength();
  584. }
  585. } );
  586. //
  587. Object.assign( Geometry.prototype, {
  588. computeTangents: function () {
  589. console.error( 'THREE.Geometry: .computeTangents() has been removed.' );
  590. },
  591. computeLineDistances: function () {
  592. console.error( 'THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.' );
  593. },
  594. applyMatrix: function ( matrix ) {
  595. console.warn( 'THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4().' );
  596. return this.applyMatrix4( matrix );
  597. }
  598. } );
  599. Object.assign( Object3D.prototype, {
  600. getChildByName: function ( name ) {
  601. console.warn( 'THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().' );
  602. return this.getObjectByName( name );
  603. },
  604. renderDepth: function () {
  605. console.warn( 'THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.' );
  606. },
  607. translate: function ( distance, axis ) {
  608. console.warn( 'THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.' );
  609. return this.translateOnAxis( axis, distance );
  610. },
  611. getWorldRotation: function () {
  612. console.error( 'THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.' );
  613. },
  614. applyMatrix: function ( matrix ) {
  615. console.warn( 'THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4().' );
  616. return this.applyMatrix4( matrix );
  617. }
  618. } );
  619. Object.defineProperties( Object3D.prototype, {
  620. eulerOrder: {
  621. get: function () {
  622. console.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' );
  623. return this.rotation.order;
  624. },
  625. set: function ( value ) {
  626. console.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' );
  627. this.rotation.order = value;
  628. }
  629. },
  630. useQuaternion: {
  631. get: function () {
  632. console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );
  633. },
  634. set: function () {
  635. console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );
  636. }
  637. }
  638. } );
  639. Object.assign( Mesh.prototype, {
  640. setDrawMode: function () {
  641. console.error( 'THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.' );
  642. },
  643. } );
  644. Object.defineProperties( Mesh.prototype, {
  645. drawMode: {
  646. get: function () {
  647. console.error( 'THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode.' );
  648. return TrianglesDrawMode;
  649. },
  650. set: function () {
  651. console.error( 'THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.' );
  652. }
  653. }
  654. } );
  655. Object.defineProperties( LOD.prototype, {
  656. objects: {
  657. get: function () {
  658. console.warn( 'THREE.LOD: .objects has been renamed to .levels.' );
  659. return this.levels;
  660. }
  661. }
  662. } );
  663. Object.defineProperty( Skeleton.prototype, 'useVertexTexture', {
  664. get: function () {
  665. console.warn( 'THREE.Skeleton: useVertexTexture has been removed.' );
  666. },
  667. set: function () {
  668. console.warn( 'THREE.Skeleton: useVertexTexture has been removed.' );
  669. }
  670. } );
  671. SkinnedMesh.prototype.initBones = function () {
  672. console.error( 'THREE.SkinnedMesh: initBones() has been removed.' );
  673. };
  674. Object.defineProperty( Curve.prototype, '__arcLengthDivisions', {
  675. get: function () {
  676. console.warn( 'THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.' );
  677. return this.arcLengthDivisions;
  678. },
  679. set: function ( value ) {
  680. console.warn( 'THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.' );
  681. this.arcLengthDivisions = value;
  682. }
  683. } );
  684. //
  685. PerspectiveCamera.prototype.setLens = function ( focalLength, filmGauge ) {
  686. console.warn( "THREE.PerspectiveCamera.setLens is deprecated. " +
  687. "Use .setFocalLength and .filmGauge for a photographic setup." );
  688. if ( filmGauge !== undefined ) this.filmGauge = filmGauge;
  689. this.setFocalLength( focalLength );
  690. };
  691. //
  692. Object.defineProperties( Light.prototype, {
  693. onlyShadow: {
  694. set: function () {
  695. console.warn( 'THREE.Light: .onlyShadow has been removed.' );
  696. }
  697. },
  698. shadowCameraFov: {
  699. set: function ( value ) {
  700. console.warn( 'THREE.Light: .shadowCameraFov is now .shadow.camera.fov.' );
  701. this.shadow.camera.fov = value;
  702. }
  703. },
  704. shadowCameraLeft: {
  705. set: function ( value ) {
  706. console.warn( 'THREE.Light: .shadowCameraLeft is now .shadow.camera.left.' );
  707. this.shadow.camera.left = value;
  708. }
  709. },
  710. shadowCameraRight: {
  711. set: function ( value ) {
  712. console.warn( 'THREE.Light: .shadowCameraRight is now .shadow.camera.right.' );
  713. this.shadow.camera.right = value;
  714. }
  715. },
  716. shadowCameraTop: {
  717. set: function ( value ) {
  718. console.warn( 'THREE.Light: .shadowCameraTop is now .shadow.camera.top.' );
  719. this.shadow.camera.top = value;
  720. }
  721. },
  722. shadowCameraBottom: {
  723. set: function ( value ) {
  724. console.warn( 'THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.' );
  725. this.shadow.camera.bottom = value;
  726. }
  727. },
  728. shadowCameraNear: {
  729. set: function ( value ) {
  730. console.warn( 'THREE.Light: .shadowCameraNear is now .shadow.camera.near.' );
  731. this.shadow.camera.near = value;
  732. }
  733. },
  734. shadowCameraFar: {
  735. set: function ( value ) {
  736. console.warn( 'THREE.Light: .shadowCameraFar is now .shadow.camera.far.' );
  737. this.shadow.camera.far = value;
  738. }
  739. },
  740. shadowCameraVisible: {
  741. set: function () {
  742. console.warn( 'THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.' );
  743. }
  744. },
  745. shadowBias: {
  746. set: function ( value ) {
  747. console.warn( 'THREE.Light: .shadowBias is now .shadow.bias.' );
  748. this.shadow.bias = value;
  749. }
  750. },
  751. shadowDarkness: {
  752. set: function () {
  753. console.warn( 'THREE.Light: .shadowDarkness has been removed.' );
  754. }
  755. },
  756. shadowMapWidth: {
  757. set: function ( value ) {
  758. console.warn( 'THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.' );
  759. this.shadow.mapSize.width = value;
  760. }
  761. },
  762. shadowMapHeight: {
  763. set: function ( value ) {
  764. console.warn( 'THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.' );
  765. this.shadow.mapSize.height = value;
  766. }
  767. }
  768. } );
  769. //
  770. Object.defineProperties( BufferAttribute.prototype, {
  771. length: {
  772. get: function () {
  773. console.warn( 'THREE.BufferAttribute: .length has been deprecated. Use .count instead.' );
  774. return this.array.length;
  775. }
  776. },
  777. dynamic: {
  778. get: function () {
  779. console.warn( 'THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.' );
  780. return this.usage === DynamicDrawUsage;
  781. },
  782. set: function ( /* value */ ) {
  783. console.warn( 'THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.' );
  784. this.setUsage( DynamicDrawUsage );
  785. }
  786. }
  787. } );
  788. Object.assign( BufferAttribute.prototype, {
  789. setDynamic: function ( value ) {
  790. console.warn( 'THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead.' );
  791. this.setUsage( value === true ? DynamicDrawUsage : StaticDrawUsage );
  792. return this;
  793. },
  794. copyIndicesArray: function ( /* indices */ ) {
  795. console.error( 'THREE.BufferAttribute: .copyIndicesArray() has been removed.' );
  796. },
  797. setArray: function ( /* array */ ) {
  798. console.error( 'THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers' );
  799. }
  800. } );
  801. Object.assign( BufferGeometry.prototype, {
  802. addIndex: function ( index ) {
  803. console.warn( 'THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().' );
  804. this.setIndex( index );
  805. },
  806. addAttribute: function ( name, attribute ) {
  807. console.warn( 'THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute().' );
  808. if ( ! ( attribute && attribute.isBufferAttribute ) && ! ( attribute && attribute.isInterleavedBufferAttribute ) ) {
  809. console.warn( 'THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).' );
  810. return this.setAttribute( name, new BufferAttribute( arguments[ 1 ], arguments[ 2 ] ) );
  811. }
  812. if ( name === 'index' ) {
  813. console.warn( 'THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute.' );
  814. this.setIndex( attribute );
  815. return this;
  816. }
  817. return this.setAttribute( name, attribute );
  818. },
  819. addDrawCall: function ( start, count, indexOffset ) {
  820. if ( indexOffset !== undefined ) {
  821. console.warn( 'THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.' );
  822. }
  823. console.warn( 'THREE.BufferGeometry: .addDrawCall() is now .addGroup().' );
  824. this.addGroup( start, count );
  825. },
  826. clearDrawCalls: function () {
  827. console.warn( 'THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().' );
  828. this.clearGroups();
  829. },
  830. computeTangents: function () {
  831. console.warn( 'THREE.BufferGeometry: .computeTangents() has been removed.' );
  832. },
  833. computeOffsets: function () {
  834. console.warn( 'THREE.BufferGeometry: .computeOffsets() has been removed.' );
  835. },
  836. removeAttribute: function ( name ) {
  837. console.warn( 'THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute().' );
  838. return this.deleteAttribute( name );
  839. },
  840. applyMatrix: function ( matrix ) {
  841. console.warn( 'THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4().' );
  842. return this.applyMatrix4( matrix );
  843. }
  844. } );
  845. Object.defineProperties( BufferGeometry.prototype, {
  846. drawcalls: {
  847. get: function () {
  848. console.error( 'THREE.BufferGeometry: .drawcalls has been renamed to .groups.' );
  849. return this.groups;
  850. }
  851. },
  852. offsets: {
  853. get: function () {
  854. console.warn( 'THREE.BufferGeometry: .offsets has been renamed to .groups.' );
  855. return this.groups;
  856. }
  857. }
  858. } );
  859. Object.defineProperties( Raycaster.prototype, {
  860. linePrecision: {
  861. get: function () {
  862. console.warn( 'THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead.' );
  863. return this.params.Line.threshold;
  864. },
  865. set: function ( value ) {
  866. console.warn( 'THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead.' );
  867. this.params.Line.threshold = value;
  868. }
  869. }
  870. } );
  871. Object.defineProperties( InterleavedBuffer.prototype, {
  872. dynamic: {
  873. get: function () {
  874. console.warn( 'THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.' );
  875. return this.usage === DynamicDrawUsage;
  876. },
  877. set: function ( value ) {
  878. console.warn( 'THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.' );
  879. this.setUsage( value );
  880. }
  881. }
  882. } );
  883. Object.assign( InterleavedBuffer.prototype, {
  884. setDynamic: function ( value ) {
  885. console.warn( 'THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead.' );
  886. this.setUsage( value === true ? DynamicDrawUsage : StaticDrawUsage );
  887. return this;
  888. },
  889. setArray: function ( /* array */ ) {
  890. console.error( 'THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers' );
  891. }
  892. } );
  893. //
  894. Object.assign( ExtrudeBufferGeometry.prototype, {
  895. getArrays: function () {
  896. console.error( 'THREE.ExtrudeBufferGeometry: .getArrays() has been removed.' );
  897. },
  898. addShapeList: function () {
  899. console.error( 'THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.' );
  900. },
  901. addShape: function () {
  902. console.error( 'THREE.ExtrudeBufferGeometry: .addShape() has been removed.' );
  903. }
  904. } );
  905. //
  906. Object.defineProperties( Uniform.prototype, {
  907. dynamic: {
  908. set: function () {
  909. console.warn( 'THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.' );
  910. }
  911. },
  912. onUpdate: {
  913. value: function () {
  914. console.warn( 'THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.' );
  915. return this;
  916. }
  917. }
  918. } );
  919. //
  920. Object.defineProperties( Material.prototype, {
  921. wrapAround: {
  922. get: function () {
  923. console.warn( 'THREE.Material: .wrapAround has been removed.' );
  924. },
  925. set: function () {
  926. console.warn( 'THREE.Material: .wrapAround has been removed.' );
  927. }
  928. },
  929. overdraw: {
  930. get: function () {
  931. console.warn( 'THREE.Material: .overdraw has been removed.' );
  932. },
  933. set: function () {
  934. console.warn( 'THREE.Material: .overdraw has been removed.' );
  935. }
  936. },
  937. wrapRGB: {
  938. get: function () {
  939. console.warn( 'THREE.Material: .wrapRGB has been removed.' );
  940. return new Color();
  941. }
  942. },
  943. shading: {
  944. get: function () {
  945. console.error( 'THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.' );
  946. },
  947. set: function ( value ) {
  948. console.warn( 'THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.' );
  949. this.flatShading = ( value === FlatShading );
  950. }
  951. },
  952. stencilMask: {
  953. get: function () {
  954. console.warn( 'THREE.' + this.type + ': .stencilMask has been removed. Use .stencilFuncMask instead.' );
  955. return this.stencilFuncMask;
  956. },
  957. set: function ( value ) {
  958. console.warn( 'THREE.' + this.type + ': .stencilMask has been removed. Use .stencilFuncMask instead.' );
  959. this.stencilFuncMask = value;
  960. }
  961. }
  962. } );
  963. Object.defineProperties( MeshPhongMaterial.prototype, {
  964. metal: {
  965. get: function () {
  966. console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.' );
  967. return false;
  968. },
  969. set: function () {
  970. console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead' );
  971. }
  972. }
  973. } );
  974. Object.defineProperties( ShaderMaterial.prototype, {
  975. derivatives: {
  976. get: function () {
  977. console.warn( 'THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' );
  978. return this.extensions.derivatives;
  979. },
  980. set: function ( value ) {
  981. console.warn( 'THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' );
  982. this.extensions.derivatives = value;
  983. }
  984. }
  985. } );
  986. //
  987. Object.assign( WebGLRenderer.prototype, {
  988. clearTarget: function ( renderTarget, color, depth, stencil ) {
  989. console.warn( 'THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.' );
  990. this.setRenderTarget( renderTarget );
  991. this.clear( color, depth, stencil );
  992. },
  993. animate: function ( callback ) {
  994. console.warn( 'THREE.WebGLRenderer: .animate() is now .setAnimationLoop().' );
  995. this.setAnimationLoop( callback );
  996. },
  997. getCurrentRenderTarget: function () {
  998. console.warn( 'THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget().' );
  999. return this.getRenderTarget();
  1000. },
  1001. getMaxAnisotropy: function () {
  1002. console.warn( 'THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy().' );
  1003. return this.capabilities.getMaxAnisotropy();
  1004. },
  1005. getPrecision: function () {
  1006. console.warn( 'THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision.' );
  1007. return this.capabilities.precision;
  1008. },
  1009. resetGLState: function () {
  1010. console.warn( 'THREE.WebGLRenderer: .resetGLState() is now .state.reset().' );
  1011. return this.state.reset();
  1012. },
  1013. supportsFloatTextures: function () {
  1014. console.warn( 'THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \'OES_texture_float\' ).' );
  1015. return this.extensions.get( 'OES_texture_float' );
  1016. },
  1017. supportsHalfFloatTextures: function () {
  1018. console.warn( 'THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \'OES_texture_half_float\' ).' );
  1019. return this.extensions.get( 'OES_texture_half_float' );
  1020. },
  1021. supportsStandardDerivatives: function () {
  1022. console.warn( 'THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \'OES_standard_derivatives\' ).' );
  1023. return this.extensions.get( 'OES_standard_derivatives' );
  1024. },
  1025. supportsCompressedTextureS3TC: function () {
  1026. console.warn( 'THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \'WEBGL_compressed_texture_s3tc\' ).' );
  1027. return this.extensions.get( 'WEBGL_compressed_texture_s3tc' );
  1028. },
  1029. supportsCompressedTexturePVRTC: function () {
  1030. console.warn( 'THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \'WEBGL_compressed_texture_pvrtc\' ).' );
  1031. return this.extensions.get( 'WEBGL_compressed_texture_pvrtc' );
  1032. },
  1033. supportsBlendMinMax: function () {
  1034. console.warn( 'THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \'EXT_blend_minmax\' ).' );
  1035. return this.extensions.get( 'EXT_blend_minmax' );
  1036. },
  1037. supportsVertexTextures: function () {
  1038. console.warn( 'THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.' );
  1039. return this.capabilities.vertexTextures;
  1040. },
  1041. supportsInstancedArrays: function () {
  1042. console.warn( 'THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \'ANGLE_instanced_arrays\' ).' );
  1043. return this.extensions.get( 'ANGLE_instanced_arrays' );
  1044. },
  1045. enableScissorTest: function ( boolean ) {
  1046. console.warn( 'THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().' );
  1047. this.setScissorTest( boolean );
  1048. },
  1049. initMaterial: function () {
  1050. console.warn( 'THREE.WebGLRenderer: .initMaterial() has been removed.' );
  1051. },
  1052. addPrePlugin: function () {
  1053. console.warn( 'THREE.WebGLRenderer: .addPrePlugin() has been removed.' );
  1054. },
  1055. addPostPlugin: function () {
  1056. console.warn( 'THREE.WebGLRenderer: .addPostPlugin() has been removed.' );
  1057. },
  1058. updateShadowMap: function () {
  1059. console.warn( 'THREE.WebGLRenderer: .updateShadowMap() has been removed.' );
  1060. },
  1061. setFaceCulling: function () {
  1062. console.warn( 'THREE.WebGLRenderer: .setFaceCulling() has been removed.' );
  1063. },
  1064. allocTextureUnit: function () {
  1065. console.warn( 'THREE.WebGLRenderer: .allocTextureUnit() has been removed.' );
  1066. },
  1067. setTexture: function () {
  1068. console.warn( 'THREE.WebGLRenderer: .setTexture() has been removed.' );
  1069. },
  1070. setTexture2D: function () {
  1071. console.warn( 'THREE.WebGLRenderer: .setTexture2D() has been removed.' );
  1072. },
  1073. setTextureCube: function () {
  1074. console.warn( 'THREE.WebGLRenderer: .setTextureCube() has been removed.' );
  1075. },
  1076. getActiveMipMapLevel: function () {
  1077. console.warn( 'THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel().' );
  1078. return this.getActiveMipmapLevel();
  1079. }
  1080. } );
  1081. Object.defineProperties( WebGLRenderer.prototype, {
  1082. shadowMapEnabled: {
  1083. get: function () {
  1084. return this.shadowMap.enabled;
  1085. },
  1086. set: function ( value ) {
  1087. console.warn( 'THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.' );
  1088. this.shadowMap.enabled = value;
  1089. }
  1090. },
  1091. shadowMapType: {
  1092. get: function () {
  1093. return this.shadowMap.type;
  1094. },
  1095. set: function ( value ) {
  1096. console.warn( 'THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.' );
  1097. this.shadowMap.type = value;
  1098. }
  1099. },
  1100. shadowMapCullFace: {
  1101. get: function () {
  1102. console.warn( 'THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.' );
  1103. return undefined;
  1104. },
  1105. set: function ( /* value */ ) {
  1106. console.warn( 'THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.' );
  1107. }
  1108. },
  1109. context: {
  1110. get: function () {
  1111. console.warn( 'THREE.WebGLRenderer: .context has been removed. Use .getContext() instead.' );
  1112. return this.getContext();
  1113. }
  1114. },
  1115. vr: {
  1116. get: function () {
  1117. console.warn( 'THREE.WebGLRenderer: .vr has been renamed to .xr' );
  1118. return this.xr;
  1119. }
  1120. },
  1121. gammaInput: {
  1122. get: function () {
  1123. console.warn( 'THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.' );
  1124. return false;
  1125. },
  1126. set: function () {
  1127. console.warn( 'THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.' );
  1128. }
  1129. },
  1130. gammaOutput: {
  1131. get: function () {
  1132. console.warn( 'THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.' );
  1133. return false;
  1134. },
  1135. set: function ( value ) {
  1136. console.warn( 'THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.' );
  1137. this.outputEncoding = ( value === true ) ? sRGBEncoding : LinearEncoding;
  1138. }
  1139. }
  1140. } );
  1141. Object.defineProperties( WebGLShadowMap.prototype, {
  1142. cullFace: {
  1143. get: function () {
  1144. console.warn( 'THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.' );
  1145. return undefined;
  1146. },
  1147. set: function ( /* cullFace */ ) {
  1148. console.warn( 'THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.' );
  1149. }
  1150. },
  1151. renderReverseSided: {
  1152. get: function () {
  1153. console.warn( 'THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.' );
  1154. return undefined;
  1155. },
  1156. set: function () {
  1157. console.warn( 'THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.' );
  1158. }
  1159. },
  1160. renderSingleSided: {
  1161. get: function () {
  1162. console.warn( 'THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.' );
  1163. return undefined;
  1164. },
  1165. set: function () {
  1166. console.warn( 'THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.' );
  1167. }
  1168. }
  1169. } );
  1170. export function WebGLRenderTargetCube( width, height, options ) {
  1171. console.warn( 'THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options ).' );
  1172. return new WebGLCubeRenderTarget( width, options );
  1173. }
  1174. //
  1175. Object.defineProperties( WebGLRenderTarget.prototype, {
  1176. wrapS: {
  1177. get: function () {
  1178. console.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' );
  1179. return this.texture.wrapS;
  1180. },
  1181. set: function ( value ) {
  1182. console.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' );
  1183. this.texture.wrapS = value;
  1184. }
  1185. },
  1186. wrapT: {
  1187. get: function () {
  1188. console.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' );
  1189. return this.texture.wrapT;
  1190. },
  1191. set: function ( value ) {
  1192. console.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' );
  1193. this.texture.wrapT = value;
  1194. }
  1195. },
  1196. magFilter: {
  1197. get: function () {
  1198. console.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' );
  1199. return this.texture.magFilter;
  1200. },
  1201. set: function ( value ) {
  1202. console.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' );
  1203. this.texture.magFilter = value;
  1204. }
  1205. },
  1206. minFilter: {
  1207. get: function () {
  1208. console.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' );
  1209. return this.texture.minFilter;
  1210. },
  1211. set: function ( value ) {
  1212. console.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' );
  1213. this.texture.minFilter = value;
  1214. }
  1215. },
  1216. anisotropy: {
  1217. get: function () {
  1218. console.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' );
  1219. return this.texture.anisotropy;
  1220. },
  1221. set: function ( value ) {
  1222. console.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' );
  1223. this.texture.anisotropy = value;
  1224. }
  1225. },
  1226. offset: {
  1227. get: function () {
  1228. console.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' );
  1229. return this.texture.offset;
  1230. },
  1231. set: function ( value ) {
  1232. console.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' );
  1233. this.texture.offset = value;
  1234. }
  1235. },
  1236. repeat: {
  1237. get: function () {
  1238. console.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' );
  1239. return this.texture.repeat;
  1240. },
  1241. set: function ( value ) {
  1242. console.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' );
  1243. this.texture.repeat = value;
  1244. }
  1245. },
  1246. format: {
  1247. get: function () {
  1248. console.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' );
  1249. return this.texture.format;
  1250. },
  1251. set: function ( value ) {
  1252. console.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' );
  1253. this.texture.format = value;
  1254. }
  1255. },
  1256. type: {
  1257. get: function () {
  1258. console.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' );
  1259. return this.texture.type;
  1260. },
  1261. set: function ( value ) {
  1262. console.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' );
  1263. this.texture.type = value;
  1264. }
  1265. },
  1266. generateMipmaps: {
  1267. get: function () {
  1268. console.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' );
  1269. return this.texture.generateMipmaps;
  1270. },
  1271. set: function ( value ) {
  1272. console.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' );
  1273. this.texture.generateMipmaps = value;
  1274. }
  1275. }
  1276. } );
  1277. //
  1278. Object.defineProperties( Audio.prototype, {
  1279. load: {
  1280. value: function ( file ) {
  1281. console.warn( 'THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.' );
  1282. var scope = this;
  1283. var audioLoader = new AudioLoader();
  1284. audioLoader.load( file, function ( buffer ) {
  1285. scope.setBuffer( buffer );
  1286. } );
  1287. return this;
  1288. }
  1289. },
  1290. startTime: {
  1291. set: function () {
  1292. console.warn( 'THREE.Audio: .startTime is now .play( delay ).' );
  1293. }
  1294. }
  1295. } );
  1296. AudioAnalyser.prototype.getData = function () {
  1297. console.warn( 'THREE.AudioAnalyser: .getData() is now .getFrequencyData().' );
  1298. return this.getFrequencyData();
  1299. };
  1300. //
  1301. CubeCamera.prototype.updateCubeMap = function ( renderer, scene ) {
  1302. console.warn( 'THREE.CubeCamera: .updateCubeMap() is now .update().' );
  1303. return this.update( renderer, scene );
  1304. };
  1305. //
  1306. export var GeometryUtils = {
  1307. merge: function ( geometry1, geometry2, materialIndexOffset ) {
  1308. console.warn( 'THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.' );
  1309. var matrix;
  1310. if ( geometry2.isMesh ) {
  1311. geometry2.matrixAutoUpdate && geometry2.updateMatrix();
  1312. matrix = geometry2.matrix;
  1313. geometry2 = geometry2.geometry;
  1314. }
  1315. geometry1.merge( geometry2, matrix, materialIndexOffset );
  1316. },
  1317. center: function ( geometry ) {
  1318. console.warn( 'THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.' );
  1319. return geometry.center();
  1320. }
  1321. };
  1322. ImageUtils.crossOrigin = undefined;
  1323. ImageUtils.loadTexture = function ( url, mapping, onLoad, onError ) {
  1324. console.warn( 'THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.' );
  1325. var loader = new TextureLoader();
  1326. loader.setCrossOrigin( this.crossOrigin );
  1327. var texture = loader.load( url, onLoad, undefined, onError );
  1328. if ( mapping ) texture.mapping = mapping;
  1329. return texture;
  1330. };
  1331. ImageUtils.loadTextureCube = function ( urls, mapping, onLoad, onError ) {
  1332. console.warn( 'THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.' );
  1333. var loader = new CubeTextureLoader();
  1334. loader.setCrossOrigin( this.crossOrigin );
  1335. var texture = loader.load( urls, onLoad, undefined, onError );
  1336. if ( mapping ) texture.mapping = mapping;
  1337. return texture;
  1338. };
  1339. ImageUtils.loadCompressedTexture = function () {
  1340. console.error( 'THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.' );
  1341. };
  1342. ImageUtils.loadCompressedTextureCube = function () {
  1343. console.error( 'THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.' );
  1344. };
  1345. //
  1346. export function CanvasRenderer() {
  1347. console.error( 'THREE.CanvasRenderer has been removed' );
  1348. }
  1349. //
  1350. export function JSONLoader() {
  1351. console.error( 'THREE.JSONLoader has been removed.' );
  1352. }
  1353. //
  1354. export var SceneUtils = {
  1355. createMultiMaterialObject: function ( /* geometry, materials */ ) {
  1356. console.error( 'THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js' );
  1357. },
  1358. detach: function ( /* child, parent, scene */ ) {
  1359. console.error( 'THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js' );
  1360. },
  1361. attach: function ( /* child, scene, parent */ ) {
  1362. console.error( 'THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js' );
  1363. }
  1364. };
  1365. //
  1366. export function LensFlare() {
  1367. console.error( 'THREE.LensFlare has been moved to /examples/js/objects/Lensflare.js' );
  1368. }