Three.Legacy.js 52 KB

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