Three.Legacy.js 52 KB

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