three-stdlib 2.8.11 → 2.8.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. package/index.cjs.js +1 -1
  2. package/index.d.ts +1 -52
  3. package/index.js +52 -52
  4. package/lines/LineMaterial.d.ts +7 -6
  5. package/modifiers/CurveModifier.cjs.js +1 -1
  6. package/modifiers/CurveModifier.d.ts +13 -9
  7. package/modifiers/CurveModifier.js +27 -30
  8. package/objects/Lensflare.cjs.js +1 -1
  9. package/objects/Lensflare.js +11 -3
  10. package/package.json +2 -2
  11. package/postprocessing/AfterimagePass.d.ts +2 -30
  12. package/shaders/ACESFilmicToneMappingShader.cjs.js +1 -1
  13. package/shaders/ACESFilmicToneMappingShader.d.ts +9 -0
  14. package/shaders/ACESFilmicToneMappingShader.js +1 -1
  15. package/shaders/AfterimageShader.d.ts +9 -15
  16. package/shaders/BasicShader.cjs.js +1 -1
  17. package/shaders/BasicShader.d.ts +5 -5
  18. package/shaders/BasicShader.js +1 -1
  19. package/shaders/BleachBypassShader.cjs.js +1 -1
  20. package/shaders/BleachBypassShader.d.ts +8 -9
  21. package/shaders/BleachBypassShader.js +1 -1
  22. package/shaders/BlendShader.cjs.js +1 -1
  23. package/shaders/BlendShader.d.ts +13 -7
  24. package/shaders/BlendShader.js +1 -1
  25. package/shaders/BokehShader.cjs.js +1 -1
  26. package/shaders/BokehShader.d.ts +18 -19
  27. package/shaders/BokehShader.js +1 -1
  28. package/shaders/BokehShader2.cjs.js +1 -1
  29. package/shaders/BokehShader2.d.ts +80 -34
  30. package/shaders/BokehShader2.js +2 -2
  31. package/shaders/BrightnessContrastShader.cjs.js +1 -1
  32. package/shaders/BrightnessContrastShader.d.ts +10 -6
  33. package/shaders/BrightnessContrastShader.js +1 -1
  34. package/shaders/ColorCorrectionShader.cjs.js +1 -1
  35. package/shaders/ColorCorrectionShader.d.ts +14 -7
  36. package/shaders/ColorCorrectionShader.js +1 -1
  37. package/shaders/ColorifyShader.cjs.js +1 -1
  38. package/shaders/ColorifyShader.d.ts +8 -5
  39. package/shaders/ColorifyShader.js +1 -1
  40. package/shaders/ConvolutionShader.cjs.js +1 -1
  41. package/shaders/ConvolutionShader.d.ts +15 -16
  42. package/shaders/ConvolutionShader.js +9 -14
  43. package/shaders/CopyShader.d.ts +8 -12
  44. package/shaders/DOFMipMapShader.cjs.js +1 -1
  45. package/shaders/DOFMipMapShader.d.ts +13 -7
  46. package/shaders/DOFMipMapShader.js +1 -1
  47. package/shaders/DepthLimitedBlurShader.cjs.js +1 -1
  48. package/shaders/DepthLimitedBlurShader.d.ts +26 -25
  49. package/shaders/DepthLimitedBlurShader.js +12 -16
  50. package/shaders/DigitalGlitch.cjs.js +1 -1
  51. package/shaders/DigitalGlitch.d.ts +34 -14
  52. package/shaders/DigitalGlitch.js +1 -10
  53. package/shaders/DotScreenShader.cjs.js +1 -1
  54. package/shaders/DotScreenShader.d.ts +17 -8
  55. package/shaders/DotScreenShader.js +1 -1
  56. package/shaders/FXAAShader.cjs.js +1 -1
  57. package/shaders/FXAAShader.d.ts +8 -5
  58. package/shaders/FXAAShader.js +1 -1
  59. package/shaders/FilmShader.cjs.js +1 -1
  60. package/shaders/FilmShader.d.ts +19 -9
  61. package/shaders/FilmShader.js +1 -1
  62. package/shaders/FocusShader.cjs.js +1 -1
  63. package/shaders/FocusShader.d.ts +16 -8
  64. package/shaders/FocusShader.js +1 -1
  65. package/shaders/FreiChenShader.cjs.js +1 -1
  66. package/shaders/FreiChenShader.d.ts +8 -5
  67. package/shaders/FreiChenShader.js +1 -1
  68. package/shaders/FresnelShader.cjs.js +1 -1
  69. package/shaders/FresnelShader.d.ts +21 -0
  70. package/shaders/FresnelShader.js +1 -1
  71. package/shaders/GammaCorrectionShader.d.ts +7 -7
  72. package/shaders/GodRaysShader.cjs.js +1 -1
  73. package/shaders/GodRaysShader.d.ts +38 -20
  74. package/shaders/GodRaysShader.js +4 -4
  75. package/shaders/HalftoneShader.cjs.js +1 -1
  76. package/shaders/HalftoneShader.d.ts +40 -16
  77. package/shaders/HalftoneShader.js +1 -1
  78. package/shaders/HorizontalBlurShader.d.ts +8 -8
  79. package/shaders/HorizontalTiltShiftShader.cjs.js +1 -1
  80. package/shaders/HorizontalTiltShiftShader.d.ts +10 -6
  81. package/shaders/HorizontalTiltShiftShader.js +1 -1
  82. package/shaders/HueSaturationShader.cjs.js +1 -1
  83. package/shaders/HueSaturationShader.d.ts +10 -6
  84. package/shaders/HueSaturationShader.js +1 -1
  85. package/shaders/KaleidoShader.cjs.js +1 -1
  86. package/shaders/KaleidoShader.d.ts +10 -6
  87. package/shaders/KaleidoShader.js +1 -1
  88. package/shaders/LuminosityHighPassShader.cjs.js +1 -1
  89. package/shaders/LuminosityHighPassShader.d.ts +17 -8
  90. package/shaders/LuminosityHighPassShader.js +1 -1
  91. package/shaders/LuminosityShader.cjs.js +1 -1
  92. package/shaders/LuminosityShader.d.ts +4 -4
  93. package/shaders/LuminosityShader.js +1 -1
  94. package/shaders/MirrorShader.cjs.js +1 -1
  95. package/shaders/MirrorShader.d.ts +7 -5
  96. package/shaders/MirrorShader.js +1 -1
  97. package/shaders/NormalMapShader.cjs.js +1 -1
  98. package/shaders/NormalMapShader.d.ts +14 -7
  99. package/shaders/NormalMapShader.js +1 -1
  100. package/shaders/ParallaxShader.cjs.js +1 -1
  101. package/shaders/ParallaxShader.d.ts +28 -0
  102. package/shaders/ParallaxShader.js +1 -1
  103. package/shaders/PixelShader.cjs.js +1 -1
  104. package/shaders/PixelShader.d.ts +10 -6
  105. package/shaders/PixelShader.js +1 -1
  106. package/shaders/RGBShiftShader.cjs.js +1 -1
  107. package/shaders/RGBShiftShader.d.ts +10 -6
  108. package/shaders/RGBShiftShader.js +1 -1
  109. package/shaders/SAOShader.cjs.js +1 -1
  110. package/shaders/SAOShader.d.ts +24 -29
  111. package/shaders/SAOShader.js +1 -5
  112. package/shaders/SMAAShader.cjs.js +1 -1
  113. package/shaders/SMAAShader.d.ts +31 -16
  114. package/shaders/SMAAShader.js +3 -3
  115. package/shaders/SSAOShader.cjs.js +1 -1
  116. package/shaders/SSAOShader.d.ts +58 -25
  117. package/shaders/SSAOShader.js +3 -3
  118. package/shaders/SSRShader.cjs.js +1 -1
  119. package/shaders/SSRShader.d.ts +67 -36
  120. package/shaders/SSRShader.js +3 -3
  121. package/shaders/SepiaShader.cjs.js +1 -1
  122. package/shaders/SepiaShader.d.ts +7 -5
  123. package/shaders/SepiaShader.js +1 -1
  124. package/shaders/SobelOperatorShader.cjs.js +1 -1
  125. package/shaders/SobelOperatorShader.d.ts +8 -5
  126. package/shaders/SobelOperatorShader.js +1 -1
  127. package/shaders/SubsurfaceScatteringShader.cjs.js +1 -1
  128. package/shaders/SubsurfaceScatteringShader.d.ts +2 -34
  129. package/shaders/SubsurfaceScatteringShader.js +3 -3
  130. package/shaders/TechnicolorShader.cjs.js +1 -1
  131. package/shaders/TechnicolorShader.d.ts +4 -4
  132. package/shaders/TechnicolorShader.js +1 -1
  133. package/shaders/ToneMapShader.cjs.js +1 -1
  134. package/shaders/ToneMapShader.d.ts +19 -9
  135. package/shaders/ToneMapShader.js +1 -1
  136. package/shaders/ToonShader.cjs.js +1 -1
  137. package/shaders/ToonShader.d.ts +80 -34
  138. package/shaders/ToonShader.js +4 -4
  139. package/shaders/TriangleBlurShader.cjs.js +1 -1
  140. package/shaders/TriangleBlurShader.d.ts +8 -5
  141. package/shaders/TriangleBlurShader.js +1 -1
  142. package/shaders/UnpackDepthRGBAShader.cjs.js +1 -1
  143. package/shaders/UnpackDepthRGBAShader.d.ts +7 -5
  144. package/shaders/UnpackDepthRGBAShader.js +1 -1
  145. package/shaders/VerticalBlurShader.cjs.js +1 -1
  146. package/shaders/VerticalBlurShader.d.ts +8 -8
  147. package/shaders/VerticalBlurShader.js +1 -1
  148. package/shaders/VerticalTiltShiftShader.cjs.js +1 -1
  149. package/shaders/VerticalTiltShiftShader.d.ts +10 -6
  150. package/shaders/VerticalTiltShiftShader.js +1 -1
  151. package/shaders/VignetteShader.cjs.js +1 -1
  152. package/shaders/VignetteShader.d.ts +10 -6
  153. package/shaders/VignetteShader.js +1 -1
  154. package/shaders/VolumeShader.cjs.js +1 -1
  155. package/shaders/VolumeShader.d.ts +20 -9
  156. package/shaders/VolumeShader.js +1 -1
  157. package/shaders/WaterRefractionShader.cjs.js +1 -1
  158. package/shaders/WaterRefractionShader.d.ts +16 -8
  159. package/shaders/WaterRefractionShader.js +1 -1
  160. package/shaders/index.cjs.js +1 -0
  161. package/shaders/index.d.ts +53 -0
  162. package/shaders/index.js +53 -0
  163. package/shaders/types.cjs.js +1 -0
  164. package/shaders/types.d.ts +14 -0
  165. package/shaders/types.js +1 -0
  166. package/types/shared.d.ts +0 -20
