Three.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. var THREE = { REVISION: '72dev' };
  5. // browserify support
  6. if ( typeof module === 'object' ) {
  7. module.exports = THREE;
  8. }
  9. // polyfills
  10. if ( Math.sign === undefined ) {
  11. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign
  12. Math.sign = function ( x ) {
  13. return ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : +x;
  14. };
  15. }
  16. if ( Function.prototype.name === undefined && Object.defineProperty !== undefined ) {
  17. // Missing in IE9-11.
  18. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name
  19. Object.defineProperty( Function.prototype, 'name', {
  20. get: function () {
  21. return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1];
  22. }
  23. } );
  24. }
  25. // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent.button
  26. THREE.MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 };
  27. // GL STATE CONSTANTS
  28. THREE.CullFaceNone = 0;
  29. THREE.CullFaceBack = 1;
  30. THREE.CullFaceFront = 2;
  31. THREE.CullFaceFrontBack = 3;
  32. THREE.FrontFaceDirectionCW = 0;
  33. THREE.FrontFaceDirectionCCW = 1;
  34. // SHADOWING TYPES
  35. THREE.BasicShadowMap = 0;
  36. THREE.PCFShadowMap = 1;
  37. THREE.PCFSoftShadowMap = 2;
  38. // MATERIAL CONSTANTS
  39. // side
  40. THREE.FrontSide = 0;
  41. THREE.BackSide = 1;
  42. THREE.DoubleSide = 2;
  43. // shading
  44. THREE.NoShading = 0;
  45. THREE.FlatShading = 1;
  46. THREE.SmoothShading = 2;
  47. // colors
  48. THREE.NoColors = 0;
  49. THREE.FaceColors = 1;
  50. THREE.VertexColors = 2;
  51. // blending modes
  52. THREE.NoBlending = 0;
  53. THREE.NormalBlending = 1;
  54. THREE.AdditiveBlending = 2;
  55. THREE.SubtractiveBlending = 3;
  56. THREE.MultiplyBlending = 4;
  57. THREE.CustomBlending = 5;
  58. // custom blending equations
  59. // (numbers start from 100 not to clash with other
  60. // mappings to OpenGL constants defined in Texture.js)
  61. THREE.AddEquation = 100;
  62. THREE.SubtractEquation = 101;
  63. THREE.ReverseSubtractEquation = 102;
  64. THREE.MinEquation = 103;
  65. THREE.MaxEquation = 104;
  66. // custom blending destination factors
  67. THREE.ZeroFactor = 200;
  68. THREE.OneFactor = 201;
  69. THREE.SrcColorFactor = 202;
  70. THREE.OneMinusSrcColorFactor = 203;
  71. THREE.SrcAlphaFactor = 204;
  72. THREE.OneMinusSrcAlphaFactor = 205;
  73. THREE.DstAlphaFactor = 206;
  74. THREE.OneMinusDstAlphaFactor = 207;
  75. // custom blending source factors
  76. //THREE.ZeroFactor = 200;
  77. //THREE.OneFactor = 201;
  78. //THREE.SrcAlphaFactor = 204;
  79. //THREE.OneMinusSrcAlphaFactor = 205;
  80. //THREE.DstAlphaFactor = 206;
  81. //THREE.OneMinusDstAlphaFactor = 207;
  82. THREE.DstColorFactor = 208;
  83. THREE.OneMinusDstColorFactor = 209;
  84. THREE.SrcAlphaSaturateFactor = 210;
  85. // depth modes
  86. THREE.NeverDepth = 0;
  87. THREE.AlwaysDepth = 1;
  88. THREE.LessDepth = 2;
  89. THREE.LessEqualDepth = 3;
  90. THREE.EqualDepth = 4;
  91. THREE.GreaterEqualDepth = 5;
  92. THREE.GreaterDepth = 6;
  93. THREE.NotEqualDepth = 7;
  94. // TEXTURE CONSTANTS
  95. THREE.MultiplyOperation = 0;
  96. THREE.MixOperation = 1;
  97. THREE.AddOperation = 2;
  98. // Mapping modes
  99. THREE.UVMapping = 300;
  100. THREE.CubeReflectionMapping = 301;
  101. THREE.CubeRefractionMapping = 302;
  102. THREE.EquirectangularReflectionMapping = 303;
  103. THREE.EquirectangularRefractionMapping = 304;
  104. THREE.SphericalReflectionMapping = 305;
  105. // Wrapping modes
  106. THREE.RepeatWrapping = 1000;
  107. THREE.ClampToEdgeWrapping = 1001;
  108. THREE.MirroredRepeatWrapping = 1002;
  109. // Filters
  110. THREE.NearestFilter = 1003;
  111. THREE.NearestMipMapNearestFilter = 1004;
  112. THREE.NearestMipMapLinearFilter = 1005;
  113. THREE.LinearFilter = 1006;
  114. THREE.LinearMipMapNearestFilter = 1007;
  115. THREE.LinearMipMapLinearFilter = 1008;
  116. // Data types
  117. THREE.UnsignedByteType = 1009;
  118. THREE.ByteType = 1010;
  119. THREE.ShortType = 1011;
  120. THREE.UnsignedShortType = 1012;
  121. THREE.IntType = 1013;
  122. THREE.UnsignedIntType = 1014;
  123. THREE.FloatType = 1015;
  124. THREE.HalfFloatType = 1025;
  125. // Pixel types
  126. //THREE.UnsignedByteType = 1009;
  127. THREE.UnsignedShort4444Type = 1016;
  128. THREE.UnsignedShort5551Type = 1017;
  129. THREE.UnsignedShort565Type = 1018;
  130. // Pixel formats
  131. THREE.AlphaFormat = 1019;
  132. THREE.RGBFormat = 1020;
  133. THREE.RGBAFormat = 1021;
  134. THREE.LuminanceFormat = 1022;
  135. THREE.LuminanceAlphaFormat = 1023;
  136. // THREE.RGBEFormat handled as THREE.RGBAFormat in shaders
  137. THREE.RGBEFormat = THREE.RGBAFormat; //1024;
  138. // DDS / ST3C Compressed texture formats
  139. THREE.RGB_S3TC_DXT1_Format = 2001;
  140. THREE.RGBA_S3TC_DXT1_Format = 2002;
  141. THREE.RGBA_S3TC_DXT3_Format = 2003;
  142. THREE.RGBA_S3TC_DXT5_Format = 2004;
  143. // PVRTC compressed texture formats
  144. THREE.RGB_PVRTC_4BPPV1_Format = 2100;
  145. THREE.RGB_PVRTC_2BPPV1_Format = 2101;
  146. THREE.RGBA_PVRTC_4BPPV1_Format = 2102;
  147. THREE.RGBA_PVRTC_2BPPV1_Format = 2103;
  148. // DEPRECATED
  149. THREE.Projector = function () {
  150. console.error( 'THREE.Projector has been moved to /examples/js/renderers/Projector.js.' );
  151. this.projectVector = function ( vector, camera ) {
  152. console.warn( 'THREE.Projector: .projectVector() is now vector.project().' );
  153. vector.project( camera );
  154. };
  155. this.unprojectVector = function ( vector, camera ) {
  156. console.warn( 'THREE.Projector: .unprojectVector() is now vector.unproject().' );
  157. vector.unproject( camera );
  158. };
  159. this.pickingRay = function ( vector, camera ) {
  160. console.error( 'THREE.Projector: .pickingRay() is now raycaster.setFromCamera().' );
  161. };
  162. };
  163. THREE.CanvasRenderer = function () {
  164. console.error( 'THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js' );
  165. this.domElement = document.createElement( 'canvas' );
  166. this.clear = function () {};
  167. this.render = function () {};
  168. this.setClearColor = function () {};
  169. this.setSize = function () {};
  170. };
粤ICP备19079148号