Three.Legacy.js 54 KB

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