Three.js 4.6 KB

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