Three.Legacy.js 53 KB

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