2
0

Three.Legacy.js 52 KB

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