@@ -17,7 +17,7 @@
17
17
  * This version is provided under a Creative Commons Attribution 3.0 License
18
18
  * http://creativecommons.org/licenses/by/3.0/
19
19
  */
20
- var FilmShader = {
20
+ const FilmShader = {
21
21
  uniforms: {
22
22
  tDiffuse: {
23
23
  value: null
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e={uniforms:{tDiffuse:{value:null},screenWidth:{value:1024},screenHeight:{value:1024},sampleDistance:{value:.94},waveFactor:{value:.00125}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float screenWidth;","uniform float screenHeight;","uniform float sampleDistance;","uniform float waveFactor;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 color, org, tmp, add;","\tfloat sample_dist, f;","\tvec2 vin;","\tvec2 uv = vUv;","\tadd = color = org = texture2D( tDiffuse, uv );","\tvin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 );","\tsample_dist = dot( vin, vin ) * 2.0;","\tf = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;","\tvec2 sampleSize = vec2( 1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );","\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tadd += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tadd += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tadd += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tcolor = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) );","\tcolor = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) );","\tgl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 );","}"].join("\n")};exports.FocusShader=e;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={uniforms:{tDiffuse:{value:null},screenWidth:{value:1024},screenHeight:{value:1024},sampleDistance:{value:.94},waveFactor:{value:.00125}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float screenWidth;","uniform float screenHeight;","uniform float sampleDistance;","uniform float waveFactor;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 color, org, tmp, add;","\tfloat sample_dist, f;","\tvec2 vin;","\tvec2 uv = vUv;","\tadd = color = org = texture2D( tDiffuse, uv );","\tvin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 );","\tsample_dist = dot( vin, vin ) * 2.0;","\tf = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;","\tvec2 sampleSize = vec2( 1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );","\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tadd += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tadd += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tadd += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tadd += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize );","\tif( tmp.b < color.b ) color = tmp;","\tcolor = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) );","\tcolor = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) );","\tgl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 );","}"].join("\n")};exports.FocusShader=e;
@@ -1,12 +1,20 @@
1
- import { Uniform } from 'three';
2
-
3
- export const FocusShader: {
1
+ export declare const FocusShader: {
4
2
  uniforms: {
5
- tDiffuse: Uniform;
6
- screenWidth: Uniform;
7
- screenHeight: Uniform;
8
- sampleDistance: Uniform;
9
- waveFactor: Uniform;
3
+ tDiffuse: {
4
+ value: null;
5
+ };
6
+ screenWidth: {
7
+ value: number;
8
+ };
9
+ screenHeight: {
10
+ value: number;
11
+ };
12
+ sampleDistance: {
13
+ value: number;
14
+ };
15
+ waveFactor: {
16
+ value: number;
17
+ };
10
18
  };
11
19
  vertexShader: string;
12
20
  fragmentShader: string;
@@ -3,7 +3,7 @@
3
3
  * based on PaintEffect postprocess from ro.me
4
4
  * http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js
5
5
  */
6
- var FocusShader = {
6
+ const FocusShader = {
7
7
  uniforms: {
8
8
  tDiffuse: {
9
9
  value: null
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t={uniforms:{tDiffuse:{value:null},aspect:{value:new(require("three").Vector2)(512,512)}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","varying vec2 vUv;","uniform vec2 aspect;","vec2 texel = vec2(1.0 / aspect.x, 1.0 / aspect.y);","mat3 G[9];","const mat3 g0 = mat3( 0.3535533845424652, 0, -0.3535533845424652, 0.5, 0, -0.5, 0.3535533845424652, 0, -0.3535533845424652 );","const mat3 g1 = mat3( 0.3535533845424652, 0.5, 0.3535533845424652, 0, 0, 0, -0.3535533845424652, -0.5, -0.3535533845424652 );","const mat3 g2 = mat3( 0, 0.3535533845424652, -0.5, -0.3535533845424652, 0, 0.3535533845424652, 0.5, -0.3535533845424652, 0 );","const mat3 g3 = mat3( 0.5, -0.3535533845424652, 0, -0.3535533845424652, 0, 0.3535533845424652, 0, 0.3535533845424652, -0.5 );","const mat3 g4 = mat3( 0, -0.5, 0, 0.5, 0, 0.5, 0, -0.5, 0 );","const mat3 g5 = mat3( -0.5, 0, 0.5, 0, 0, 0, 0.5, 0, -0.5 );","const mat3 g6 = mat3( 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.6666666865348816, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204 );","const mat3 g7 = mat3( -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, 0.6666666865348816, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408 );","const mat3 g8 = mat3( 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408 );","void main(void)","{","\tG[0] = g0,","\tG[1] = g1,","\tG[2] = g2,","\tG[3] = g3,","\tG[4] = g4,","\tG[5] = g5,","\tG[6] = g6,","\tG[7] = g7,","\tG[8] = g8;","\tmat3 I;","\tfloat cnv[9];","\tvec3 sample;","\tfor (float i=0.0; i<3.0; i++) {","\t\tfor (float j=0.0; j<3.0; j++) {","\t\t\tsample = texture2D(tDiffuse, vUv + texel * vec2(i-1.0,j-1.0) ).rgb;","\t\t\tI[int(i)][int(j)] = length(sample);","\t\t}","\t}","\tfor (int i=0; i<9; i++) {","\t\tfloat dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);","\t\tcnv[i] = dp3 * dp3;","\t}","\tfloat M = (cnv[0] + cnv[1]) + (cnv[2] + cnv[3]);","\tfloat S = (cnv[4] + cnv[5]) + (cnv[6] + cnv[7]) + (cnv[8] + M);","\tgl_FragColor = vec4(vec3(sqrt(M/S)), 1.0);","}"].join("\n")};exports.FreiChenShader=t;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t={uniforms:{tDiffuse:{value:null},aspect:{value:new(require("three").Vector2)(512,512)}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","varying vec2 vUv;","uniform vec2 aspect;","vec2 texel = vec2(1.0 / aspect.x, 1.0 / aspect.y);","mat3 G[9];","const mat3 g0 = mat3( 0.3535533845424652, 0, -0.3535533845424652, 0.5, 0, -0.5, 0.3535533845424652, 0, -0.3535533845424652 );","const mat3 g1 = mat3( 0.3535533845424652, 0.5, 0.3535533845424652, 0, 0, 0, -0.3535533845424652, -0.5, -0.3535533845424652 );","const mat3 g2 = mat3( 0, 0.3535533845424652, -0.5, -0.3535533845424652, 0, 0.3535533845424652, 0.5, -0.3535533845424652, 0 );","const mat3 g3 = mat3( 0.5, -0.3535533845424652, 0, -0.3535533845424652, 0, 0.3535533845424652, 0, 0.3535533845424652, -0.5 );","const mat3 g4 = mat3( 0, -0.5, 0, 0.5, 0, 0.5, 0, -0.5, 0 );","const mat3 g5 = mat3( -0.5, 0, 0.5, 0, 0, 0, 0.5, 0, -0.5 );","const mat3 g6 = mat3( 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.6666666865348816, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204 );","const mat3 g7 = mat3( -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, 0.6666666865348816, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408 );","const mat3 g8 = mat3( 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408 );","void main(void)","{","\tG[0] = g0,","\tG[1] = g1,","\tG[2] = g2,","\tG[3] = g3,","\tG[4] = g4,","\tG[5] = g5,","\tG[6] = g6,","\tG[7] = g7,","\tG[8] = g8;","\tmat3 I;","\tfloat cnv[9];","\tvec3 sample;","\tfor (float i=0.0; i<3.0; i++) {","\t\tfor (float j=0.0; j<3.0; j++) {","\t\t\tsample = texture2D(tDiffuse, vUv + texel * vec2(i-1.0,j-1.0) ).rgb;","\t\t\tI[int(i)][int(j)] = length(sample);","\t\t}","\t}","\tfor (int i=0; i<9; i++) {","\t\tfloat dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);","\t\tcnv[i] = dp3 * dp3;","\t}","\tfloat M = (cnv[0] + cnv[1]) + (cnv[2] + cnv[3]);","\tfloat S = (cnv[4] + cnv[5]) + (cnv[6] + cnv[7]) + (cnv[8] + M);","\tgl_FragColor = vec4(vec3(sqrt(M/S)), 1.0);","}"].join("\n")};exports.FreiChenShader=t;
@@ -1,9 +1,12 @@
1
- import { Uniform } from 'three';
2
-
3
- export const FreiChenShader: {
1
+ import { Vector2 } from 'three';
2
+ export declare const FreiChenShader: {
4
3
  uniforms: {
5
- tDiffuse: Uniform;
6
- aspect: Uniform;
4
+ tDiffuse: {
5
+ value: null;
6
+ };
7
+ aspect: {
8
+ value: Vector2;
9
+ };
7
10
  };
8
11
  vertexShader: string;
9
12
  fragmentShader: string;
@@ -7,7 +7,7 @@ import { Vector2 } from 'three';
7
7
  * aspect: vec2 of (1/width, 1/height)
8
8
  */
9
9
 
10
- var FreiChenShader = {
10
+ const FreiChenShader = {
11
11
  uniforms: {
12
12
  tDiffuse: {
13
13
  value: null
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e={uniforms:{mRefractionRatio:{value:1.02},mFresnelBias:{value:.1},mFresnelPower:{value:2},mFresnelScale:{value:1},tCube:{value:null}},vertexShader:["uniform float mRefractionRatio;","uniform float mFresnelBias;","uniform float mFresnelScale;","uniform float mFresnelPower;","varying vec3 vReflect;","varying vec3 vRefract[3];","varying float vReflectionFactor;","void main() {","\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );","\tvec3 worldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );","\tvec3 I = worldPosition.xyz - cameraPosition;","\tvReflect = reflect( I, worldNormal );","\tvRefract[0] = refract( normalize( I ), worldNormal, mRefractionRatio );","\tvRefract[1] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.99 );","\tvRefract[2] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.98 );","\tvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), worldNormal ), mFresnelPower );","\tgl_Position = projectionMatrix * mvPosition;","}"].join("\n"),fragmentShader:["uniform samplerCube tCube;","varying vec3 vReflect;","varying vec3 vRefract[3];","varying float vReflectionFactor;","void main() {","\tvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );","\tvec4 refractedColor = vec4( 1.0 );","\trefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;","\trefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;","\trefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;","\tgl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );","}"].join("\n")};exports.FresnelShader=e;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={uniforms:{mRefractionRatio:{value:1.02},mFresnelBias:{value:.1},mFresnelPower:{value:2},mFresnelScale:{value:1},tCube:{value:null}},vertexShader:["uniform float mRefractionRatio;","uniform float mFresnelBias;","uniform float mFresnelScale;","uniform float mFresnelPower;","varying vec3 vReflect;","varying vec3 vRefract[3];","varying float vReflectionFactor;","void main() {","\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );","\tvec3 worldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );","\tvec3 I = worldPosition.xyz - cameraPosition;","\tvReflect = reflect( I, worldNormal );","\tvRefract[0] = refract( normalize( I ), worldNormal, mRefractionRatio );","\tvRefract[1] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.99 );","\tvRefract[2] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.98 );","\tvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), worldNormal ), mFresnelPower );","\tgl_Position = projectionMatrix * mvPosition;","}"].join("\n"),fragmentShader:["uniform samplerCube tCube;","varying vec3 vReflect;","varying vec3 vRefract[3];","varying float vReflectionFactor;","void main() {","\tvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );","\tvec4 refractedColor = vec4( 1.0 );","\trefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;","\trefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;","\trefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;","\tgl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );","}"].join("\n")};exports.FresnelShader=e;
@@ -0,0 +1,21 @@
1
+ export declare const FresnelShader: {
2
+ uniforms: {
3
+ mRefractionRatio: {
4
+ value: number;
5
+ };
6
+ mFresnelBias: {
7
+ value: number;
8
+ };
9
+ mFresnelPower: {
10
+ value: number;
11
+ };
12
+ mFresnelScale: {
13
+ value: number;
14
+ };
15
+ tCube: {
16
+ value: null;
17
+ };
18
+ };
19
+ vertexShader: string;
20
+ fragmentShader: string;
21
+ };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Based on Nvidia Cg tutorial
3
3
  */
4
- var FresnelShader = {
4
+ const FresnelShader = {
5
5
  uniforms: {
6
6
  mRefractionRatio: {
7
7
  value: 1.02
@@ -1,8 +1,8 @@
1
- import { Texture } from 'three';
2
- import { TUniform, GenericShader } from 'types/shared';
3
- export interface GammaCorrectionShaderUniforms {
4
- tDiffuse: TUniform<Texture | null>;
1
+ import type { IUniform, Texture } from 'three';
2
+ import type { IShader } from './types';
3
+ export declare type GammaCorrectionShaderUniforms = {
4
+ tDiffuse: IUniform<Texture | null>;
5
+ };
6
+ export interface IGammaCorrectionShader extends IShader<GammaCorrectionShaderUniforms> {
5
7
  }
6
- export declare type GammaCorrectionShaderImpl = GenericShader<GammaCorrectionShaderUniforms>;
7
- declare const GammaCorrectionShader: GammaCorrectionShaderImpl;
8
- export { GammaCorrectionShader };
8
+ export declare const GammaCorrectionShader: IGammaCorrectionShader;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),t={uniforms:{tInput:{value:null}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["varying vec2 vUv;","uniform sampler2D tInput;","void main() {","\tgl_FragColor = vec4( 1.0 ) - texture2D( tInput, vUv );","}"].join("\n")},o={uniforms:{tInput:{value:null},fStepSize:{value:1},vSunPositionScreenSpace:{value:new e.Vector3}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#define TAPS_PER_PASS 6.0","varying vec2 vUv;","uniform sampler2D tInput;","uniform vec3 vSunPositionScreenSpace;","uniform float fStepSize;","void main() {","\tvec2 delta = vSunPositionScreenSpace.xy - vUv;","\tfloat dist = length( delta );","\tvec2 stepv = fStepSize * delta / dist;","\tfloat iters = dist/fStepSize;","\tvec2 uv = vUv.xy;","\tfloat col = 0.0;","\tfloat f = min( 1.0, max( vSunPositionScreenSpace.z / 1000.0, 0.0 ) );","\tif ( 0.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;","\tuv += stepv;","\tif ( 1.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;","\tuv += stepv;","\tif ( 2.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;","\tuv += stepv;","\tif ( 3.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;","\tuv += stepv;","\tif ( 4.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;","\tuv += stepv;","\tif ( 5.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;","\tuv += stepv;","\tgl_FragColor = vec4( col/TAPS_PER_PASS );","\tgl_FragColor.a = 1.0;","}"].join("\n")},r={uniforms:{tColors:{value:null},tGodRays:{value:null},fGodRayIntensity:{value:.69}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["varying vec2 vUv;","uniform sampler2D tColors;","uniform sampler2D tGodRays;","uniform float fGodRayIntensity;","void main() {","\tgl_FragColor = texture2D( tColors, vUv ) + fGodRayIntensity * vec4( 1.0 - texture2D( tGodRays, vUv ).r );","\tgl_FragColor.a = 1.0;","}"].join("\n")},v={uniforms:{vSunPositionScreenSpace:{value:new e.Vector3},fAspect:{value:1},sunColor:{value:new e.Color(16772608)},bgColor:{value:new e.Color(0)}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["varying vec2 vUv;","uniform vec3 vSunPositionScreenSpace;","uniform float fAspect;","uniform vec3 sunColor;","uniform vec3 bgColor;","void main() {","\tvec2 diff = vUv - vSunPositionScreenSpace.xy;","\tdiff.x *= fAspect;","\tfloat prop = clamp( length( diff ) / 0.5, 0.0, 1.0 );","\tprop = 0.35 * pow( 1.0 - prop, 3.0 );","\tgl_FragColor.xyz = ( vSunPositionScreenSpace.z > 0.0 ) ? mix( sunColor, bgColor, 1.0 - prop ) : bgColor;","\tgl_FragColor.w = 1.0;","}"].join("\n")};exports.GodRaysCombineShader=r,exports.GodRaysDepthMaskShader=t,exports.GodRaysFakeSunShader=v,exports.GodRaysGenerateShader=o;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");const t={uniforms:{tInput:{value:null}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["varying vec2 vUv;","uniform sampler2D tInput;","void main() {","\tgl_FragColor = vec4( 1.0 ) - texture2D( tInput, vUv );","}"].join("\n")},o={uniforms:{tInput:{value:null},fStepSize:{value:1},vSunPositionScreenSpace:{value:new e.Vector3}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#define TAPS_PER_PASS 6.0","varying vec2 vUv;","uniform sampler2D tInput;","uniform vec3 vSunPositionScreenSpace;","uniform float fStepSize;","void main() {","\tvec2 delta = vSunPositionScreenSpace.xy - vUv;","\tfloat dist = length( delta );","\tvec2 stepv = fStepSize * delta / dist;","\tfloat iters = dist/fStepSize;","\tvec2 uv = vUv.xy;","\tfloat col = 0.0;","\tfloat f = min( 1.0, max( vSunPositionScreenSpace.z / 1000.0, 0.0 ) );","\tif ( 0.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;","\tuv += stepv;","\tif ( 1.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;","\tuv += stepv;","\tif ( 2.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;","\tuv += stepv;","\tif ( 3.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;","\tuv += stepv;","\tif ( 4.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;","\tuv += stepv;","\tif ( 5.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f;","\tuv += stepv;","\tgl_FragColor = vec4( col/TAPS_PER_PASS );","\tgl_FragColor.a = 1.0;","}"].join("\n")},r={uniforms:{tColors:{value:null},tGodRays:{value:null},fGodRayIntensity:{value:.69}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["varying vec2 vUv;","uniform sampler2D tColors;","uniform sampler2D tGodRays;","uniform float fGodRayIntensity;","void main() {","\tgl_FragColor = texture2D( tColors, vUv ) + fGodRayIntensity * vec4( 1.0 - texture2D( tGodRays, vUv ).r );","\tgl_FragColor.a = 1.0;","}"].join("\n")},v={uniforms:{vSunPositionScreenSpace:{value:new e.Vector3},fAspect:{value:1},sunColor:{value:new e.Color(16772608)},bgColor:{value:new e.Color(0)}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["varying vec2 vUv;","uniform vec3 vSunPositionScreenSpace;","uniform float fAspect;","uniform vec3 sunColor;","uniform vec3 bgColor;","void main() {","\tvec2 diff = vUv - vSunPositionScreenSpace.xy;","\tdiff.x *= fAspect;","\tfloat prop = clamp( length( diff ) / 0.5, 0.0, 1.0 );","\tprop = 0.35 * pow( 1.0 - prop, 3.0 );","\tgl_FragColor.xyz = ( vSunPositionScreenSpace.z > 0.0 ) ? mix( sunColor, bgColor, 1.0 - prop ) : bgColor;","\tgl_FragColor.w = 1.0;","}"].join("\n")};exports.GodRaysCombineShader=r,exports.GodRaysDepthMaskShader=t,exports.GodRaysFakeSunShader=v,exports.GodRaysGenerateShader=o;
@@ -1,39 +1,57 @@
1
- import { Uniform } from 'three';
2
-
3
- export const GodRaysDepthMaskShader: {
1
+ import { Color, Vector3 } from 'three';
2
+ export declare const GodRaysDepthMaskShader: {
4
3
  uniforms: {
5
- tInput: Uniform;
4
+ tInput: {
5
+ value: null;
6
+ };
6
7
  };
7
8
  vertexShader: string;
8
9
  fragmentShader: string;
9
10
  };
10
-
11
- export const GodRaysGenerateShader: {
11
+ export declare const GodRaysGenerateShader: {
12
12
  uniforms: {
13
- tInput: Uniform;
14
- fStepSize: Uniform;
15
- vSunPositionScreenSpace: Uniform;
13
+ tInput: {
14
+ value: null;
15
+ };
16
+ fStepSize: {
17
+ value: number;
18
+ };
19
+ vSunPositionScreenSpace: {
20
+ value: Vector3;
21
+ };
16
22
  };
17
23
  vertexShader: string;
18
24
  fragmentShader: string;
19
25
  };
20
-
21
- export const GodRaysCombineShader: {
26
+ export declare const GodRaysCombineShader: {
22
27
  uniforms: {
23
- tColors: Uniform;
24
- tGodRays: Uniform;
25
- fGodRayIntensity: Uniform;
28
+ tColors: {
29
+ value: null;
30
+ };
31
+ tGodRays: {
32
+ value: null;
33
+ };
34
+ fGodRayIntensity: {
35
+ value: number;
36
+ };
26
37
  };
27
38
  vertexShader: string;
28
39
  fragmentShader: string;
29
40
  };
30
-
31
- export const GodRaysFakeSunShader: {
41
+ export declare const GodRaysFakeSunShader: {
32
42
  uniforms: {
33
- vSunPositionScreenSpace: Uniform;
34
- fAspect: Uniform;
35
- sunColor: Uniform;
36
- bgColor: Uniform;
43
+ vSunPositionScreenSpace: {
44
+ value: Vector3;
45
+ };
46
+ fAspect: {
47
+ value: number;
48
+ };
49
+ sunColor: {
50
+ value: Color;
51
+ };
52
+ bgColor: {
53
+ value: Color;
54
+ };
37
55
  };
38
56
  vertexShader: string;
39
57
  fragmentShader: string;
@@ -18,7 +18,7 @@ import { Vector3, Color } from 'three';
18
18
  * Sousa2008 - Crysis Next Gen Effects, GDC2008, http://www.crytek.com/sites/default/files/GDC08_SousaT_CrysisEffects.ppt
19
19
  */
20
20
 
21
- var GodRaysDepthMaskShader = {
21
+ const GodRaysDepthMaskShader = {
22
22
  uniforms: {
23
23
  tInput: {
24
24
  value: null
@@ -42,7 +42,7 @@ var GodRaysDepthMaskShader = {
42
42
  * decreased distance between samples.
43
43
  */
44
44
 
45
- var GodRaysGenerateShader = {
45
+ const GodRaysGenerateShader = {
46
46
  uniforms: {
47
47
  tInput: {
48
48
  value: null
@@ -91,7 +91,7 @@ var GodRaysGenerateShader = {
91
91
  * fGodRayIntensity attenuates the god rays.
92
92
  */
93
93
 
94
- var GodRaysCombineShader = {
94
+ const GodRaysCombineShader = {
95
95
  uniforms: {
96
96
  tColors: {
97
97
  value: null
@@ -114,7 +114,7 @@ var GodRaysCombineShader = {
114
114
  * cheaper/faster/simpler to implement this as a simple sun sprite.
115
115
  */
116
116
 
117
- var GodRaysFakeSunShader = {
117
+ const GodRaysFakeSunShader = {
118
118
  uniforms: {
119
119
  vSunPositionScreenSpace: {
120
120
  value: new Vector3()
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t={uniforms:{tDiffuse:{value:null},shape:{value:1},radius:{value:4},rotateR:{value:Math.PI/12*1},rotateG:{value:Math.PI/12*2},rotateB:{value:Math.PI/12*3},scatter:{value:0},width:{value:1},height:{value:1},blending:{value:1},blendingMode:{value:1},greyscale:{value:!1},disable:{value:!1}},vertexShader:["varying vec2 vUV;","void main() {","\tvUV = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),fragmentShader:["#define SQRT2_MINUS_ONE 0.41421356","#define SQRT2_HALF_MINUS_ONE 0.20710678","#define PI2 6.28318531","#define SHAPE_DOT 1","#define SHAPE_ELLIPSE 2","#define SHAPE_LINE 3","#define SHAPE_SQUARE 4","#define BLENDING_LINEAR 1","#define BLENDING_MULTIPLY 2","#define BLENDING_ADD 3","#define BLENDING_LIGHTER 4","#define BLENDING_DARKER 5","uniform sampler2D tDiffuse;","uniform float radius;","uniform float rotateR;","uniform float rotateG;","uniform float rotateB;","uniform float scatter;","uniform float width;","uniform float height;","uniform int shape;","uniform bool disable;","uniform float blending;","uniform int blendingMode;","varying vec2 vUV;","uniform bool greyscale;","const int samples = 8;","float blend( float a, float b, float t ) {","\treturn a * ( 1.0 - t ) + b * t;","}","float hypot( float x, float y ) {","\treturn sqrt( x * x + y * y );","}","float rand( vec2 seed ){","return fract( sin( dot( seed.xy, vec2( 12.9898, 78.233 ) ) ) * 43758.5453 );","}","float distanceToDotRadius( float channel, vec2 coord, vec2 normal, vec2 p, float angle, float rad_max ) {","\tfloat dist = hypot( coord.x - p.x, coord.y - p.y );","\tfloat rad = channel;","\tif ( shape == SHAPE_DOT ) {","\t\trad = pow( abs( rad ), 1.125 ) * rad_max;","\t} else if ( shape == SHAPE_ELLIPSE ) {","\t\trad = pow( abs( rad ), 1.125 ) * rad_max;","\t\tif ( dist != 0.0 ) {","\t\t\tfloat dot_p = abs( ( p.x - coord.x ) / dist * normal.x + ( p.y - coord.y ) / dist * normal.y );","\t\t\tdist = ( dist * ( 1.0 - SQRT2_HALF_MINUS_ONE ) ) + dot_p * dist * SQRT2_MINUS_ONE;","\t\t}","\t} else if ( shape == SHAPE_LINE ) {","\t\trad = pow( abs( rad ), 1.5) * rad_max;","\t\tfloat dot_p = ( p.x - coord.x ) * normal.x + ( p.y - coord.y ) * normal.y;","\t\tdist = hypot( normal.x * dot_p, normal.y * dot_p );","\t} else if ( shape == SHAPE_SQUARE ) {","\t\tfloat theta = atan( p.y - coord.y, p.x - coord.x ) - angle;","\t\tfloat sin_t = abs( sin( theta ) );","\t\tfloat cos_t = abs( cos( theta ) );","\t\trad = pow( abs( rad ), 1.4 );","\t\trad = rad_max * ( rad + ( ( sin_t > cos_t ) ? rad - sin_t * rad : rad - cos_t * rad ) );","\t}","\treturn rad - dist;","}","struct Cell {","\tvec2 normal;","\tvec2 p1;","\tvec2 p2;","\tvec2 p3;","\tvec2 p4;","\tfloat samp2;","\tfloat samp1;","\tfloat samp3;","\tfloat samp4;","};","vec4 getSample( vec2 point ) {","\tvec4 tex = texture2D( tDiffuse, vec2( point.x / width, point.y / height ) );","\tfloat base = rand( vec2( floor( point.x ), floor( point.y ) ) ) * PI2;","\tfloat step = PI2 / float( samples );","\tfloat dist = radius * 0.66;","\tfor ( int i = 0; i < samples; ++i ) {","\t\tfloat r = base + step * float( i );","\t\tvec2 coord = point + vec2( cos( r ) * dist, sin( r ) * dist );","\t\ttex += texture2D( tDiffuse, vec2( coord.x / width, coord.y / height ) );","\t}","\ttex /= float( samples ) + 1.0;","\treturn tex;","}","float getDotColour( Cell c, vec2 p, int channel, float angle, float aa ) {","\tfloat dist_c_1, dist_c_2, dist_c_3, dist_c_4, res;","\tif ( channel == 0 ) {","\t\tc.samp1 = getSample( c.p1 ).r;","\t\tc.samp2 = getSample( c.p2 ).r;","\t\tc.samp3 = getSample( c.p3 ).r;","\t\tc.samp4 = getSample( c.p4 ).r;","\t} else if (channel == 1) {","\t\tc.samp1 = getSample( c.p1 ).g;","\t\tc.samp2 = getSample( c.p2 ).g;","\t\tc.samp3 = getSample( c.p3 ).g;","\t\tc.samp4 = getSample( c.p4 ).g;","\t} else {","\t\tc.samp1 = getSample( c.p1 ).b;","\t\tc.samp3 = getSample( c.p3 ).b;","\t\tc.samp2 = getSample( c.p2 ).b;","\t\tc.samp4 = getSample( c.p4 ).b;","\t}","\tdist_c_1 = distanceToDotRadius( c.samp1, c.p1, c.normal, p, angle, radius );","\tdist_c_2 = distanceToDotRadius( c.samp2, c.p2, c.normal, p, angle, radius );","\tdist_c_3 = distanceToDotRadius( c.samp3, c.p3, c.normal, p, angle, radius );","\tdist_c_4 = distanceToDotRadius( c.samp4, c.p4, c.normal, p, angle, radius );","\tres = ( dist_c_1 > 0.0 ) ? clamp( dist_c_1 / aa, 0.0, 1.0 ) : 0.0;","\tres += ( dist_c_2 > 0.0 ) ? clamp( dist_c_2 / aa, 0.0, 1.0 ) : 0.0;","\tres += ( dist_c_3 > 0.0 ) ? clamp( dist_c_3 / aa, 0.0, 1.0 ) : 0.0;","\tres += ( dist_c_4 > 0.0 ) ? clamp( dist_c_4 / aa, 0.0, 1.0 ) : 0.0;","\tres = clamp( res, 0.0, 1.0 );","\treturn res;","}","Cell getReferenceCell( vec2 p, vec2 origin, float grid_angle, float step ) {","\tCell c;","\tvec2 n = vec2( cos( grid_angle ), sin( grid_angle ) );","\tfloat threshold = step * 0.5;","\tfloat dot_normal = n.x * ( p.x - origin.x ) + n.y * ( p.y - origin.y );","\tfloat dot_line = -n.y * ( p.x - origin.x ) + n.x * ( p.y - origin.y );","\tvec2 offset = vec2( n.x * dot_normal, n.y * dot_normal );","\tfloat offset_normal = mod( hypot( offset.x, offset.y ), step );","\tfloat normal_dir = ( dot_normal < 0.0 ) ? 1.0 : -1.0;","\tfloat normal_scale = ( ( offset_normal < threshold ) ? -offset_normal : step - offset_normal ) * normal_dir;","\tfloat offset_line = mod( hypot( ( p.x - offset.x ) - origin.x, ( p.y - offset.y ) - origin.y ), step );","\tfloat line_dir = ( dot_line < 0.0 ) ? 1.0 : -1.0;","\tfloat line_scale = ( ( offset_line < threshold ) ? -offset_line : step - offset_line ) * line_dir;","\tc.normal = n;","\tc.p1.x = p.x - n.x * normal_scale + n.y * line_scale;","\tc.p1.y = p.y - n.y * normal_scale - n.x * line_scale;","\tif ( scatter != 0.0 ) {","\t\tfloat off_mag = scatter * threshold * 0.5;","\t\tfloat off_angle = rand( vec2( floor( c.p1.x ), floor( c.p1.y ) ) ) * PI2;","\t\tc.p1.x += cos( off_angle ) * off_mag;","\t\tc.p1.y += sin( off_angle ) * off_mag;","\t}","\tfloat normal_step = normal_dir * ( ( offset_normal < threshold ) ? step : -step );","\tfloat line_step = line_dir * ( ( offset_line < threshold ) ? step : -step );","\tc.p2.x = c.p1.x - n.x * normal_step;","\tc.p2.y = c.p1.y - n.y * normal_step;","\tc.p3.x = c.p1.x + n.y * line_step;","\tc.p3.y = c.p1.y - n.x * line_step;","\tc.p4.x = c.p1.x - n.x * normal_step + n.y * line_step;","\tc.p4.y = c.p1.y - n.y * normal_step - n.x * line_step;","\treturn c;","}","float blendColour( float a, float b, float t ) {","\tif ( blendingMode == BLENDING_LINEAR ) {","\t\treturn blend( a, b, 1.0 - t );","\t} else if ( blendingMode == BLENDING_ADD ) {","\t\treturn blend( a, min( 1.0, a + b ), t );","\t} else if ( blendingMode == BLENDING_MULTIPLY ) {","\t\treturn blend( a, max( 0.0, a * b ), t );","\t} else if ( blendingMode == BLENDING_LIGHTER ) {","\t\treturn blend( a, max( a, b ), t );","\t} else if ( blendingMode == BLENDING_DARKER ) {","\t\treturn blend( a, min( a, b ), t );","\t} else {","\t\treturn blend( a, b, 1.0 - t );","\t}","}","void main() {","\tif ( ! disable ) {","\t\tvec2 p = vec2( vUV.x * width, vUV.y * height );","\t\tvec2 origin = vec2( 0, 0 );","\t\tfloat aa = ( radius < 2.5 ) ? radius * 0.5 : 1.25;","\t\tCell cell_r = getReferenceCell( p, origin, rotateR, radius );","\t\tCell cell_g = getReferenceCell( p, origin, rotateG, radius );","\t\tCell cell_b = getReferenceCell( p, origin, rotateB, radius );","\t\tfloat r = getDotColour( cell_r, p, 0, rotateR, aa );","\t\tfloat g = getDotColour( cell_g, p, 1, rotateG, aa );","\t\tfloat b = getDotColour( cell_b, p, 2, rotateB, aa );","\t\tvec4 colour = texture2D( tDiffuse, vUV );","\t\tr = blendColour( r, colour.r, blending );","\t\tg = blendColour( g, colour.g, blending );","\t\tb = blendColour( b, colour.b, blending );","\t\tif ( greyscale ) {","\t\t\tr = g = b = (r + b + g) / 3.0;","\t\t}","\t\tgl_FragColor = vec4( r, g, b, 1.0 );","\t} else {","\t\tgl_FragColor = texture2D( tDiffuse, vUV );","\t}","}"].join("\n")};exports.HalftoneShader=t;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t={uniforms:{tDiffuse:{value:null},shape:{value:1},radius:{value:4},rotateR:{value:Math.PI/12*1},rotateG:{value:Math.PI/12*2},rotateB:{value:Math.PI/12*3},scatter:{value:0},width:{value:1},height:{value:1},blending:{value:1},blendingMode:{value:1},greyscale:{value:!1},disable:{value:!1}},vertexShader:["varying vec2 vUV;","void main() {","\tvUV = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),fragmentShader:["#define SQRT2_MINUS_ONE 0.41421356","#define SQRT2_HALF_MINUS_ONE 0.20710678","#define PI2 6.28318531","#define SHAPE_DOT 1","#define SHAPE_ELLIPSE 2","#define SHAPE_LINE 3","#define SHAPE_SQUARE 4","#define BLENDING_LINEAR 1","#define BLENDING_MULTIPLY 2","#define BLENDING_ADD 3","#define BLENDING_LIGHTER 4","#define BLENDING_DARKER 5","uniform sampler2D tDiffuse;","uniform float radius;","uniform float rotateR;","uniform float rotateG;","uniform float rotateB;","uniform float scatter;","uniform float width;","uniform float height;","uniform int shape;","uniform bool disable;","uniform float blending;","uniform int blendingMode;","varying vec2 vUV;","uniform bool greyscale;","const int samples = 8;","float blend( float a, float b, float t ) {","\treturn a * ( 1.0 - t ) + b * t;","}","float hypot( float x, float y ) {","\treturn sqrt( x * x + y * y );","}","float rand( vec2 seed ){","return fract( sin( dot( seed.xy, vec2( 12.9898, 78.233 ) ) ) * 43758.5453 );","}","float distanceToDotRadius( float channel, vec2 coord, vec2 normal, vec2 p, float angle, float rad_max ) {","\tfloat dist = hypot( coord.x - p.x, coord.y - p.y );","\tfloat rad = channel;","\tif ( shape == SHAPE_DOT ) {","\t\trad = pow( abs( rad ), 1.125 ) * rad_max;","\t} else if ( shape == SHAPE_ELLIPSE ) {","\t\trad = pow( abs( rad ), 1.125 ) * rad_max;","\t\tif ( dist != 0.0 ) {","\t\t\tfloat dot_p = abs( ( p.x - coord.x ) / dist * normal.x + ( p.y - coord.y ) / dist * normal.y );","\t\t\tdist = ( dist * ( 1.0 - SQRT2_HALF_MINUS_ONE ) ) + dot_p * dist * SQRT2_MINUS_ONE;","\t\t}","\t} else if ( shape == SHAPE_LINE ) {","\t\trad = pow( abs( rad ), 1.5) * rad_max;","\t\tfloat dot_p = ( p.x - coord.x ) * normal.x + ( p.y - coord.y ) * normal.y;","\t\tdist = hypot( normal.x * dot_p, normal.y * dot_p );","\t} else if ( shape == SHAPE_SQUARE ) {","\t\tfloat theta = atan( p.y - coord.y, p.x - coord.x ) - angle;","\t\tfloat sin_t = abs( sin( theta ) );","\t\tfloat cos_t = abs( cos( theta ) );","\t\trad = pow( abs( rad ), 1.4 );","\t\trad = rad_max * ( rad + ( ( sin_t > cos_t ) ? rad - sin_t * rad : rad - cos_t * rad ) );","\t}","\treturn rad - dist;","}","struct Cell {","\tvec2 normal;","\tvec2 p1;","\tvec2 p2;","\tvec2 p3;","\tvec2 p4;","\tfloat samp2;","\tfloat samp1;","\tfloat samp3;","\tfloat samp4;","};","vec4 getSample( vec2 point ) {","\tvec4 tex = texture2D( tDiffuse, vec2( point.x / width, point.y / height ) );","\tfloat base = rand( vec2( floor( point.x ), floor( point.y ) ) ) * PI2;","\tfloat step = PI2 / float( samples );","\tfloat dist = radius * 0.66;","\tfor ( int i = 0; i < samples; ++i ) {","\t\tfloat r = base + step * float( i );","\t\tvec2 coord = point + vec2( cos( r ) * dist, sin( r ) * dist );","\t\ttex += texture2D( tDiffuse, vec2( coord.x / width, coord.y / height ) );","\t}","\ttex /= float( samples ) + 1.0;","\treturn tex;","}","float getDotColour( Cell c, vec2 p, int channel, float angle, float aa ) {","\tfloat dist_c_1, dist_c_2, dist_c_3, dist_c_4, res;","\tif ( channel == 0 ) {","\t\tc.samp1 = getSample( c.p1 ).r;","\t\tc.samp2 = getSample( c.p2 ).r;","\t\tc.samp3 = getSample( c.p3 ).r;","\t\tc.samp4 = getSample( c.p4 ).r;","\t} else if (channel == 1) {","\t\tc.samp1 = getSample( c.p1 ).g;","\t\tc.samp2 = getSample( c.p2 ).g;","\t\tc.samp3 = getSample( c.p3 ).g;","\t\tc.samp4 = getSample( c.p4 ).g;","\t} else {","\t\tc.samp1 = getSample( c.p1 ).b;","\t\tc.samp3 = getSample( c.p3 ).b;","\t\tc.samp2 = getSample( c.p2 ).b;","\t\tc.samp4 = getSample( c.p4 ).b;","\t}","\tdist_c_1 = distanceToDotRadius( c.samp1, c.p1, c.normal, p, angle, radius );","\tdist_c_2 = distanceToDotRadius( c.samp2, c.p2, c.normal, p, angle, radius );","\tdist_c_3 = distanceToDotRadius( c.samp3, c.p3, c.normal, p, angle, radius );","\tdist_c_4 = distanceToDotRadius( c.samp4, c.p4, c.normal, p, angle, radius );","\tres = ( dist_c_1 > 0.0 ) ? clamp( dist_c_1 / aa, 0.0, 1.0 ) : 0.0;","\tres += ( dist_c_2 > 0.0 ) ? clamp( dist_c_2 / aa, 0.0, 1.0 ) : 0.0;","\tres += ( dist_c_3 > 0.0 ) ? clamp( dist_c_3 / aa, 0.0, 1.0 ) : 0.0;","\tres += ( dist_c_4 > 0.0 ) ? clamp( dist_c_4 / aa, 0.0, 1.0 ) : 0.0;","\tres = clamp( res, 0.0, 1.0 );","\treturn res;","}","Cell getReferenceCell( vec2 p, vec2 origin, float grid_angle, float step ) {","\tCell c;","\tvec2 n = vec2( cos( grid_angle ), sin( grid_angle ) );","\tfloat threshold = step * 0.5;","\tfloat dot_normal = n.x * ( p.x - origin.x ) + n.y * ( p.y - origin.y );","\tfloat dot_line = -n.y * ( p.x - origin.x ) + n.x * ( p.y - origin.y );","\tvec2 offset = vec2( n.x * dot_normal, n.y * dot_normal );","\tfloat offset_normal = mod( hypot( offset.x, offset.y ), step );","\tfloat normal_dir = ( dot_normal < 0.0 ) ? 1.0 : -1.0;","\tfloat normal_scale = ( ( offset_normal < threshold ) ? -offset_normal : step - offset_normal ) * normal_dir;","\tfloat offset_line = mod( hypot( ( p.x - offset.x ) - origin.x, ( p.y - offset.y ) - origin.y ), step );","\tfloat line_dir = ( dot_line < 0.0 ) ? 1.0 : -1.0;","\tfloat line_scale = ( ( offset_line < threshold ) ? -offset_line : step - offset_line ) * line_dir;","\tc.normal = n;","\tc.p1.x = p.x - n.x * normal_scale + n.y * line_scale;","\tc.p1.y = p.y - n.y * normal_scale - n.x * line_scale;","\tif ( scatter != 0.0 ) {","\t\tfloat off_mag = scatter * threshold * 0.5;","\t\tfloat off_angle = rand( vec2( floor( c.p1.x ), floor( c.p1.y ) ) ) * PI2;","\t\tc.p1.x += cos( off_angle ) * off_mag;","\t\tc.p1.y += sin( off_angle ) * off_mag;","\t}","\tfloat normal_step = normal_dir * ( ( offset_normal < threshold ) ? step : -step );","\tfloat line_step = line_dir * ( ( offset_line < threshold ) ? step : -step );","\tc.p2.x = c.p1.x - n.x * normal_step;","\tc.p2.y = c.p1.y - n.y * normal_step;","\tc.p3.x = c.p1.x + n.y * line_step;","\tc.p3.y = c.p1.y - n.x * line_step;","\tc.p4.x = c.p1.x - n.x * normal_step + n.y * line_step;","\tc.p4.y = c.p1.y - n.y * normal_step - n.x * line_step;","\treturn c;","}","float blendColour( float a, float b, float t ) {","\tif ( blendingMode == BLENDING_LINEAR ) {","\t\treturn blend( a, b, 1.0 - t );","\t} else if ( blendingMode == BLENDING_ADD ) {","\t\treturn blend( a, min( 1.0, a + b ), t );","\t} else if ( blendingMode == BLENDING_MULTIPLY ) {","\t\treturn blend( a, max( 0.0, a * b ), t );","\t} else if ( blendingMode == BLENDING_LIGHTER ) {","\t\treturn blend( a, max( a, b ), t );","\t} else if ( blendingMode == BLENDING_DARKER ) {","\t\treturn blend( a, min( a, b ), t );","\t} else {","\t\treturn blend( a, b, 1.0 - t );","\t}","}","void main() {","\tif ( ! disable ) {","\t\tvec2 p = vec2( vUV.x * width, vUV.y * height );","\t\tvec2 origin = vec2( 0, 0 );","\t\tfloat aa = ( radius < 2.5 ) ? radius * 0.5 : 1.25;","\t\tCell cell_r = getReferenceCell( p, origin, rotateR, radius );","\t\tCell cell_g = getReferenceCell( p, origin, rotateG, radius );","\t\tCell cell_b = getReferenceCell( p, origin, rotateB, radius );","\t\tfloat r = getDotColour( cell_r, p, 0, rotateR, aa );","\t\tfloat g = getDotColour( cell_g, p, 1, rotateG, aa );","\t\tfloat b = getDotColour( cell_b, p, 2, rotateB, aa );","\t\tvec4 colour = texture2D( tDiffuse, vUV );","\t\tr = blendColour( r, colour.r, blending );","\t\tg = blendColour( g, colour.g, blending );","\t\tb = blendColour( b, colour.b, blending );","\t\tif ( greyscale ) {","\t\t\tr = g = b = (r + b + g) / 3.0;","\t\t}","\t\tgl_FragColor = vec4( r, g, b, 1.0 );","\t} else {","\t\tgl_FragColor = texture2D( tDiffuse, vUV );","\t}","}"].join("\n")};exports.HalftoneShader=t;
@@ -1,20 +1,44 @@
1
- import { Uniform } from 'three';
2
-
3
- export const HalftoneShader: {
1
+ export declare const HalftoneShader: {
4
2
  uniforms: {
5
- tDiffuse: Uniform;
6
- shape: Uniform;
7
- radius: Uniform;
8
- rotateR: Uniform;
9
- rotateG: Uniform;
10
- rotateB: Uniform;
11
- scatter: Uniform;
12
- width: Uniform;
13
- height: Uniform;
14
- blending: Uniform;
15
- blendingMode: Uniform;
16
- greyscale: Uniform;
17
- disable: Uniform;
3
+ tDiffuse: {
4
+ value: null;
5
+ };
6
+ shape: {
7
+ value: number;
8
+ };
9
+ radius: {
10
+ value: number;
11
+ };
12
+ rotateR: {
13
+ value: number;
14
+ };
15
+ rotateG: {
16
+ value: number;
17
+ };
18
+ rotateB: {
19
+ value: number;
20
+ };
21
+ scatter: {
22
+ value: number;
23
+ };
24
+ width: {
25
+ value: number;
26
+ };
27
+ height: {
28
+ value: number;
29
+ };
30
+ blending: {
31
+ value: number;
32
+ };
33
+ blendingMode: {
34
+ value: number;
35
+ };
36
+ greyscale: {
37
+ value: boolean;
38
+ };
39
+ disable: {
40
+ value: boolean;
41
+ };
18
42
  };
19
43
  vertexShader: string;
20
44
  fragmentShader: string;
@@ -4,7 +4,7 @@
4
4
  * Shape (1 = Dot, 2 = Ellipse, 3 = Line, 4 = Square)
5
5
  * Blending Mode (1 = Linear, 2 = Multiply, 3 = Add, 4 = Lighter, 5 = Darker)
6
6
  */
7
- var HalftoneShader = {
7
+ const HalftoneShader = {
8
8
  uniforms: {
9
9
  tDiffuse: {
10
10
  value: null
@@ -1,9 +1,9 @@
1
- import { Texture } from 'three';
2
- import { TUniform, GenericShader } from 'types/shared';
3
- export interface HorizontalBlurShaderUniforms {
4
- tDiffuse: TUniform<Texture | null>;
5
- h: TUniform<number>;
1
+ import type { IUniform, Texture } from 'three';
2
+ import type { IShader } from './types';
3
+ export declare type HorizontalBlurShaderUniforms = {
4
+ tDiffuse: IUniform<Texture | null>;
5
+ h: IUniform<number>;
6
+ };
7
+ export interface IHorizontalBlurShader extends IShader<HorizontalBlurShaderUniforms> {
6
8
  }
7
- export declare type HorizontalBlurShaderImpl = GenericShader<HorizontalBlurShaderUniforms>;
8
- declare const HorizontalBlurShader: HorizontalBlurShaderImpl;
9
- export { HorizontalBlurShader };
9
+ export declare const HorizontalBlurShader: IHorizontalBlurShader;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var v={uniforms:{tDiffuse:{value:null},h:{value:1/512},r:{value:.35}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float h;","uniform float r;","varying vec2 vUv;","void main() {","\tvec4 sum = vec4( 0.0 );","\tfloat hh = h * abs( r - vUv.y );","\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;","\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;","\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;","\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;","\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;","\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;","\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;","\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;","\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;","\tgl_FragColor = sum;","}"].join("\n")};exports.HorizontalTiltShiftShader=v;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const v={uniforms:{tDiffuse:{value:null},h:{value:1/512},r:{value:.35}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float h;","uniform float r;","varying vec2 vUv;","void main() {","\tvec4 sum = vec4( 0.0 );","\tfloat hh = h * abs( r - vUv.y );","\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;","\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;","\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;","\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;","\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;","\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;","\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;","\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;","\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;","\tgl_FragColor = sum;","}"].join("\n")};exports.HorizontalTiltShiftShader=v;
@@ -1,10 +1,14 @@
1
- import { Uniform } from 'three';
2
-
3
- export const HorizontalTiltShiftShader: {
1
+ export declare const HorizontalTiltShiftShader: {
4
2
  uniforms: {
5
- tDiffuse: Uniform;
6
- h: Uniform;
7
- r: Uniform;
3
+ tDiffuse: {
4
+ value: null;
5
+ };
6
+ h: {
7
+ value: number;
8
+ };
9
+ r: {
10
+ value: number;
11
+ };
8
12
  };
9
13
  vertexShader: string;
10
14
  fragmentShader: string;
@@ -6,7 +6,7 @@
6
6
  * - "h" and "v" parameters should be set to "1 / width" and "1 / height"
7
7
  * - "r" parameter control where "focused" horizontal line lies
8
8
  */
9
- var HorizontalTiltShiftShader = {
9
+ const HorizontalTiltShiftShader = {
10
10
  uniforms: {
11
11
  tDiffuse: {
12
12
  value: null
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r={uniforms:{tDiffuse:{value:null},hue:{value:0},saturation:{value:0}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float hue;","uniform float saturation;","varying vec2 vUv;","void main() {","\tgl_FragColor = texture2D( tDiffuse, vUv );","\tfloat angle = hue * 3.14159265;","\tfloat s = sin(angle), c = cos(angle);","\tvec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;","\tfloat len = length(gl_FragColor.rgb);","\tgl_FragColor.rgb = vec3(","\t\tdot(gl_FragColor.rgb, weights.xyz),","\t\tdot(gl_FragColor.rgb, weights.zxy),","\t\tdot(gl_FragColor.rgb, weights.yzx)","\t);","\tfloat average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;","\tif (saturation > 0.0) {","\t\tgl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));","\t} else {","\t\tgl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation);","\t}","}"].join("\n")};exports.HueSaturationShader=r;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t={uniforms:{tDiffuse:{value:null},hue:{value:0},saturation:{value:0}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float hue;","uniform float saturation;","varying vec2 vUv;","void main() {","\tgl_FragColor = texture2D( tDiffuse, vUv );","\tfloat angle = hue * 3.14159265;","\tfloat s = sin(angle), c = cos(angle);","\tvec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;","\tfloat len = length(gl_FragColor.rgb);","\tgl_FragColor.rgb = vec3(","\t\tdot(gl_FragColor.rgb, weights.xyz),","\t\tdot(gl_FragColor.rgb, weights.zxy),","\t\tdot(gl_FragColor.rgb, weights.yzx)","\t);","\tfloat average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;","\tif (saturation > 0.0) {","\t\tgl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));","\t} else {","\t\tgl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation);","\t}","}"].join("\n")};exports.HueSaturationShader=t;
@@ -1,10 +1,14 @@
1
- import { Uniform } from 'three';
2
-
3
- export const HueSaturationShader: {
1
+ export declare const HueSaturationShader: {
4
2
  uniforms: {
5
- tDiffuse: Uniform;
6
- hue: Uniform;
7
- saturation: Uniform;
3
+ tDiffuse: {
4
+ value: null;
5
+ };
6
+ hue: {
7
+ value: number;
8
+ };
9
+ saturation: {
10
+ value: number;
11
+ };
8
12
  };
9
13
  vertexShader: string;
10
14
  fragmentShader: string;
@@ -4,7 +4,7 @@
4
4
  * hue: -1 to 1 (-1 is 180 degrees in the negative direction, 0 is no change, etc.
5
5
  * saturation: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)
6
6
  */
7
- var HueSaturationShader = {
7
+ const HueSaturationShader = {
8
8
  uniforms: {
9
9
  tDiffuse: {
10
10
  value: null
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e={uniforms:{tDiffuse:{value:null},sides:{value:6},angle:{value:0}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float sides;","uniform float angle;","varying vec2 vUv;","void main() {","\tvec2 p = vUv - 0.5;","\tfloat r = length(p);","\tfloat a = atan(p.y, p.x) + angle;","\tfloat tau = 2. * 3.1416 ;","\ta = mod(a, tau/sides);","\ta = abs(a - tau/sides/2.) ;","\tp = r * vec2(cos(a), sin(a));","\tvec4 color = texture2D(tDiffuse, p + 0.5);","\tgl_FragColor = color;","}"].join("\n")};exports.KaleidoShader=e;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={uniforms:{tDiffuse:{value:null},sides:{value:6},angle:{value:0}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float sides;","uniform float angle;","varying vec2 vUv;","void main() {","\tvec2 p = vUv - 0.5;","\tfloat r = length(p);","\tfloat a = atan(p.y, p.x) + angle;","\tfloat tau = 2. * 3.1416 ;","\ta = mod(a, tau/sides);","\ta = abs(a - tau/sides/2.) ;","\tp = r * vec2(cos(a), sin(a));","\tvec4 color = texture2D(tDiffuse, p + 0.5);","\tgl_FragColor = color;","}"].join("\n")};exports.KaleidoShader=e;
@@ -1,10 +1,14 @@
1
- import { Uniform } from 'three';
2
-
3
- export const KaleidoShader: {
1
+ export declare const KaleidoShader: {
4
2
  uniforms: {
5
- tDiffuse: Uniform;
6
- sides: Uniform;
7
- angle: Uniform;
3
+ tDiffuse: {
4
+ value: null;
5
+ };
6
+ sides: {
7
+ value: number;
8
+ };
9
+ angle: {
10
+ value: number;
11
+ };
8
12
  };
9
13
  vertexShader: string;
10
14
  fragmentShader: string;
@@ -7,7 +7,7 @@
7
7
  * sides: number of reflections
8
8
  * angle: initial angle in radians
9
9
  */
10
- var KaleidoShader = {
10
+ const KaleidoShader = {
11
11
  uniforms: {
12
12
  tDiffuse: {
13
13
  value: null
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new(require("three").Color)(0)},defaultOpacity:{value:0}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec3 defaultColor;","uniform float defaultOpacity;","uniform float luminosityThreshold;","uniform float smoothWidth;","varying vec2 vUv;","void main() {","\tvec4 texel = texture2D( tDiffuse, vUv );","\tvec3 luma = vec3( 0.299, 0.587, 0.114 );","\tfloat v = dot( texel.xyz, luma );","\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );","\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );","\tgl_FragColor = mix( outputColor, texel, alpha );","}"].join("\n")};exports.LuminosityHighPassShader=t;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new(require("three").Color)(0)},defaultOpacity:{value:0}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec3 defaultColor;","uniform float defaultOpacity;","uniform float luminosityThreshold;","uniform float smoothWidth;","varying vec2 vUv;","void main() {","\tvec4 texel = texture2D( tDiffuse, vUv );","\tvec3 luma = vec3( 0.299, 0.587, 0.114 );","\tfloat v = dot( texel.xyz, luma );","\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );","\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );","\tgl_FragColor = mix( outputColor, texel, alpha );","}"].join("\n")};exports.LuminosityHighPassShader=t;
@@ -1,13 +1,22 @@
1
- import { Uniform } from 'three';
2
-
3
- export const LuminosityHighPassShader: {
1
+ import { Color } from 'three';
2
+ export declare const LuminosityHighPassShader: {
4
3
  shaderID: string;
5
4
  uniforms: {
6
- tDiffuse: Uniform;
7
- luminosityThreshold: Uniform;
8
- smoothWidth: Uniform;
9
- defaultColor: Uniform;
10
- defaultOpacity: Uniform;
5
+ tDiffuse: {
6
+ value: null;
7
+ };
8
+ luminosityThreshold: {
9
+ value: number;
10
+ };
11
+ smoothWidth: {
12
+ value: number;
13
+ };
14
+ defaultColor: {
15
+ value: Color;
16
+ };
17
+ defaultOpacity: {
18
+ value: number;
19
+ };
11
20
  };
12
21
  vertexShader: string;
13
22
  fragmentShader: string;
@@ -5,7 +5,7 @@ import { Color } from 'three';
5
5
  * http://en.wikipedia.org/wiki/Luminosity
6
6
  */
7
7
 
8
- var LuminosityHighPassShader = {
8
+ const LuminosityHighPassShader = {
9
9
  shaderID: 'luminosityHighPass',
10
10
  uniforms: {
11
11
  tDiffuse: {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e={uniforms:{tDiffuse:{value:null}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 texel = texture2D( tDiffuse, vUv );","\tfloat l = linearToRelativeLuminance( texel.rgb );","\tgl_FragColor = vec4( l, l, l, texel.w );","}"].join("\n")};exports.LuminosityShader=e;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={uniforms:{tDiffuse:{value:null}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 texel = texture2D( tDiffuse, vUv );","\tfloat l = linearToRelativeLuminance( texel.rgb );","\tgl_FragColor = vec4( l, l, l, texel.w );","}"].join("\n")};exports.LuminosityShader=e;