Three.Legacy.js 34 KB

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