Three.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. var THREE = { REVISION: '79dev' };
  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. // Polyfills
  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 ) {
  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. // Missing in IE.
  33. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
  34. ( function () {
  35. Object.assign = function ( target ) {
  36. 'use strict';
  37. if ( target === undefined || target === null ) {
  38. throw new TypeError( 'Cannot convert undefined or null to object' );
  39. }
  40. var output = Object( target );
  41. for ( var index = 1; index < arguments.length; index ++ ) {
  42. var source = arguments[ index ];
  43. if ( source !== undefined && source !== null ) {
  44. for ( var nextKey in source ) {
  45. if ( Object.prototype.hasOwnProperty.call( source, nextKey ) ) {
  46. output[ nextKey ] = source[ nextKey ];
  47. }
  48. }
  49. }
  50. }
  51. return output;
  52. };
  53. } )();
  54. }
  55. //
  56. Object.assign( THREE, {
  57. // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent.button
  58. MOUSE: { LEFT: 0, MIDDLE: 1, RIGHT: 2 },
  59. // GL STATE CONSTANTS
  60. CullFaceNone: 0,
  61. CullFaceBack: 1,
  62. CullFaceFront: 2,
  63. CullFaceFrontBack: 3,
  64. FrontFaceDirectionCW: 0,
  65. FrontFaceDirectionCCW: 1,
  66. // SHADOWING TYPES
  67. BasicShadowMap: 0,
  68. PCFShadowMap: 1,
  69. PCFSoftShadowMap: 2,
  70. // MATERIAL CONSTANTS
  71. // side
  72. FrontSide: 0,
  73. BackSide: 1,
  74. DoubleSide: 2,
  75. // shading
  76. FlatShading: 1,
  77. SmoothShading: 2,
  78. // colors
  79. NoColors: 0,
  80. FaceColors: 1,
  81. VertexColors: 2,
  82. // blending modes
  83. NoBlending: 0,
  84. NormalBlending: 1,
  85. AdditiveBlending: 2,
  86. SubtractiveBlending: 3,
  87. MultiplyBlending: 4,
  88. CustomBlending: 5,
  89. // custom blending equations
  90. // (numbers start from 100 not to clash with other
  91. // mappings to OpenGL constants defined in Texture.js)
  92. AddEquation: 100,
  93. SubtractEquation: 101,
  94. ReverseSubtractEquation: 102,
  95. MinEquation: 103,
  96. MaxEquation: 104,
  97. // custom blending destination factors
  98. ZeroFactor: 200,
  99. OneFactor: 201,
  100. SrcColorFactor: 202,
  101. OneMinusSrcColorFactor: 203,
  102. SrcAlphaFactor: 204,
  103. OneMinusSrcAlphaFactor: 205,
  104. DstAlphaFactor: 206,
  105. OneMinusDstAlphaFactor: 207,
  106. // custom blending source factors
  107. //ZeroFactor: 200,
  108. //OneFactor: 201,
  109. //SrcAlphaFactor: 204,
  110. //OneMinusSrcAlphaFactor: 205,
  111. //DstAlphaFactor: 206,
  112. //OneMinusDstAlphaFactor: 207,
  113. DstColorFactor: 208,
  114. OneMinusDstColorFactor: 209,
  115. SrcAlphaSaturateFactor: 210,
  116. // depth modes
  117. NeverDepth: 0,
  118. AlwaysDepth: 1,
  119. LessDepth: 2,
  120. LessEqualDepth: 3,
  121. EqualDepth: 4,
  122. GreaterEqualDepth: 5,
  123. GreaterDepth: 6,
  124. NotEqualDepth: 7,
  125. // TEXTURE CONSTANTS
  126. MultiplyOperation: 0,
  127. MixOperation: 1,
  128. AddOperation: 2,
  129. // Tone Mapping modes
  130. NoToneMapping: 0, // do not do any tone mapping, not even exposure (required for special purpose passes.)
  131. LinearToneMapping: 1, // only apply exposure.
  132. ReinhardToneMapping: 2,
  133. Uncharted2ToneMapping: 3, // John Hable
  134. CineonToneMapping: 4, // optimized filmic operator by Jim Hejl and Richard Burgess-Dawson
  135. // Mapping modes
  136. UVMapping: 300,
  137. CubeReflectionMapping: 301,
  138. CubeRefractionMapping: 302,
  139. EquirectangularReflectionMapping: 303,
  140. EquirectangularRefractionMapping: 304,
  141. SphericalReflectionMapping: 305,
  142. CubeUVReflectionMapping: 306,
  143. CubeUVRefractionMapping: 307,
  144. // Wrapping modes
  145. RepeatWrapping: 1000,
  146. ClampToEdgeWrapping: 1001,
  147. MirroredRepeatWrapping: 1002,
  148. // Filters
  149. NearestFilter: 1003,
  150. NearestMipMapNearestFilter: 1004,
  151. NearestMipMapLinearFilter: 1005,
  152. LinearFilter: 1006,
  153. LinearMipMapNearestFilter: 1007,
  154. LinearMipMapLinearFilter: 1008,
  155. // Data types
  156. UnsignedByteType: 1009,
  157. ByteType: 1010,
  158. ShortType: 1011,
  159. UnsignedShortType: 1012,
  160. IntType: 1013,
  161. UnsignedIntType: 1014,
  162. FloatType: 1015,
  163. HalfFloatType: 1025,
  164. // Pixel types
  165. //UnsignedByteType: 1009,
  166. UnsignedShort4444Type: 1016,
  167. UnsignedShort5551Type: 1017,
  168. UnsignedShort565Type: 1018,
  169. // Pixel formats
  170. AlphaFormat: 1019,
  171. RGBFormat: 1020,
  172. RGBAFormat: 1021,
  173. LuminanceFormat: 1022,
  174. LuminanceAlphaFormat: 1023,
  175. // THREE.RGBEFormat handled as THREE.RGBAFormat in shaders
  176. RGBEFormat: THREE.RGBAFormat, //1024;
  177. DepthFormat: 1026,
  178. // DDS / ST3C Compressed texture formats
  179. RGB_S3TC_DXT1_Format: 2001,
  180. RGBA_S3TC_DXT1_Format: 2002,
  181. RGBA_S3TC_DXT3_Format: 2003,
  182. RGBA_S3TC_DXT5_Format: 2004,
  183. // PVRTC compressed texture formats
  184. RGB_PVRTC_4BPPV1_Format: 2100,
  185. RGB_PVRTC_2BPPV1_Format: 2101,
  186. RGBA_PVRTC_4BPPV1_Format: 2102,
  187. RGBA_PVRTC_2BPPV1_Format: 2103,
  188. // ETC compressed texture formats
  189. RGB_ETC1_Format: 2151,
  190. // Loop styles for AnimationAction
  191. LoopOnce: 2200,
  192. LoopRepeat: 2201,
  193. LoopPingPong: 2202,
  194. // Interpolation
  195. InterpolateDiscrete: 2300,
  196. InterpolateLinear: 2301,
  197. InterpolateSmooth: 2302,
  198. // Interpolant ending modes
  199. ZeroCurvatureEnding: 2400,
  200. ZeroSlopeEnding: 2401,
  201. WrapAroundEnding: 2402,
  202. // Triangle Draw modes
  203. TrianglesDrawMode: 0,
  204. TriangleStripDrawMode: 1,
  205. TriangleFanDrawMode: 2,
  206. // Texture Encodings
  207. LinearEncoding: 3000, // No encoding at all.
  208. sRGBEncoding: 3001,
  209. GammaEncoding: 3007, // uses GAMMA_FACTOR, for backwards compatibility with WebGLRenderer.gammaInput/gammaOutput
  210. // The following Texture Encodings are for RGB-only (no alpha) HDR light emission sources.
  211. // These encodings should not specified as output encodings except in rare situations.
  212. RGBEEncoding: 3002, // AKA Radiance.
  213. LogLuvEncoding: 3003,
  214. RGBM7Encoding: 3004,
  215. RGBM16Encoding: 3005,
  216. RGBDEncoding: 3006, // MaxRange is 256.
  217. // Depth packing strategies
  218. BasicDepthPacking: 3200, // for writing to float textures for high precision or for visualizing results in RGB buffers
  219. RGBADepthPacking: 3201 // for packing into RGBA buffers.
  220. } );