1
0

Three.Legacy.js 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496
  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 { CullFaceFront, CullFaceBack } from './constants.js';
  8. import {
  9. Float64BufferAttribute,
  10. Float32BufferAttribute,
  11. Uint32BufferAttribute,
  12. Int32BufferAttribute,
  13. Uint16BufferAttribute,
  14. Int16BufferAttribute,
  15. Uint8ClampedBufferAttribute,
  16. Uint8BufferAttribute,
  17. Int8BufferAttribute,
  18. BufferAttribute
  19. } from './core/BufferAttribute.js';
  20. import { BufferGeometry } from './core/BufferGeometry.js';
  21. import { Face3 } from './core/Face3.js';
  22. import { Geometry } from './core/Geometry';
  23. import { Object3D } from './core/Object3D.js';
  24. import { Uniform } from './core/Uniform';
  25. import { Curve } from './extras/core/Curve.js';
  26. import { CatmullRomCurve3 } from './extras/curves/CatmullRomCurve3.js';
  27. import { BoxHelper } from './helpers/BoxHelper';
  28. import { GridHelper } from './helpers/GridHelper.js';
  29. import { BoxGeometry } from './geometries/BoxGeometry.js';
  30. import { EdgesGeometry } from './geometries/EdgesGeometry.js';
  31. import { ExtrudeGeometry } from './geometries/ExtrudeGeometry.js';
  32. import { ShapeGeometry } from './geometries/ShapeGeometry.js';
  33. import { WireframeGeometry } from './geometries/WireframeGeometry.js';
  34. import { Light } from './lights/Light.js';
  35. import { FileLoader } from './loaders/FileLoader.js';
  36. import { AudioLoader } from './loaders/AudioLoader.js';
  37. import { CubeTextureLoader } from './loaders/CubeTextureLoader.js';
  38. import { DataTextureLoader } from './loaders/DataTextureLoader.js';
  39. import { TextureLoader } from './loaders/TextureLoader.js';
  40. import { Material } from './materials/Material.js';
  41. import { LineBasicMaterial } from './materials/LineBasicMaterial.js';
  42. import { MeshPhongMaterial } from './materials/MeshPhongMaterial.js';
  43. import { PointsMaterial } from './materials/PointsMaterial.js';
  44. import { ShaderMaterial } from './materials/ShaderMaterial.js';
  45. import { Box2 } from './math/Box2.js';
  46. import { Box3 } from './math/Box3.js';
  47. import { Color } from './math/Color.js';
  48. import { Line3 } from './math/Line3.js';
  49. import { _Math } from './math/Math.js';
  50. import { Matrix3 } from './math/Matrix3.js';
  51. import { Matrix4 } from './math/Matrix4.js';
  52. import { Plane } from './math/Plane.js';
  53. import { Quaternion } from './math/Quaternion.js';
  54. import { Ray } from './math/Ray.js';
  55. import { Vector2 } from './math/Vector2.js';
  56. import { Vector3 } from './math/Vector3.js';
  57. import { Vector4 } from './math/Vector4.js';
  58. import { LineSegments } from './objects/LineSegments.js';
  59. import { LOD } from './objects/LOD.js';
  60. import { Points } from './objects/Points.js';
  61. import { Sprite } from './objects/Sprite.js';
  62. import { Skeleton } from './objects/Skeleton.js';
  63. import { WebGLRenderer } from './renderers/WebGLRenderer.js';
  64. import { WebGLRenderTarget } from './renderers/WebGLRenderTarget.js';
  65. import { WebGLShadowMap } from './renderers/webgl/WebGLShadowMap.js';
  66. import { Shape } from './extras/core/Shape.js';
  67. export { BoxGeometry as CubeGeometry };
  68. export function Face4( a, b, c, d, normal, color, materialIndex ) {
  69. console.warn( 'THREE.Face4 has been removed. A THREE.Face3 will be created instead.' );
  70. return new Face3( a, b, c, normal, color, materialIndex );
  71. }
  72. export var LineStrip = 0;
  73. export var LinePieces = 1;
  74. export function MeshFaceMaterial( materials ) {
  75. console.warn( 'THREE.MeshFaceMaterial has been removed. Use an Array instead.' );
  76. return materials;
  77. }
  78. export function MultiMaterial( materials ) {
  79. if ( materials === undefined ) materials = [];
  80. console.warn( 'THREE.MultiMaterial has been removed. Use an Array instead.' );
  81. materials.isMultiMaterial = true;
  82. materials.materials = materials;
  83. materials.clone = function () {
  84. return materials.slice();
  85. };
  86. return materials;
  87. }
  88. export function PointCloud( geometry, material ) {
  89. console.warn( 'THREE.PointCloud has been renamed to THREE.Points.' );
  90. return new Points( geometry, material );
  91. }
  92. export function Particle( material ) {
  93. console.warn( 'THREE.Particle has been renamed to THREE.Sprite.' );
  94. return new Sprite( material );
  95. }
  96. export function ParticleSystem( geometry, material ) {
  97. console.warn( 'THREE.ParticleSystem has been renamed to THREE.Points.' );
  98. return new Points( geometry, material );
  99. }
  100. export function PointCloudMaterial( parameters ) {
  101. console.warn( 'THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.' );
  102. return new PointsMaterial( parameters );
  103. }
  104. export function ParticleBasicMaterial( parameters ) {
  105. console.warn( 'THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.' );
  106. return new PointsMaterial( parameters );
  107. }
  108. export function ParticleSystemMaterial( parameters ) {
  109. console.warn( 'THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.' );
  110. return new PointsMaterial( parameters );
  111. }
  112. export function Vertex( x, y, z ) {
  113. console.warn( 'THREE.Vertex has been removed. Use THREE.Vector3 instead.' );
  114. return new Vector3( x, y, z );
  115. }
  116. //
  117. export function DynamicBufferAttribute( array, itemSize ) {
  118. console.warn( 'THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead.' );
  119. return new BufferAttribute( array, itemSize ).setDynamic( true );
  120. }
  121. export function Int8Attribute( array, itemSize ) {
  122. console.warn( 'THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead.' );
  123. return new Int8BufferAttribute( array, itemSize );
  124. }
  125. export function Uint8Attribute( array, itemSize ) {
  126. console.warn( 'THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead.' );
  127. return new Uint8BufferAttribute( array, itemSize );
  128. }
  129. export function Uint8ClampedAttribute( array, itemSize ) {
  130. console.warn( 'THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead.' );
  131. return new Uint8ClampedBufferAttribute( array, itemSize );
  132. }
  133. export function Int16Attribute( array, itemSize ) {
  134. console.warn( 'THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead.' );
  135. return new Int16BufferAttribute( array, itemSize );
  136. }
  137. export function Uint16Attribute( array, itemSize ) {
  138. console.warn( 'THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead.' );
  139. return new Uint16BufferAttribute( array, itemSize );
  140. }
  141. export function Int32Attribute( array, itemSize ) {
  142. console.warn( 'THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead.' );
  143. return new Int32BufferAttribute( array, itemSize );
  144. }
  145. export function Uint32Attribute( array, itemSize ) {
  146. console.warn( 'THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead.' );
  147. return new Uint32BufferAttribute( array, itemSize );
  148. }
  149. export function Float32Attribute( array, itemSize ) {
  150. console.warn( 'THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead.' );
  151. return new Float32BufferAttribute( array, itemSize );
  152. }
  153. export function Float64Attribute( array, itemSize ) {
  154. console.warn( 'THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead.' );
  155. return new Float64BufferAttribute( array, itemSize );
  156. }
  157. //
  158. Curve.create = function ( construct, getPoint ) {
  159. console.log( 'THREE.Curve.create() has been deprecated' );
  160. construct.prototype = Object.create( Curve.prototype );
  161. construct.prototype.constructor = construct;
  162. construct.prototype.getPoint = getPoint;
  163. return construct;
  164. };
  165. //
  166. export function ClosedSplineCurve3( points ) {
  167. console.warn( 'THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.' );
  168. CatmullRomCurve3.call( this, points );
  169. this.type = 'catmullrom';
  170. this.closed = true;
  171. }
  172. ClosedSplineCurve3.prototype = Object.create( CatmullRomCurve3.prototype );
  173. //
  174. export function SplineCurve3( points ) {
  175. console.warn( 'THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.' );
  176. CatmullRomCurve3.call( this, points );
  177. this.type = 'catmullrom';
  178. }
  179. SplineCurve3.prototype = Object.create( CatmullRomCurve3.prototype );
  180. //
  181. export function Spline( points ) {
  182. console.warn( 'THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.' );
  183. CatmullRomCurve3.call( this, points );
  184. this.type = 'catmullrom';
  185. }
  186. Spline.prototype = Object.create( CatmullRomCurve3.prototype );
  187. Object.assign( Spline.prototype, {
  188. initFromArray: function ( a ) {
  189. console.error( 'THREE.Spline: .initFromArray() has been removed.' );
  190. },
  191. getControlPointsArray: function ( optionalTarget ) {
  192. console.error( 'THREE.Spline: .getControlPointsArray() has been removed.' );
  193. },
  194. reparametrizeByArcLength: function ( samplingCoef ) {
  195. console.error( 'THREE.Spline: .reparametrizeByArcLength() has been removed.' );
  196. }
  197. } );
  198. //
  199. export function BoundingBoxHelper( object, color ) {
  200. console.warn( 'THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead.' );
  201. return new BoxHelper( object, color );
  202. }
  203. export function EdgesHelper( object, hex ) {
  204. console.warn( 'THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead.' );
  205. return new LineSegments( new EdgesGeometry( object.geometry ), new LineBasicMaterial( { color: hex !== undefined ? hex : 0xffffff } ) );
  206. }
  207. GridHelper.prototype.setColors = function () {
  208. console.error( 'THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.' );
  209. };
  210. export function WireframeHelper( object, hex ) {
  211. console.warn( 'THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead.' );
  212. return new LineSegments( new WireframeGeometry( object.geometry ), new LineBasicMaterial( { color: hex !== undefined ? hex : 0xffffff } ) );
  213. }
  214. //
  215. export function XHRLoader( manager ) {
  216. console.warn( 'THREE.XHRLoader has been renamed to THREE.FileLoader.' );
  217. return new FileLoader( manager );
  218. }
  219. export function BinaryTextureLoader( manager ) {
  220. console.warn( 'THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader.' );
  221. return new DataTextureLoader( manager );
  222. }
  223. //
  224. Object.assign( Box2.prototype, {
  225. center: function ( optionalTarget ) {
  226. console.warn( 'THREE.Box2: .center() has been renamed to .getCenter().' );
  227. return this.getCenter( optionalTarget );
  228. },
  229. empty: function () {
  230. console.warn( 'THREE.Box2: .empty() has been renamed to .isEmpty().' );
  231. return this.isEmpty();
  232. },
  233. isIntersectionBox: function ( box ) {
  234. console.warn( 'THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().' );
  235. return this.intersectsBox( box );
  236. },
  237. size: function ( optionalTarget ) {
  238. console.warn( 'THREE.Box2: .size() has been renamed to .getSize().' );
  239. return this.getSize( optionalTarget );
  240. }
  241. } );
  242. Object.assign( Box3.prototype, {
  243. center: function ( optionalTarget ) {
  244. console.warn( 'THREE.Box3: .center() has been renamed to .getCenter().' );
  245. return this.getCenter( optionalTarget );
  246. },
  247. empty: function () {
  248. console.warn( 'THREE.Box3: .empty() has been renamed to .isEmpty().' );
  249. return this.isEmpty();
  250. },
  251. isIntersectionBox: function ( box ) {
  252. console.warn( 'THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().' );
  253. return this.intersectsBox( box );
  254. },
  255. isIntersectionSphere: function ( sphere ) {
  256. console.warn( 'THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().' );
  257. return this.intersectsSphere( sphere );
  258. },
  259. size: function ( optionalTarget ) {
  260. console.warn( 'THREE.Box3: .size() has been renamed to .getSize().' );
  261. return this.getSize( optionalTarget );
  262. }
  263. } );
  264. Line3.prototype.center = function ( optionalTarget ) {
  265. console.warn( 'THREE.Line3: .center() has been renamed to .getCenter().' );
  266. return this.getCenter( optionalTarget );
  267. };
  268. _Math.random16 = function () {
  269. console.warn( 'THREE.Math.random16() has been deprecated. Use Math.random() instead.' );
  270. return Math.random();
  271. };
  272. Object.assign( Matrix3.prototype, {
  273. flattenToArrayOffset: function ( array, offset ) {
  274. console.warn( "THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead." );
  275. return this.toArray( array, offset );
  276. },
  277. multiplyVector3: function ( vector ) {
  278. console.warn( 'THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.' );
  279. return vector.applyMatrix3( this );
  280. },
  281. multiplyVector3Array: function ( a ) {
  282. console.warn( 'THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' );
  283. return this.applyToVector3Array( a );
  284. },
  285. applyToBuffer: function( buffer, offset, length ) {
  286. console.warn( 'THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.' );
  287. return this.applyToBufferAttribute( buffer );
  288. },
  289. applyToVector3Array: function( array, offset, length ) {
  290. console.error( 'THREE.Matrix3: .applyToVector3Array() has been removed.' );
  291. }
  292. } );
  293. Object.assign( Matrix4.prototype, {
  294. extractPosition: function ( m ) {
  295. console.warn( 'THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().' );
  296. return this.copyPosition( m );
  297. },
  298. flattenToArrayOffset: function ( array, offset ) {
  299. console.warn( "THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead." );
  300. return this.toArray( array, offset );
  301. },
  302. getPosition: function () {
  303. var v1;
  304. return function getPosition() {
  305. if ( v1 === undefined ) v1 = new Vector3();
  306. console.warn( 'THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.' );
  307. return v1.setFromMatrixColumn( this, 3 );
  308. };
  309. }(),
  310. setRotationFromQuaternion: function ( q ) {
  311. console.warn( 'THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().' );
  312. return this.makeRotationFromQuaternion( q );
  313. },
  314. multiplyToArray: function () {
  315. console.warn( 'THREE.Matrix4: .multiplyToArray() has been removed.' );
  316. },
  317. multiplyVector3: function ( vector ) {
  318. console.warn( 'THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.' );
  319. return vector.applyMatrix4( this );
  320. },
  321. multiplyVector4: function ( vector ) {
  322. console.warn( 'THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.' );
  323. return vector.applyMatrix4( this );
  324. },
  325. multiplyVector3Array: function ( a ) {
  326. console.warn( 'THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' );
  327. return this.applyToVector3Array( a );
  328. },
  329. rotateAxis: function ( v ) {
  330. console.warn( 'THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.' );
  331. v.transformDirection( this );
  332. },
  333. crossVector: function ( vector ) {
  334. console.warn( 'THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.' );
  335. return vector.applyMatrix4( this );
  336. },
  337. translate: function () {
  338. console.error( 'THREE.Matrix4: .translate() has been removed.' );
  339. },
  340. rotateX: function () {
  341. console.error( 'THREE.Matrix4: .rotateX() has been removed.' );
  342. },
  343. rotateY: function () {
  344. console.error( 'THREE.Matrix4: .rotateY() has been removed.' );
  345. },
  346. rotateZ: function () {
  347. console.error( 'THREE.Matrix4: .rotateZ() has been removed.' );
  348. },
  349. rotateByAxis: function () {
  350. console.error( 'THREE.Matrix4: .rotateByAxis() has been removed.' );
  351. },
  352. applyToBuffer: function( buffer, offset, length ) {
  353. console.warn( 'THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.' );
  354. return this.applyToBufferAttribute( buffer );
  355. },
  356. applyToVector3Array: function( array, offset, length ) {
  357. console.error( 'THREE.Matrix4: .applyToVector3Array() has been removed.' );
  358. },
  359. makeFrustum: function( left, right, bottom, top, near, far ) {
  360. console.warn( 'THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.' );
  361. return this.makePerspective( left, right, top, bottom, near, far );
  362. }
  363. } );
  364. Plane.prototype.isIntersectionLine = function ( line ) {
  365. console.warn( 'THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().' );
  366. return this.intersectsLine( line );
  367. };
  368. Quaternion.prototype.multiplyVector3 = function ( vector ) {
  369. console.warn( 'THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.' );
  370. return vector.applyQuaternion( this );
  371. };
  372. Object.assign( Ray.prototype, {
  373. isIntersectionBox: function ( box ) {
  374. console.warn( 'THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().' );
  375. return this.intersectsBox( box );
  376. },
  377. isIntersectionPlane: function ( plane ) {
  378. console.warn( 'THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().' );
  379. return this.intersectsPlane( plane );
  380. },
  381. isIntersectionSphere: function ( sphere ) {
  382. console.warn( 'THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().' );
  383. return this.intersectsSphere( sphere );
  384. }
  385. } );
  386. Object.assign( Shape.prototype, {
  387. extrude: function ( options ) {
  388. console.warn( 'THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.' );
  389. return new ExtrudeGeometry( this, options );
  390. },
  391. makeGeometry: function ( options ) {
  392. console.warn( 'THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.' );
  393. return new ShapeGeometry( this, options );
  394. }
  395. } );
  396. Object.assign( Vector2.prototype, {
  397. fromAttribute: function ( attribute, index, offset ) {
  398. console.error( 'THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().' );
  399. return this.fromBufferAttribute( attribute, index, offset );
  400. }
  401. } );
  402. Object.assign( Vector3.prototype, {
  403. setEulerFromRotationMatrix: function () {
  404. console.error( 'THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.' );
  405. },
  406. setEulerFromQuaternion: function () {
  407. console.error( 'THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.' );
  408. },
  409. getPositionFromMatrix: function ( m ) {
  410. console.warn( 'THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().' );
  411. return this.setFromMatrixPosition( m );
  412. },
  413. getScaleFromMatrix: function ( m ) {
  414. console.warn( 'THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().' );
  415. return this.setFromMatrixScale( m );
  416. },
  417. getColumnFromMatrix: function ( index, matrix ) {
  418. console.warn( 'THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().' );
  419. return this.setFromMatrixColumn( matrix, index );
  420. },
  421. applyProjection: function ( m ) {
  422. console.warn( 'THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.' );
  423. return this.applyMatrix4( m );
  424. },
  425. fromAttribute: function ( attribute, index, offset ) {
  426. console.error( 'THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().' );
  427. return this.fromBufferAttribute( attribute, index, offset );
  428. }
  429. } );
  430. Object.assign( Vector4.prototype, {
  431. fromAttribute: function ( attribute, index, offset ) {
  432. console.error( 'THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().' );
  433. return this.fromBufferAttribute( attribute, index, offset );
  434. }
  435. } );
  436. //
  437. Geometry.prototype.computeTangents = function () {
  438. console.warn( 'THREE.Geometry: .computeTangents() has been removed.' );
  439. };
  440. Object.assign( Object3D.prototype, {
  441. getChildByName: function ( name ) {
  442. console.warn( 'THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().' );
  443. return this.getObjectByName( name );
  444. },
  445. renderDepth: function () {
  446. console.warn( 'THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.' );
  447. },
  448. translate: function ( distance, axis ) {
  449. console.warn( 'THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.' );
  450. return this.translateOnAxis( axis, distance );
  451. }
  452. } );
  453. Object.defineProperties( Object3D.prototype, {
  454. eulerOrder: {
  455. get: function () {
  456. console.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' );
  457. return this.rotation.order;
  458. },
  459. set: function ( value ) {
  460. console.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' );
  461. this.rotation.order = value;
  462. }
  463. },
  464. useQuaternion: {
  465. get: function () {
  466. console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );
  467. },
  468. set: function () {
  469. console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );
  470. }
  471. }
  472. } );
  473. Object.defineProperties( LOD.prototype, {
  474. objects: {
  475. get: function () {
  476. console.warn( 'THREE.LOD: .objects has been renamed to .levels.' );
  477. return this.levels;
  478. }
  479. }
  480. } );
  481. Object.defineProperty( Skeleton.prototype, 'useVertexTexture', {
  482. get: function () {
  483. console.warn( 'THREE.Skeleton: useVertexTexture has been removed.' );
  484. },
  485. set: function () {
  486. console.warn( 'THREE.Skeleton: useVertexTexture has been removed.' );
  487. }
  488. } );
  489. //
  490. PerspectiveCamera.prototype.setLens = function ( focalLength, filmGauge ) {
  491. console.warn( "THREE.PerspectiveCamera.setLens is deprecated. " +
  492. "Use .setFocalLength and .filmGauge for a photographic setup." );
  493. if ( filmGauge !== undefined ) this.filmGauge = filmGauge;
  494. this.setFocalLength( focalLength );
  495. };
  496. //
  497. Object.defineProperties( Light.prototype, {
  498. onlyShadow: {
  499. set: function () {
  500. console.warn( 'THREE.Light: .onlyShadow has been removed.' );
  501. }
  502. },
  503. shadowCameraFov: {
  504. set: function ( value ) {
  505. console.warn( 'THREE.Light: .shadowCameraFov is now .shadow.camera.fov.' );
  506. this.shadow.camera.fov = value;
  507. }
  508. },
  509. shadowCameraLeft: {
  510. set: function ( value ) {
  511. console.warn( 'THREE.Light: .shadowCameraLeft is now .shadow.camera.left.' );
  512. this.shadow.camera.left = value;
  513. }
  514. },
  515. shadowCameraRight: {
  516. set: function ( value ) {
  517. console.warn( 'THREE.Light: .shadowCameraRight is now .shadow.camera.right.' );
  518. this.shadow.camera.right = value;
  519. }
  520. },
  521. shadowCameraTop: {
  522. set: function ( value ) {
  523. console.warn( 'THREE.Light: .shadowCameraTop is now .shadow.camera.top.' );
  524. this.shadow.camera.top = value;
  525. }
  526. },
  527. shadowCameraBottom: {
  528. set: function ( value ) {
  529. console.warn( 'THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.' );
  530. this.shadow.camera.bottom = value;
  531. }
  532. },
  533. shadowCameraNear: {
  534. set: function ( value ) {
  535. console.warn( 'THREE.Light: .shadowCameraNear is now .shadow.camera.near.' );
  536. this.shadow.camera.near = value;
  537. }
  538. },
  539. shadowCameraFar: {
  540. set: function ( value ) {
  541. console.warn( 'THREE.Light: .shadowCameraFar is now .shadow.camera.far.' );
  542. this.shadow.camera.far = value;
  543. }
  544. },
  545. shadowCameraVisible: {
  546. set: function () {
  547. console.warn( 'THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.' );
  548. }
  549. },
  550. shadowBias: {
  551. set: function ( value ) {
  552. console.warn( 'THREE.Light: .shadowBias is now .shadow.bias.' );
  553. this.shadow.bias = value;
  554. }
  555. },
  556. shadowDarkness: {
  557. set: function () {
  558. console.warn( 'THREE.Light: .shadowDarkness has been removed.' );
  559. }
  560. },
  561. shadowMapWidth: {
  562. set: function ( value ) {
  563. console.warn( 'THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.' );
  564. this.shadow.mapSize.width = value;
  565. }
  566. },
  567. shadowMapHeight: {
  568. set: function ( value ) {
  569. console.warn( 'THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.' );
  570. this.shadow.mapSize.height = value;
  571. }
  572. }
  573. } );
  574. //
  575. Object.defineProperties( BufferAttribute.prototype, {
  576. length: {
  577. get: function () {
  578. console.warn( 'THREE.BufferAttribute: .length has been deprecated. Use .count instead.' );
  579. return this.array.length;
  580. }
  581. }
  582. } );
  583. Object.assign( BufferGeometry.prototype, {
  584. addIndex: function ( index ) {
  585. console.warn( 'THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().' );
  586. this.setIndex( index );
  587. },
  588. addDrawCall: function ( start, count, indexOffset ) {
  589. if ( indexOffset !== undefined ) {
  590. console.warn( 'THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.' );
  591. }
  592. console.warn( 'THREE.BufferGeometry: .addDrawCall() is now .addGroup().' );
  593. this.addGroup( start, count );
  594. },
  595. clearDrawCalls: function () {
  596. console.warn( 'THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().' );
  597. this.clearGroups();
  598. },
  599. computeTangents: function () {
  600. console.warn( 'THREE.BufferGeometry: .computeTangents() has been removed.' );
  601. },
  602. computeOffsets: function () {
  603. console.warn( 'THREE.BufferGeometry: .computeOffsets() has been removed.' );
  604. }
  605. } );
  606. Object.defineProperties( BufferGeometry.prototype, {
  607. drawcalls: {
  608. get: function () {
  609. console.error( 'THREE.BufferGeometry: .drawcalls has been renamed to .groups.' );
  610. return this.groups;
  611. }
  612. },
  613. offsets: {
  614. get: function () {
  615. console.warn( 'THREE.BufferGeometry: .offsets has been renamed to .groups.' );
  616. return this.groups;
  617. }
  618. }
  619. } );
  620. //
  621. Object.defineProperties( Uniform.prototype, {
  622. dynamic: {
  623. set: function () {
  624. console.warn( 'THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.' );
  625. }
  626. },
  627. onUpdate: {
  628. value: function () {
  629. console.warn( 'THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.' );
  630. return this;
  631. }
  632. }
  633. } );
  634. //
  635. Object.defineProperties( Material.prototype, {
  636. wrapAround: {
  637. get: function () {
  638. console.warn( 'THREE.Material: .wrapAround has been removed.' );
  639. },
  640. set: function () {
  641. console.warn( 'THREE.Material: .wrapAround has been removed.' );
  642. }
  643. },
  644. wrapRGB: {
  645. get: function () {
  646. console.warn( 'THREE.Material: .wrapRGB has been removed.' );
  647. return new Color();
  648. }
  649. }
  650. } );
  651. Object.defineProperties( MeshPhongMaterial.prototype, {
  652. metal: {
  653. get: function () {
  654. console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.' );
  655. return false;
  656. },
  657. set: function () {
  658. console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead' );
  659. }
  660. }
  661. } );
  662. Object.defineProperties( ShaderMaterial.prototype, {
  663. derivatives: {
  664. get: function () {
  665. console.warn( 'THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' );
  666. return this.extensions.derivatives;
  667. },
  668. set: function ( value ) {
  669. console.warn( 'THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' );
  670. this.extensions.derivatives = value;
  671. }
  672. }
  673. } );
  674. //
  675. Object.assign( WebGLRenderer.prototype, {
  676. getCurrentRenderTarget: function () {
  677. console.warn( 'THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget().' );
  678. return this.getRenderTarget();
  679. },
  680. supportsFloatTextures: function () {
  681. console.warn( 'THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \'OES_texture_float\' ).' );
  682. return this.extensions.get( 'OES_texture_float' );
  683. },
  684. supportsHalfFloatTextures: function () {
  685. console.warn( 'THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \'OES_texture_half_float\' ).' );
  686. return this.extensions.get( 'OES_texture_half_float' );
  687. },
  688. supportsStandardDerivatives: function () {
  689. console.warn( 'THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \'OES_standard_derivatives\' ).' );
  690. return this.extensions.get( 'OES_standard_derivatives' );
  691. },
  692. supportsCompressedTextureS3TC: function () {
  693. console.warn( 'THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \'WEBGL_compressed_texture_s3tc\' ).' );
  694. return this.extensions.get( 'WEBGL_compressed_texture_s3tc' );
  695. },
  696. supportsCompressedTexturePVRTC: function () {
  697. console.warn( 'THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \'WEBGL_compressed_texture_pvrtc\' ).' );
  698. return this.extensions.get( 'WEBGL_compressed_texture_pvrtc' );
  699. },
  700. supportsBlendMinMax: function () {
  701. console.warn( 'THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \'EXT_blend_minmax\' ).' );
  702. return this.extensions.get( 'EXT_blend_minmax' );
  703. },
  704. supportsVertexTextures: function () {
  705. console.warn( 'THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.' );
  706. return this.capabilities.vertexTextures;
  707. },
  708. supportsInstancedArrays: function () {
  709. console.warn( 'THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \'ANGLE_instanced_arrays\' ).' );
  710. return this.extensions.get( 'ANGLE_instanced_arrays' );
  711. },
  712. enableScissorTest: function ( boolean ) {
  713. console.warn( 'THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().' );
  714. this.setScissorTest( boolean );
  715. },
  716. initMaterial: function () {
  717. console.warn( 'THREE.WebGLRenderer: .initMaterial() has been removed.' );
  718. },
  719. addPrePlugin: function () {
  720. console.warn( 'THREE.WebGLRenderer: .addPrePlugin() has been removed.' );
  721. },
  722. addPostPlugin: function () {
  723. console.warn( 'THREE.WebGLRenderer: .addPostPlugin() has been removed.' );
  724. },
  725. updateShadowMap: function () {
  726. console.warn( 'THREE.WebGLRenderer: .updateShadowMap() has been removed.' );
  727. }
  728. } );
  729. Object.defineProperties( WebGLRenderer.prototype, {
  730. shadowMapEnabled: {
  731. get: function () {
  732. return this.shadowMap.enabled;
  733. },
  734. set: function ( value ) {
  735. console.warn( 'THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.' );
  736. this.shadowMap.enabled = value;
  737. }
  738. },
  739. shadowMapType: {
  740. get: function () {
  741. return this.shadowMap.type;
  742. },
  743. set: function ( value ) {
  744. console.warn( 'THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.' );
  745. this.shadowMap.type = value;
  746. }
  747. },
  748. shadowMapCullFace: {
  749. get: function () {
  750. return this.shadowMap.cullFace;
  751. },
  752. set: function ( value ) {
  753. console.warn( 'THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.' );
  754. this.shadowMap.cullFace = value;
  755. }
  756. }
  757. } );
  758. Object.defineProperties( WebGLShadowMap.prototype, {
  759. cullFace: {
  760. get: function () {
  761. return this.renderReverseSided ? CullFaceFront : CullFaceBack;
  762. },
  763. set: function ( cullFace ) {
  764. var value = ( cullFace !== CullFaceBack );
  765. console.warn( "WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to " + value + "." );
  766. this.renderReverseSided = value;
  767. }
  768. }
  769. } );
  770. //
  771. Object.defineProperties( WebGLRenderTarget.prototype, {
  772. wrapS: {
  773. get: function () {
  774. console.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' );
  775. return this.texture.wrapS;
  776. },
  777. set: function ( value ) {
  778. console.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' );
  779. this.texture.wrapS = value;
  780. }
  781. },
  782. wrapT: {
  783. get: function () {
  784. console.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' );
  785. return this.texture.wrapT;
  786. },
  787. set: function ( value ) {
  788. console.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' );
  789. this.texture.wrapT = value;
  790. }
  791. },
  792. magFilter: {
  793. get: function () {
  794. console.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' );
  795. return this.texture.magFilter;
  796. },
  797. set: function ( value ) {
  798. console.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' );
  799. this.texture.magFilter = value;
  800. }
  801. },
  802. minFilter: {
  803. get: function () {
  804. console.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' );
  805. return this.texture.minFilter;
  806. },
  807. set: function ( value ) {
  808. console.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' );
  809. this.texture.minFilter = value;
  810. }
  811. },
  812. anisotropy: {
  813. get: function () {
  814. console.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' );
  815. return this.texture.anisotropy;
  816. },
  817. set: function ( value ) {
  818. console.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' );
  819. this.texture.anisotropy = value;
  820. }
  821. },
  822. offset: {
  823. get: function () {
  824. console.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' );
  825. return this.texture.offset;
  826. },
  827. set: function ( value ) {
  828. console.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' );
  829. this.texture.offset = value;
  830. }
  831. },
  832. repeat: {
  833. get: function () {
  834. console.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' );
  835. return this.texture.repeat;
  836. },
  837. set: function ( value ) {
  838. console.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' );
  839. this.texture.repeat = value;
  840. }
  841. },
  842. format: {
  843. get: function () {
  844. console.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' );
  845. return this.texture.format;
  846. },
  847. set: function ( value ) {
  848. console.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' );
  849. this.texture.format = value;
  850. }
  851. },
  852. type: {
  853. get: function () {
  854. console.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' );
  855. return this.texture.type;
  856. },
  857. set: function ( value ) {
  858. console.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' );
  859. this.texture.type = value;
  860. }
  861. },
  862. generateMipmaps: {
  863. get: function () {
  864. console.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' );
  865. return this.texture.generateMipmaps;
  866. },
  867. set: function ( value ) {
  868. console.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' );
  869. this.texture.generateMipmaps = value;
  870. }
  871. }
  872. } );
  873. //
  874. Audio.prototype.load = function ( file ) {
  875. console.warn( 'THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.' );
  876. var scope = this;
  877. var audioLoader = new AudioLoader();
  878. audioLoader.load( file, function ( buffer ) {
  879. scope.setBuffer( buffer );
  880. } );
  881. return this;
  882. };
  883. AudioAnalyser.prototype.getData = function () {
  884. console.warn( 'THREE.AudioAnalyser: .getData() is now .getFrequencyData().' );
  885. return this.getFrequencyData();
  886. };
  887. //
  888. export var GeometryUtils = {
  889. merge: function ( geometry1, geometry2, materialIndexOffset ) {
  890. console.warn( 'THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.' );
  891. var matrix;
  892. if ( geometry2.isMesh ) {
  893. geometry2.matrixAutoUpdate && geometry2.updateMatrix();
  894. matrix = geometry2.matrix;
  895. geometry2 = geometry2.geometry;
  896. }
  897. geometry1.merge( geometry2, matrix, materialIndexOffset );
  898. },
  899. center: function ( geometry ) {
  900. console.warn( 'THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.' );
  901. return geometry.center();
  902. }
  903. };
  904. export var ImageUtils = {
  905. crossOrigin: undefined,
  906. loadTexture: function ( url, mapping, onLoad, onError ) {
  907. console.warn( 'THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.' );
  908. var loader = new TextureLoader();
  909. loader.setCrossOrigin( this.crossOrigin );
  910. var texture = loader.load( url, onLoad, undefined, onError );
  911. if ( mapping ) texture.mapping = mapping;
  912. return texture;
  913. },
  914. loadTextureCube: function ( urls, mapping, onLoad, onError ) {
  915. console.warn( 'THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.' );
  916. var loader = new CubeTextureLoader();
  917. loader.setCrossOrigin( this.crossOrigin );
  918. var texture = loader.load( urls, onLoad, undefined, onError );
  919. if ( mapping ) texture.mapping = mapping;
  920. return texture;
  921. },
  922. loadCompressedTexture: function () {
  923. console.error( 'THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.' );
  924. },
  925. loadCompressedTextureCube: function () {
  926. console.error( 'THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.' );
  927. }
  928. };
  929. //
  930. export function Projector() {
  931. console.error( 'THREE.Projector has been moved to /examples/js/renderers/Projector.js.' );
  932. this.projectVector = function ( vector, camera ) {
  933. console.warn( 'THREE.Projector: .projectVector() is now vector.project().' );
  934. vector.project( camera );
  935. };
  936. this.unprojectVector = function ( vector, camera ) {
  937. console.warn( 'THREE.Projector: .unprojectVector() is now vector.unproject().' );
  938. vector.unproject( camera );
  939. };
  940. this.pickingRay = function () {
  941. console.error( 'THREE.Projector: .pickingRay() is now raycaster.setFromCamera().' );
  942. };
  943. }
  944. //
  945. export function CanvasRenderer() {
  946. console.error( 'THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js' );
  947. this.domElement = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' );
  948. this.clear = function () {};
  949. this.render = function () {};
  950. this.setClearColor = function () {};
  951. this.setSize = function () {};
  952. }
粤ICP备19079148号