1
0

Three.Legacy.js 50 KB

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