Three.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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. THREE.ExceptionErrorHandler = function( message, optionalData ) {
  16. console.error( message );
  17. if( optionalData ) console.error( optionalData );
  18. var error = new Error( message );
  19. error.optionalData = optionalData;
  20. throw error;
  21. };
  22. THREE.ConsoleErrorHandler = function( message, optionalData ) {
  23. console.error( message );
  24. if( optionalData ) console.error( optionalData );
  25. };
  26. THREE.ConsoleWarningHandler = function( message, optionalData ) {
  27. console.warn( message );
  28. if( optionalData ) console.warn( optionalData );
  29. };
  30. THREE.NullHandler = function( message, optionalData ) {
  31. };
  32. // set the default error handlers
  33. THREE.error = THREE.ConsoleErrorHandler;
  34. THREE.warning = THREE.ConsoleWarningHandler;
  35. // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent.button
  36. THREE.MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 };
  37. // GL STATE CONSTANTS
  38. THREE.CullFaceNone = 0;
  39. THREE.CullFaceBack = 1;
  40. THREE.CullFaceFront = 2;
  41. THREE.CullFaceFrontBack = 3;
  42. THREE.FrontFaceDirectionCW = 0;
  43. THREE.FrontFaceDirectionCCW = 1;
  44. // SHADOWING TYPES
  45. THREE.BasicShadowMap = 0;
  46. THREE.PCFShadowMap = 1;
  47. THREE.PCFSoftShadowMap = 2;
  48. // MATERIAL CONSTANTS
  49. // side
  50. THREE.FrontSide = 0;
  51. THREE.BackSide = 1;
  52. THREE.DoubleSide = 2;
  53. // shading
  54. THREE.NoShading = 0;
  55. THREE.FlatShading = 1;
  56. THREE.SmoothShading = 2;
  57. // colors
  58. THREE.NoColors = 0;
  59. THREE.FaceColors = 1;
  60. THREE.VertexColors = 2;
  61. // blending modes
  62. THREE.NoBlending = 0;
  63. THREE.NormalBlending = 1;
  64. THREE.AdditiveBlending = 2;
  65. THREE.SubtractiveBlending = 3;
  66. THREE.MultiplyBlending = 4;
  67. THREE.CustomBlending = 5;
  68. // custom blending equations
  69. // (numbers start from 100 not to clash with other
  70. // mappings to OpenGL constants defined in Texture.js)
  71. THREE.AddEquation = 100;
  72. THREE.SubtractEquation = 101;
  73. THREE.ReverseSubtractEquation = 102;
  74. THREE.MinEquation = 103;
  75. THREE.MaxEquation = 104;
  76. // custom blending destination factors
  77. THREE.ZeroFactor = 200;
  78. THREE.OneFactor = 201;
  79. THREE.SrcColorFactor = 202;
  80. THREE.OneMinusSrcColorFactor = 203;
  81. THREE.SrcAlphaFactor = 204;
  82. THREE.OneMinusSrcAlphaFactor = 205;
  83. THREE.DstAlphaFactor = 206;
  84. THREE.OneMinusDstAlphaFactor = 207;
  85. // custom blending source factors
  86. //THREE.ZeroFactor = 200;
  87. //THREE.OneFactor = 201;
  88. //THREE.SrcAlphaFactor = 204;
  89. //THREE.OneMinusSrcAlphaFactor = 205;
  90. //THREE.DstAlphaFactor = 206;
  91. //THREE.OneMinusDstAlphaFactor = 207;
  92. THREE.DstColorFactor = 208;
  93. THREE.OneMinusDstColorFactor = 209;
  94. THREE.SrcAlphaSaturateFactor = 210;
  95. // TEXTURE CONSTANTS
  96. THREE.MultiplyOperation = 0;
  97. THREE.MixOperation = 1;
  98. THREE.AddOperation = 2;
  99. // Mapping modes
  100. THREE.UVMapping = 300;
  101. THREE.CubeReflectionMapping = 301;
  102. THREE.CubeRefractionMapping = 302;
  103. THREE.EquirectangularReflectionMapping = 303;
  104. THREE.EquirectangularRefractionMapping = 304;
  105. THREE.SphericalReflectionMapping = 305;
  106. // Wrapping modes
  107. THREE.RepeatWrapping = 1000;
  108. THREE.ClampToEdgeWrapping = 1001;
  109. THREE.MirroredRepeatWrapping = 1002;
  110. // Filters
  111. THREE.NearestFilter = 1003;
  112. THREE.NearestMipMapNearestFilter = 1004;
  113. THREE.NearestMipMapLinearFilter = 1005;
  114. THREE.LinearFilter = 1006;
  115. THREE.LinearMipMapNearestFilter = 1007;
  116. THREE.LinearMipMapLinearFilter = 1008;
  117. // Data types
  118. THREE.UnsignedByteType = 1009;
  119. THREE.ByteType = 1010;
  120. THREE.ShortType = 1011;
  121. THREE.UnsignedShortType = 1012;
  122. THREE.IntType = 1013;
  123. THREE.UnsignedIntType = 1014;
  124. THREE.FloatType = 1015;
  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. THREE.error( 'THREE.Projector has been moved to /examples/js/renderers/Projector.js.' );
  151. this.projectVector = function ( vector, camera ) {
  152. THREE.warning( 'THREE.Projector: .projectVector() is now vector.project().' );
  153. vector.project( camera );
  154. };
  155. this.unprojectVector = function ( vector, camera ) {
  156. THREE.warning( 'THREE.Projector: .unprojectVector() is now vector.unproject().' );
  157. vector.unproject( camera );
  158. };
  159. this.pickingRay = function ( vector, camera ) {
  160. THREE.error( 'THREE.Projector: .pickingRay() has been removed.' );
  161. };
  162. };
  163. THREE.CanvasRenderer = function () {
  164. THREE.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号