Three.js 4.9 KB

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