Three.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. var THREE = { REVISION: '75dev' };
  5. //
  6. if ( typeof define === 'function' && define.amd ) {
  7. define( 'three', THREE );
  8. } else if ( 'undefined' !== typeof exports && 'undefined' !== typeof module ) {
  9. module.exports = THREE;
  10. }
  11. //
  12. if ( Number.EPSILON === undefined ) {
  13. Number.EPSILON = Math.pow( 2, - 52 );
  14. }
  15. //
  16. if ( Math.sign === undefined ) {
  17. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign
  18. Math.sign = function ( x ) {
  19. return ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : + x;
  20. };
  21. }
  22. if ( Function.prototype.name === undefined && Object.defineProperty !== undefined ) {
  23. // Missing in IE9-11.
  24. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name
  25. Object.defineProperty( Function.prototype, 'name', {
  26. get: function () {
  27. return this.toString().match( /^\s*function\s*(\S*)\s*\(/ )[ 1 ];
  28. }
  29. } );
  30. }
  31. if ( Object.assign === undefined ) {
  32. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
  33. Object.defineProperty( Object, 'assign', {
  34. writable: true,
  35. configurable: true,
  36. value: function ( target ) {
  37. 'use strict';
  38. if ( target === undefined || target === null ) {
  39. throw new TypeError( "Cannot convert first argument to object" );
  40. }
  41. var to = Object( target );
  42. for ( var i = 1, n = arguments.length; i !== n; ++ i ) {
  43. var nextSource = arguments[ i ];
  44. if ( nextSource === undefined || nextSource === null ) continue;
  45. nextSource = Object( nextSource );
  46. var keysArray = Object.keys( nextSource );
  47. for ( var nextIndex = 0, len = keysArray.length; nextIndex !== len; ++ nextIndex ) {
  48. var nextKey = keysArray[ nextIndex ];
  49. var desc = Object.getOwnPropertyDescriptor( nextSource, nextKey );
  50. if ( desc !== undefined && desc.enumerable ) {
  51. to[ nextKey ] = nextSource[ nextKey ];
  52. }
  53. }
  54. }
  55. return to;
  56. }
  57. } );
  58. }
  59. // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent.button
  60. THREE.MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 };
  61. // GL STATE CONSTANTS
  62. THREE.CullFaceNone = 0;
  63. THREE.CullFaceBack = 1;
  64. THREE.CullFaceFront = 2;
  65. THREE.CullFaceFrontBack = 3;
  66. THREE.FrontFaceDirectionCW = 0;
  67. THREE.FrontFaceDirectionCCW = 1;
  68. // SHADOWING TYPES
  69. THREE.BasicShadowMap = 0;
  70. THREE.PCFShadowMap = 1;
  71. THREE.PCFSoftShadowMap = 2;
  72. // MATERIAL CONSTANTS
  73. // side
  74. THREE.FrontSide = 0;
  75. THREE.BackSide = 1;
  76. THREE.DoubleSide = 2;
  77. // shading
  78. THREE.FlatShading = 1;
  79. THREE.SmoothShading = 2;
  80. // colors
  81. THREE.NoColors = 0;
  82. THREE.FaceColors = 1;
  83. THREE.VertexColors = 2;
  84. // blending modes
  85. THREE.NoBlending = 0;
  86. THREE.NormalBlending = 1;
  87. THREE.AdditiveBlending = 2;
  88. THREE.SubtractiveBlending = 3;
  89. THREE.MultiplyBlending = 4;
  90. THREE.CustomBlending = 5;
  91. // custom blending equations
  92. // (numbers start from 100 not to clash with other
  93. // mappings to OpenGL constants defined in Texture.js)
  94. THREE.AddEquation = 100;
  95. THREE.SubtractEquation = 101;
  96. THREE.ReverseSubtractEquation = 102;
  97. THREE.MinEquation = 103;
  98. THREE.MaxEquation = 104;
  99. // custom blending destination factors
  100. THREE.ZeroFactor = 200;
  101. THREE.OneFactor = 201;
  102. THREE.SrcColorFactor = 202;
  103. THREE.OneMinusSrcColorFactor = 203;
  104. THREE.SrcAlphaFactor = 204;
  105. THREE.OneMinusSrcAlphaFactor = 205;
  106. THREE.DstAlphaFactor = 206;
  107. THREE.OneMinusDstAlphaFactor = 207;
  108. // custom blending source factors
  109. //THREE.ZeroFactor = 200;
  110. //THREE.OneFactor = 201;
  111. //THREE.SrcAlphaFactor = 204;
  112. //THREE.OneMinusSrcAlphaFactor = 205;
  113. //THREE.DstAlphaFactor = 206;
  114. //THREE.OneMinusDstAlphaFactor = 207;
  115. THREE.DstColorFactor = 208;
  116. THREE.OneMinusDstColorFactor = 209;
  117. THREE.SrcAlphaSaturateFactor = 210;
  118. // depth modes
  119. THREE.NeverDepth = 0;
  120. THREE.AlwaysDepth = 1;
  121. THREE.LessDepth = 2;
  122. THREE.LessEqualDepth = 3;
  123. THREE.EqualDepth = 4;
  124. THREE.GreaterEqualDepth = 5;
  125. THREE.GreaterDepth = 6;
  126. THREE.NotEqualDepth = 7;
  127. // TEXTURE CONSTANTS
  128. THREE.MultiplyOperation = 0;
  129. THREE.MixOperation = 1;
  130. THREE.AddOperation = 2;
  131. // Mapping modes
  132. THREE.UVMapping = 300;
  133. THREE.CubeReflectionMapping = 301;
  134. THREE.CubeRefractionMapping = 302;
  135. THREE.EquirectangularReflectionMapping = 303;
  136. THREE.EquirectangularRefractionMapping = 304;
  137. THREE.SphericalReflectionMapping = 305;
  138. // Wrapping modes
  139. THREE.RepeatWrapping = 1000;
  140. THREE.ClampToEdgeWrapping = 1001;
  141. THREE.MirroredRepeatWrapping = 1002;
  142. // Filters
  143. THREE.NearestFilter = 1003;
  144. THREE.NearestMipMapNearestFilter = 1004;
  145. THREE.NearestMipMapLinearFilter = 1005;
  146. THREE.LinearFilter = 1006;
  147. THREE.LinearMipMapNearestFilter = 1007;
  148. THREE.LinearMipMapLinearFilter = 1008;
  149. // Data types
  150. THREE.UnsignedByteType = 1009;
  151. THREE.ByteType = 1010;
  152. THREE.ShortType = 1011;
  153. THREE.UnsignedShortType = 1012;
  154. THREE.IntType = 1013;
  155. THREE.UnsignedIntType = 1014;
  156. THREE.FloatType = 1015;
  157. THREE.HalfFloatType = 1025;
  158. // Pixel types
  159. //THREE.UnsignedByteType = 1009;
  160. THREE.UnsignedShort4444Type = 1016;
  161. THREE.UnsignedShort5551Type = 1017;
  162. THREE.UnsignedShort565Type = 1018;
  163. // Pixel formats
  164. THREE.AlphaFormat = 1019;
  165. THREE.RGBFormat = 1020;
  166. THREE.RGBAFormat = 1021;
  167. THREE.LuminanceFormat = 1022;
  168. THREE.LuminanceAlphaFormat = 1023;
  169. // THREE.RGBEFormat handled as THREE.RGBAFormat in shaders
  170. THREE.RGBEFormat = THREE.RGBAFormat; //1024;
  171. // DDS / ST3C Compressed texture formats
  172. THREE.RGB_S3TC_DXT1_Format = 2001;
  173. THREE.RGBA_S3TC_DXT1_Format = 2002;
  174. THREE.RGBA_S3TC_DXT3_Format = 2003;
  175. THREE.RGBA_S3TC_DXT5_Format = 2004;
  176. // PVRTC compressed texture formats
  177. THREE.RGB_PVRTC_4BPPV1_Format = 2100;
  178. THREE.RGB_PVRTC_2BPPV1_Format = 2101;
  179. THREE.RGBA_PVRTC_4BPPV1_Format = 2102;
  180. THREE.RGBA_PVRTC_2BPPV1_Format = 2103;
  181. // ETC compressed texture formats
  182. THREE.RGB_ETC1_Format = 2151;
  183. // Loop styles for AnimationAction
  184. THREE.LoopOnce = 2200;
  185. THREE.LoopRepeat = 2201;
  186. THREE.LoopPingPong = 2202;
  187. // Interpolation
  188. THREE.InterpolateDiscrete = 2300;
  189. THREE.InterpolateLinear = 2301;
  190. THREE.InterpolateSmooth = 2302;
  191. // Interpolant ending modes
  192. THREE.ZeroCurvatureEnding = 2400;
  193. THREE.ZeroSlopeEnding = 2401;
  194. THREE.WrapAroundEnding = 2402;
  195. // Triangle Draw modes
  196. THREE.TrianglesDrawMode = 0;
  197. THREE.TriangleStripDrawMode = 1;
  198. THREE.TriangleFanDrawMode = 2;
  199. // Texture Encodings
  200. THREE.LinearEncoding = 3000; // No encoding at all.
  201. THREE.sRGBEncoding = 3001; // AKA gamma 2.2.
  202. THREE.RGBEEncoding = 3002; // AKA Radiance
  203. //THREE.LogLuvEncoding = 3003; TODO
  204. THREE.RGBM7Encoding = 3004;
  205. THREE.RGBM16Encoding = 3005;
  206. //THREE.RGBDEncoding = 3006; TODO
粤ICP备19079148号