three-stdlib 2.8.11 → 2.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. package/index.cjs.js +1 -1
  2. package/index.d.ts +2 -52
  3. package/index.js +53 -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/postprocessing/RenderPixelatedPass.cjs.js +1 -0
  13. package/postprocessing/RenderPixelatedPass.js +213 -0
  14. package/shaders/ACESFilmicToneMappingShader.cjs.js +1 -1
  15. package/shaders/ACESFilmicToneMappingShader.d.ts +9 -0
  16. package/shaders/ACESFilmicToneMappingShader.js +1 -1
  17. package/shaders/AfterimageShader.d.ts +9 -15
  18. package/shaders/BasicShader.cjs.js +1 -1
  19. package/shaders/BasicShader.d.ts +5 -5
  20. package/shaders/BasicShader.js +1 -1
  21. package/shaders/BleachBypassShader.cjs.js +1 -1
  22. package/shaders/BleachBypassShader.d.ts +8 -9
  23. package/shaders/BleachBypassShader.js +1 -1
  24. package/shaders/BlendShader.cjs.js +1 -1
  25. package/shaders/BlendShader.d.ts +13 -7
  26. package/shaders/BlendShader.js +1 -1
  27. package/shaders/BokehShader.cjs.js +1 -1
  28. package/shaders/BokehShader.d.ts +18 -19
  29. package/shaders/BokehShader.js +1 -1
  30. package/shaders/BokehShader2.cjs.js +1 -1
  31. package/shaders/BokehShader2.d.ts +80 -34
  32. package/shaders/BokehShader2.js +2 -2
  33. package/shaders/BrightnessContrastShader.cjs.js +1 -1
  34. package/shaders/BrightnessContrastShader.d.ts +10 -6
  35. package/shaders/BrightnessContrastShader.js +1 -1
  36. package/shaders/ColorCorrectionShader.cjs.js +1 -1
  37. package/shaders/ColorCorrectionShader.d.ts +14 -7
  38. package/shaders/ColorCorrectionShader.js +1 -1
  39. package/shaders/ColorifyShader.cjs.js +1 -1
  40. package/shaders/ColorifyShader.d.ts +8 -5
  41. package/shaders/ColorifyShader.js +1 -1
  42. package/shaders/ConvolutionShader.cjs.js +1 -1
  43. package/shaders/ConvolutionShader.d.ts +15 -16
  44. package/shaders/ConvolutionShader.js +9 -14
  45. package/shaders/CopyShader.d.ts +8 -12
  46. package/shaders/DOFMipMapShader.cjs.js +1 -1
  47. package/shaders/DOFMipMapShader.d.ts +13 -7
  48. package/shaders/DOFMipMapShader.js +1 -1
  49. package/shaders/DepthLimitedBlurShader.cjs.js +1 -1
  50. package/shaders/DepthLimitedBlurShader.d.ts +26 -25
  51. package/shaders/DepthLimitedBlurShader.js +12 -16
  52. package/shaders/DigitalGlitch.cjs.js +1 -1
  53. package/shaders/DigitalGlitch.d.ts +34 -14
  54. package/shaders/DigitalGlitch.js +1 -10
  55. package/shaders/DotScreenShader.cjs.js +1 -1
  56. package/shaders/DotScreenShader.d.ts +17 -8
  57. package/shaders/DotScreenShader.js +1 -1
  58. package/shaders/FXAAShader.cjs.js +1 -1
  59. package/shaders/FXAAShader.d.ts +8 -5
  60. package/shaders/FXAAShader.js +1 -1
  61. package/shaders/FilmShader.cjs.js +1 -1
  62. package/shaders/FilmShader.d.ts +19 -9
  63. package/shaders/FilmShader.js +1 -1
  64. package/shaders/FocusShader.cjs.js +1 -1
  65. package/shaders/FocusShader.d.ts +16 -8
  66. package/shaders/FocusShader.js +1 -1
  67. package/shaders/FreiChenShader.cjs.js +1 -1
  68. package/shaders/FreiChenShader.d.ts +8 -5
  69. package/shaders/FreiChenShader.js +1 -1
  70. package/shaders/FresnelShader.cjs.js +1 -1
  71. package/shaders/FresnelShader.d.ts +21 -0
  72. package/shaders/FresnelShader.js +1 -1
  73. package/shaders/GammaCorrectionShader.d.ts +7 -7
  74. package/shaders/GodRaysShader.cjs.js +1 -1
  75. package/shaders/GodRaysShader.d.ts +38 -20
  76. package/shaders/GodRaysShader.js +4 -4
  77. package/shaders/HalftoneShader.cjs.js +1 -1
  78. package/shaders/HalftoneShader.d.ts +40 -16
  79. package/shaders/HalftoneShader.js +1 -1
  80. package/shaders/HorizontalBlurShader.d.ts +8 -8
  81. package/shaders/HorizontalTiltShiftShader.cjs.js +1 -1
  82. package/shaders/HorizontalTiltShiftShader.d.ts +10 -6
  83. package/shaders/HorizontalTiltShiftShader.js +1 -1
  84. package/shaders/HueSaturationShader.cjs.js +1 -1
  85. package/shaders/HueSaturationShader.d.ts +10 -6
  86. package/shaders/HueSaturationShader.js +1 -1
  87. package/shaders/KaleidoShader.cjs.js +1 -1
  88. package/shaders/KaleidoShader.d.ts +10 -6
  89. package/shaders/KaleidoShader.js +1 -1
  90. package/shaders/LuminosityHighPassShader.cjs.js +1 -1
  91. package/shaders/LuminosityHighPassShader.d.ts +17 -8
  92. package/shaders/LuminosityHighPassShader.js +1 -1
  93. package/shaders/LuminosityShader.cjs.js +1 -1
  94. package/shaders/LuminosityShader.d.ts +4 -4
  95. package/shaders/LuminosityShader.js +1 -1
  96. package/shaders/MirrorShader.cjs.js +1 -1
  97. package/shaders/MirrorShader.d.ts +7 -5
  98. package/shaders/MirrorShader.js +1 -1
  99. package/shaders/NormalMapShader.cjs.js +1 -1
  100. package/shaders/NormalMapShader.d.ts +14 -7
  101. package/shaders/NormalMapShader.js +1 -1
  102. package/shaders/ParallaxShader.cjs.js +1 -1
  103. package/shaders/ParallaxShader.d.ts +28 -0
  104. package/shaders/ParallaxShader.js +1 -1
  105. package/shaders/PixelShader.cjs.js +1 -1
  106. package/shaders/PixelShader.d.ts +10 -6
  107. package/shaders/PixelShader.js +1 -1
  108. package/shaders/RGBShiftShader.cjs.js +1 -1
  109. package/shaders/RGBShiftShader.d.ts +10 -6
  110. package/shaders/RGBShiftShader.js +1 -1
  111. package/shaders/SAOShader.cjs.js +1 -1
  112. package/shaders/SAOShader.d.ts +24 -29
  113. package/shaders/SAOShader.js +1 -5
  114. package/shaders/SMAAShader.cjs.js +1 -1
  115. package/shaders/SMAAShader.d.ts +31 -16
  116. package/shaders/SMAAShader.js +3 -3
  117. package/shaders/SSAOShader.cjs.js +1 -1
  118. package/shaders/SSAOShader.d.ts +58 -25
  119. package/shaders/SSAOShader.js +3 -3
  120. package/shaders/SSRShader.cjs.js +1 -1
  121. package/shaders/SSRShader.d.ts +67 -36
  122. package/shaders/SSRShader.js +3 -3
  123. package/shaders/SepiaShader.cjs.js +1 -1
  124. package/shaders/SepiaShader.d.ts +7 -5
  125. package/shaders/SepiaShader.js +1 -1
  126. package/shaders/SobelOperatorShader.cjs.js +1 -1
  127. package/shaders/SobelOperatorShader.d.ts +8 -5
  128. package/shaders/SobelOperatorShader.js +1 -1
  129. package/shaders/SubsurfaceScatteringShader.cjs.js +1 -1
  130. package/shaders/SubsurfaceScatteringShader.d.ts +2 -34
  131. package/shaders/SubsurfaceScatteringShader.js +3 -3
  132. package/shaders/TechnicolorShader.cjs.js +1 -1
  133. package/shaders/TechnicolorShader.d.ts +4 -4
  134. package/shaders/TechnicolorShader.js +1 -1
  135. package/shaders/ToneMapShader.cjs.js +1 -1
  136. package/shaders/ToneMapShader.d.ts +19 -9
  137. package/shaders/ToneMapShader.js +1 -1
  138. package/shaders/ToonShader.cjs.js +1 -1
  139. package/shaders/ToonShader.d.ts +80 -34
  140. package/shaders/ToonShader.js +4 -4
  141. package/shaders/TriangleBlurShader.cjs.js +1 -1
  142. package/shaders/TriangleBlurShader.d.ts +8 -5
  143. package/shaders/TriangleBlurShader.js +1 -1
  144. package/shaders/UnpackDepthRGBAShader.cjs.js +1 -1
  145. package/shaders/UnpackDepthRGBAShader.d.ts +7 -5
  146. package/shaders/UnpackDepthRGBAShader.js +1 -1
  147. package/shaders/VerticalBlurShader.cjs.js +1 -1
  148. package/shaders/VerticalBlurShader.d.ts +8 -8
  149. package/shaders/VerticalBlurShader.js +1 -1
  150. package/shaders/VerticalTiltShiftShader.cjs.js +1 -1
  151. package/shaders/VerticalTiltShiftShader.d.ts +10 -6
  152. package/shaders/VerticalTiltShiftShader.js +1 -1
  153. package/shaders/VignetteShader.cjs.js +1 -1
  154. package/shaders/VignetteShader.d.ts +10 -6
  155. package/shaders/VignetteShader.js +1 -1
  156. package/shaders/VolumeShader.cjs.js +1 -1
  157. package/shaders/VolumeShader.d.ts +20 -9
  158. package/shaders/VolumeShader.js +1 -1
  159. package/shaders/WaterRefractionShader.cjs.js +1 -1
  160. package/shaders/WaterRefractionShader.d.ts +16 -8
  161. package/shaders/WaterRefractionShader.js +1 -1
  162. package/shaders/index.cjs.js +1 -0
  163. package/shaders/index.d.ts +53 -0
  164. package/shaders/index.js +53 -0
  165. package/shaders/types.cjs.js +1 -0
  166. package/shaders/types.d.ts +14 -0
  167. package/shaders/types.js +1 -0
  168. package/types/shared.d.ts +0 -20
@@ -1,11 +1,5 @@
1
- import { Matrix4, Vector2, Texture, IUniform } from 'three';
2
- /**
3
- * References:
4
- * https://lettier.github.io/3d-game-shaders-for-beginners/screen-space-reflection.html
5
- */
6
-
7
- export const SSRShader: SSRShader;
8
- export interface SSRShader {
1
+ import { Matrix4, Vector2 } from 'three';
2
+ export declare const SSRShader: {
9
3
  defines: {
10
4
  MAX_STEP: number;
11
5
  isPerspectiveCamera: boolean;
@@ -15,45 +9,82 @@ export interface SSRShader {
15
9
  isSelective: boolean;
16
10
  };
17
11
  uniforms: {
18
- tDiffuse: IUniform<Texture | null>;
19
- tNormal: IUniform<Texture | null>;
20
- tMetalness: IUniform<Texture | null>;
21
- tDepth: IUniform<Texture | null>;
22
- cameraNear: IUniform<number>;
23
- cameraFar: IUniform<number>;
24
- resolution: IUniform<Vector2>;
25
- cameraProjectionMatrix: IUniform<Matrix4>;
26
- cameraInverseProjectionMatrix: IUniform<Matrix4>;
27
- opacity: IUniform<number>;
28
- maxDistance: IUniform<number>;
29
- cameraRange: IUniform<number>;
30
- thickness: IUniform<number>;
12
+ tDiffuse: {
13
+ value: null;
14
+ };
15
+ tNormal: {
16
+ value: null;
17
+ };
18
+ tMetalness: {
19
+ value: null;
20
+ };
21
+ tDepth: {
22
+ value: null;
23
+ };
24
+ cameraNear: {
25
+ value: null;
26
+ };
27
+ cameraFar: {
28
+ value: null;
29
+ };
30
+ resolution: {
31
+ value: Vector2;
32
+ };
33
+ cameraProjectionMatrix: {
34
+ value: Matrix4;
35
+ };
36
+ cameraInverseProjectionMatrix: {
37
+ value: Matrix4;
38
+ };
39
+ opacity: {
40
+ value: number;
41
+ };
42
+ maxDistance: {
43
+ value: number;
44
+ };
45
+ cameraRange: {
46
+ value: number;
47
+ };
48
+ surfDist: {
49
+ value: number;
50
+ };
51
+ thickTolerance: {
52
+ value: number;
53
+ };
31
54
  };
32
55
  vertexShader: string;
33
56
  fragmentShader: string;
34
- }
35
-
36
- export const SSRDepthShader: SSRDepthShader;
37
- export interface SSRDepthShader {
57
+ };
58
+ export declare const SSRDepthShader: {
38
59
  defines: {
39
60
  PERSPECTIVE_CAMERA: number;
40
61
  };
41
62
  uniforms: {
42
- tDepth: IUniform<Texture | null>;
43
- cameraNear: IUniform<number>;
44
- cameraFar: IUniform<number>;
63
+ tDepth: {
64
+ value: null;
65
+ };
66
+ cameraNear: {
67
+ value: null;
68
+ };
69
+ cameraFar: {
70
+ value: null;
71
+ };
45
72
  };
46
73
  vertexShader: string;
47
74
  fragmentShader: string;
48
- }
49
-
50
- export const SSRBlurShader: SSRBlurShader;
51
- export interface SSRBlurShader {
75
+ };
76
+ export declare const SSRBlurShader: {
52
77
  uniforms: {
53
- tDiffuse: IUniform<Texture | null>;
54
- resolution: IUniform<Vector2>;
55
- opacity: IUniform<number>;
78
+ tDiffuse: {
79
+ value: null;
80
+ };
81
+ resolution: {
82
+ value: Vector2;
83
+ };
84
+ opacity: {
85
+ value: number;
86
+ };
56
87
  };
57
88
  vertexShader: string;
58
89
  fragmentShader: string;
59
- }
90
+ };
@@ -5,7 +5,7 @@ import { Vector2, Matrix4 } from 'three';
5
5
  * https://lettier.github.io/3d-game-shaders-for-beginners/screen-space-reflection.html
6
6
  */
7
7
 
8
- var SSRShader = {
8
+ const SSRShader = {
9
9
  defines: {
10
10
  MAX_STEP: 0,
11
11
  isPerspectiveCamera: true,
@@ -241,7 +241,7 @@ var SSRShader = {
241
241
  }
242
242
  `
243
243
  };
244
- var SSRDepthShader = {
244
+ const SSRDepthShader = {
245
245
  defines: {
246
246
  PERSPECTIVE_CAMERA: 1
247
247
  },
@@ -310,7 +310,7 @@ var SSRDepthShader = {
310
310
 
311
311
  `
312
312
  };
313
- var SSRBlurShader = {
313
+ const SSRBlurShader = {
314
314
  uniforms: {
315
315
  tDiffuse: {
316
316
  value: null
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o={uniforms:{tDiffuse:{value:null},amount:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float amount;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 color = texture2D( tDiffuse, vUv );","\tvec3 c = color.rgb;","\tcolor.r = dot( c, vec3( 1.0 - 0.607 * amount, 0.769 * amount, 0.189 * amount ) );","\tcolor.g = dot( c, vec3( 0.349 * amount, 1.0 - 0.314 * amount, 0.168 * amount ) );","\tcolor.b = dot( c, vec3( 0.272 * amount, 0.534 * amount, 1.0 - 0.869 * amount ) );","\tgl_FragColor = vec4( min( vec3( 1.0 ), color.rgb ), color.a );","}"].join("\n")};exports.SepiaShader=o;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const o={uniforms:{tDiffuse:{value:null},amount:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float amount;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 color = texture2D( tDiffuse, vUv );","\tvec3 c = color.rgb;","\tcolor.r = dot( c, vec3( 1.0 - 0.607 * amount, 0.769 * amount, 0.189 * amount ) );","\tcolor.g = dot( c, vec3( 0.349 * amount, 1.0 - 0.314 * amount, 0.168 * amount ) );","\tcolor.b = dot( c, vec3( 0.272 * amount, 0.534 * amount, 1.0 - 0.869 * amount ) );","\tgl_FragColor = vec4( min( vec3( 1.0 ), color.rgb ), color.a );","}"].join("\n")};exports.SepiaShader=o;
@@ -1,9 +1,11 @@
1
- import { Uniform } from 'three';
2
-
3
- export const SepiaShader: {
1
+ export declare const SepiaShader: {
4
2
  uniforms: {
5
- tDiffuse: Uniform;
6
- amount: Uniform;
3
+ tDiffuse: {
4
+ value: null;
5
+ };
6
+ amount: {
7
+ value: number;
8
+ };
7
9
  };
8
10
  vertexShader: string;
9
11
  fragmentShader: string;
@@ -3,7 +3,7 @@
3
3
  * based on glfx.js sepia shader
4
4
  * https://github.com/evanw/glfx.js
5
5
  */
6
- var SepiaShader = {
6
+ const SepiaShader = {
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},resolution:{value:new(require("three").Vector2)}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec2 resolution;","varying vec2 vUv;","void main() {","\tvec2 texel = vec2( 1.0 / resolution.x, 1.0 / resolution.y );","\tconst mat3 Gx = mat3( -1, -2, -1, 0, 0, 0, 1, 2, 1 );","\tconst mat3 Gy = mat3( -1, 0, 1, -2, 0, 2, -1, 0, 1 );","\tfloat tx0y0 = texture2D( tDiffuse, vUv + texel * vec2( -1, -1 ) ).r;","\tfloat tx0y1 = texture2D( tDiffuse, vUv + texel * vec2( -1, 0 ) ).r;","\tfloat tx0y2 = texture2D( tDiffuse, vUv + texel * vec2( -1, 1 ) ).r;","\tfloat tx1y0 = texture2D( tDiffuse, vUv + texel * vec2( 0, -1 ) ).r;","\tfloat tx1y1 = texture2D( tDiffuse, vUv + texel * vec2( 0, 0 ) ).r;","\tfloat tx1y2 = texture2D( tDiffuse, vUv + texel * vec2( 0, 1 ) ).r;","\tfloat tx2y0 = texture2D( tDiffuse, vUv + texel * vec2( 1, -1 ) ).r;","\tfloat tx2y1 = texture2D( tDiffuse, vUv + texel * vec2( 1, 0 ) ).r;","\tfloat tx2y2 = texture2D( tDiffuse, vUv + texel * vec2( 1, 1 ) ).r;","\tfloat valueGx = Gx[0][0] * tx0y0 + Gx[1][0] * tx1y0 + Gx[2][0] * tx2y0 + ","\t\tGx[0][1] * tx0y1 + Gx[1][1] * tx1y1 + Gx[2][1] * tx2y1 + ","\t\tGx[0][2] * tx0y2 + Gx[1][2] * tx1y2 + Gx[2][2] * tx2y2; ","\tfloat valueGy = Gy[0][0] * tx0y0 + Gy[1][0] * tx1y0 + Gy[2][0] * tx2y0 + ","\t\tGy[0][1] * tx0y1 + Gy[1][1] * tx1y1 + Gy[2][1] * tx2y1 + ","\t\tGy[0][2] * tx0y2 + Gy[1][2] * tx1y2 + Gy[2][2] * tx2y2; ","\tfloat G = sqrt( ( valueGx * valueGx ) + ( valueGy * valueGy ) );","\tgl_FragColor = vec4( vec3( G ), 1 );","}"].join("\n")};exports.SobelOperatorShader=t;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t={uniforms:{tDiffuse:{value:null},resolution:{value:new(require("three").Vector2)}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec2 resolution;","varying vec2 vUv;","void main() {","\tvec2 texel = vec2( 1.0 / resolution.x, 1.0 / resolution.y );","\tconst mat3 Gx = mat3( -1, -2, -1, 0, 0, 0, 1, 2, 1 );","\tconst mat3 Gy = mat3( -1, 0, 1, -2, 0, 2, -1, 0, 1 );","\tfloat tx0y0 = texture2D( tDiffuse, vUv + texel * vec2( -1, -1 ) ).r;","\tfloat tx0y1 = texture2D( tDiffuse, vUv + texel * vec2( -1, 0 ) ).r;","\tfloat tx0y2 = texture2D( tDiffuse, vUv + texel * vec2( -1, 1 ) ).r;","\tfloat tx1y0 = texture2D( tDiffuse, vUv + texel * vec2( 0, -1 ) ).r;","\tfloat tx1y1 = texture2D( tDiffuse, vUv + texel * vec2( 0, 0 ) ).r;","\tfloat tx1y2 = texture2D( tDiffuse, vUv + texel * vec2( 0, 1 ) ).r;","\tfloat tx2y0 = texture2D( tDiffuse, vUv + texel * vec2( 1, -1 ) ).r;","\tfloat tx2y1 = texture2D( tDiffuse, vUv + texel * vec2( 1, 0 ) ).r;","\tfloat tx2y2 = texture2D( tDiffuse, vUv + texel * vec2( 1, 1 ) ).r;","\tfloat valueGx = Gx[0][0] * tx0y0 + Gx[1][0] * tx1y0 + Gx[2][0] * tx2y0 + ","\t\tGx[0][1] * tx0y1 + Gx[1][1] * tx1y1 + Gx[2][1] * tx2y1 + ","\t\tGx[0][2] * tx0y2 + Gx[1][2] * tx1y2 + Gx[2][2] * tx2y2; ","\tfloat valueGy = Gy[0][0] * tx0y0 + Gy[1][0] * tx1y0 + Gy[2][0] * tx2y0 + ","\t\tGy[0][1] * tx0y1 + Gy[1][1] * tx1y1 + Gy[2][1] * tx2y1 + ","\t\tGy[0][2] * tx0y2 + Gy[1][2] * tx1y2 + Gy[2][2] * tx2y2; ","\tfloat G = sqrt( ( valueGx * valueGx ) + ( valueGy * valueGy ) );","\tgl_FragColor = vec4( vec3( G ), 1 );","}"].join("\n")};exports.SobelOperatorShader=t;
@@ -1,9 +1,12 @@
1
- import { Uniform } from 'three';
2
-
3
- export const SobelOperatorShader: {
1
+ import { Vector2 } from 'three';
2
+ export declare const SobelOperatorShader: {
4
3
  uniforms: {
5
- tDiffuse: Uniform;
6
- resolution: Uniform;
4
+ tDiffuse: {
5
+ value: null;
6
+ };
7
+ resolution: {
8
+ value: Vector2;
9
+ };
7
10
  };
8
11
  vertexShader: string;
9
12
  fragmentShader: string;
@@ -7,7 +7,7 @@ import { Vector2 } from 'three';
7
7
  *
8
8
  */
9
9
 
10
- var SobelOperatorShader = {
10
+ const SobelOperatorShader = {
11
11
  uniforms: {
12
12
  tDiffuse: {
13
13
  value: null
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");var t,i,n,r=e.ShaderChunk.meshphong_frag.slice(0,e.ShaderChunk.meshphong_frag.indexOf("void main() {")),s=e.ShaderChunk.meshphong_frag.slice(e.ShaderChunk.meshphong_frag.indexOf("void main() {")),o={uniforms:e.UniformsUtils.merge([e.ShaderLib.phong.uniforms,{thicknessMap:{value:null},thicknessColor:{value:new e.Color(16777215)},thicknessDistortion:{value:.1},thicknessAmbient:{value:0},thicknessAttenuation:{value:.1},thicknessPower:{value:2},thicknessScale:{value:10}}]),vertexShader:["#define USE_UV",e.ShaderChunk.meshphong_vert].join("\n"),fragmentShader:["#define USE_UV","#define SUBSURFACE",r,"uniform sampler2D thicknessMap;","uniform float thicknessPower;","uniform float thicknessScale;","uniform float thicknessDistortion;","uniform float thicknessAmbient;","uniform float thicknessAttenuation;","uniform vec3 thicknessColor;","void RE_Direct_Scattering(const in IncidentLight directLight, const in vec2 uv, const in GeometricContext geometry, inout ReflectedLight reflectedLight) {","\tvec3 thickness = thicknessColor * texture2D(thicknessMap, uv).r;","\tvec3 scatteringHalf = normalize(directLight.direction + (geometry.normal * thicknessDistortion));","\tfloat scatteringDot = pow(saturate(dot(geometry.viewDir, -scatteringHalf)), thicknessPower) * thicknessScale;","\tvec3 scatteringIllu = (scatteringDot + thicknessAmbient) * thickness;","\treflectedLight.directDiffuse += scatteringIllu * thicknessAttenuation * directLight.color;","}",s.replace("#include <lights_fragment_begin>",(t=e.ShaderChunk.lights_fragment_begin,i="RE_Direct( directLight, geometry, material, reflectedLight );",n=["RE_Direct( directLight, geometry, material, reflectedLight );","#if defined( SUBSURFACE ) && defined( USE_UV )"," RE_Direct_Scattering(directLight, vUv, geometry, reflectedLight);","#endif"].join("\n"),t.split(i).join(n)))].join("\n")};exports.SubsurfaceScatteringShader=o;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");const t=e.ShaderChunk.meshphong_frag.slice(0,e.ShaderChunk.meshphong_frag.indexOf("void main() {")),i=e.ShaderChunk.meshphong_frag.slice(e.ShaderChunk.meshphong_frag.indexOf("void main() {")),n={uniforms:e.UniformsUtils.merge([e.ShaderLib.phong.uniforms,{thicknessMap:{value:null},thicknessColor:{value:new e.Color(16777215)},thicknessDistortion:{value:.1},thicknessAmbient:{value:0},thicknessAttenuation:{value:.1},thicknessPower:{value:2},thicknessScale:{value:10}}]),vertexShader:["#define USE_UV",e.ShaderChunk.meshphong_vert].join("\n"),fragmentShader:["#define USE_UV","#define SUBSURFACE",t,"uniform sampler2D thicknessMap;","uniform float thicknessPower;","uniform float thicknessScale;","uniform float thicknessDistortion;","uniform float thicknessAmbient;","uniform float thicknessAttenuation;","uniform vec3 thicknessColor;","void RE_Direct_Scattering(const in IncidentLight directLight, const in vec2 uv, const in GeometricContext geometry, inout ReflectedLight reflectedLight) {","\tvec3 thickness = thicknessColor * texture2D(thicknessMap, uv).r;","\tvec3 scatteringHalf = normalize(directLight.direction + (geometry.normal * thicknessDistortion));","\tfloat scatteringDot = pow(saturate(dot(geometry.viewDir, -scatteringHalf)), thicknessPower) * thicknessScale;","\tvec3 scatteringIllu = (scatteringDot + thicknessAmbient) * thickness;","\treflectedLight.directDiffuse += scatteringIllu * thicknessAttenuation * directLight.color;","}",i.replace("#include <lights_fragment_begin>",(r=e.ShaderChunk.lights_fragment_begin,s="RE_Direct( directLight, geometry, material, reflectedLight );",o=["RE_Direct( directLight, geometry, material, reflectedLight );","#if defined( SUBSURFACE ) && defined( USE_UV )"," RE_Direct_Scattering(directLight, vUv, geometry, reflectedLight);","#endif"].join("\n"),r.split(s).join(o)))].join("\n")};var r,s,o;exports.SubsurfaceScatteringShader=n;
@@ -1,37 +1,5 @@
1
- import { Uniform } from 'three';
2
-
3
- export const SubsurfaceScatteringShader: {
4
- uniforms: {
5
- alphaMap: Uniform;
6
- ambientLightColor: Uniform;
7
- color: Uniform;
8
- diffuse: Uniform;
9
- directionalLights: Uniform;
10
- directionalShadowMap: Uniform;
11
- directionalShadowMatrix: Uniform;
12
- emissive: Uniform;
13
- hemisphereLights: Uniform;
14
- lightProbe: Uniform;
15
- map: Uniform;
16
- opacity: Uniform;
17
- pointLights: Uniform;
18
- pointShadowMap: Uniform;
19
- pointShadowMatrix: Uniform;
20
- rectAreaLights: Uniform;
21
- shininess: Uniform;
22
- specular: Uniform;
23
- spotLights: Uniform;
24
- spotShadowMap: Uniform;
25
- spotShadowMatrix: Uniform;
26
- thicknessAmbient: Uniform;
27
- thicknessAttenuation: Uniform;
28
- thicknessColor: Uniform;
29
- thicknessDistortion: Uniform;
30
- thicknessMap: Uniform;
31
- thicknessPower: Uniform;
32
- thicknessScale: Uniform;
33
- uvTransform: Uniform;
34
- };
1
+ export declare const SubsurfaceScatteringShader: {
2
+ uniforms: any;
35
3
  vertexShader: string;
36
4
  fragmentShader: string;
37
5
  };
@@ -12,9 +12,9 @@ function replaceAll(string, find, replace) {
12
12
  return string.split(find).join(replace);
13
13
  }
14
14
 
15
- var meshphong_frag_head = ShaderChunk['meshphong_frag'].slice(0, ShaderChunk['meshphong_frag'].indexOf('void main() {'));
16
- var meshphong_frag_body = ShaderChunk['meshphong_frag'].slice(ShaderChunk['meshphong_frag'].indexOf('void main() {'));
17
- var SubsurfaceScatteringShader = {
15
+ const meshphong_frag_head = ShaderChunk['meshphong_frag'].slice(0, ShaderChunk['meshphong_frag'].indexOf('void main() {'));
16
+ const meshphong_frag_body = ShaderChunk['meshphong_frag'].slice(ShaderChunk['meshphong_frag'].indexOf('void main() {'));
17
+ const SubsurfaceScatteringShader = {
18
18
  uniforms: UniformsUtils.merge([ShaderLib['phong'].uniforms, {
19
19
  thicknessMap: {
20
20
  value: null
@@ -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:["uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 tex = texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );","\tvec4 newTex = vec4(tex.r, (tex.g + tex.b) * .5, (tex.g + tex.b) * .5, 1.0);","\tgl_FragColor = newTex;","}"].join("\n")};exports.TechnicolorShader=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:["uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 tex = texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );","\tvec4 newTex = vec4(tex.r, (tex.g + tex.b) * .5, (tex.g + tex.b) * .5, 1.0);","\tgl_FragColor = newTex;","}"].join("\n")};exports.TechnicolorShader=e;
@@ -1,8 +1,8 @@
1
- import { Uniform } from 'three';
2
-
3
- export const TechnicolorShader: {
1
+ export declare const TechnicolorShader: {
4
2
  uniforms: {
5
- tDiffuse: Uniform;
3
+ tDiffuse: {
4
+ value: null;
5
+ };
6
6
  };
7
7
  vertexShader: string;
8
8
  fragmentShader: string;
@@ -4,7 +4,7 @@
4
4
  * More historical info here: http://www.widescreenmuseum.com/oldcolor/technicolor1.htm
5
5
  * Demo here: http://charliehoey.com/technicolor_shader/shader_test.html
6
6
  */
7
- var TechnicolorShader = {
7
+ const TechnicolorShader = {
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},averageLuminance:{value:1},luminanceMap:{value:null},maxLuminance:{value:16},minLuminance:{value:.01},middleGrey:{value:.6}},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;","uniform float middleGrey;","uniform float minLuminance;","uniform float maxLuminance;","#ifdef ADAPTED_LUMINANCE","\tuniform sampler2D luminanceMap;","#else","\tuniform float averageLuminance;","#endif","vec3 ToneMap( vec3 vColor ) {","\t#ifdef ADAPTED_LUMINANCE","\t\tfloat fLumAvg = texture2D(luminanceMap, vec2(0.5, 0.5)).r;","\t#else","\t\tfloat fLumAvg = averageLuminance;","\t#endif","\tfloat fLumPixel = linearToRelativeLuminance( vColor );","\tfloat fLumScaled = (fLumPixel * middleGrey) / max( minLuminance, fLumAvg );","\tfloat fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (maxLuminance * maxLuminance)))) / (1.0 + fLumScaled);","\treturn fLumCompressed * vColor;","}","void main() {","\tvec4 texel = texture2D( tDiffuse, vUv );","\tgl_FragColor = vec4( ToneMap( texel.xyz ), texel.w );","}"].join("\n")};exports.ToneMapShader=e;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={uniforms:{tDiffuse:{value:null},averageLuminance:{value:1},luminanceMap:{value:null},maxLuminance:{value:16},minLuminance:{value:.01},middleGrey:{value:.6}},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;","uniform float middleGrey;","uniform float minLuminance;","uniform float maxLuminance;","#ifdef ADAPTED_LUMINANCE","\tuniform sampler2D luminanceMap;","#else","\tuniform float averageLuminance;","#endif","vec3 ToneMap( vec3 vColor ) {","\t#ifdef ADAPTED_LUMINANCE","\t\tfloat fLumAvg = texture2D(luminanceMap, vec2(0.5, 0.5)).r;","\t#else","\t\tfloat fLumAvg = averageLuminance;","\t#endif","\tfloat fLumPixel = linearToRelativeLuminance( vColor );","\tfloat fLumScaled = (fLumPixel * middleGrey) / max( minLuminance, fLumAvg );","\tfloat fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (maxLuminance * maxLuminance)))) / (1.0 + fLumScaled);","\treturn fLumCompressed * vColor;","}","void main() {","\tvec4 texel = texture2D( tDiffuse, vUv );","\tgl_FragColor = vec4( ToneMap( texel.xyz ), texel.w );","}"].join("\n")};exports.ToneMapShader=e;
@@ -1,13 +1,23 @@
1
- import { Uniform } from 'three';
2
-
3
- export const ToneMapShader: {
1
+ export declare const ToneMapShader: {
4
2
  uniforms: {
5
- tDiffuse: Uniform;
6
- averageLuminance: Uniform;
7
- luminanceMap: Uniform;
8
- maxLuminance: Uniform;
9
- minLuminance: Uniform;
10
- middleGrey: Uniform;
3
+ tDiffuse: {
4
+ value: null;
5
+ };
6
+ averageLuminance: {
7
+ value: number;
8
+ };
9
+ luminanceMap: {
10
+ value: null;
11
+ };
12
+ maxLuminance: {
13
+ value: number;
14
+ };
15
+ minLuminance: {
16
+ value: number;
17
+ };
18
+ middleGrey: {
19
+ value: number;
20
+ };
11
21
  };
12
22
  vertexShader: string;
13
23
  fragmentShader: string;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Full-screen tone-mapping shader based on http://www.cis.rit.edu/people/faculty/ferwerda/publications/sig02_paper.pdf
3
3
  */
4
- var ToneMapShader = {
4
+ const ToneMapShader = {
5
5
  uniforms: {
6
6
  tDiffuse: {
7
7
  value: null
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("three"),i={uniforms:{uDirLightPos:{value:new o.Vector3},uDirLightColor:{value:new o.Color(15658734)},uAmbientLightColor:{value:new o.Color(328965)},uBaseColor:{value:new o.Color(16777215)}},vertexShader:["varying vec3 vNormal;","varying vec3 vRefract;","void main() {","\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );","\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","\tvec3 worldNormal = normalize ( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );","\tvNormal = normalize( normalMatrix * normal );","\tvec3 I = worldPosition.xyz - cameraPosition;","\tvRefract = refract( normalize( I ), worldNormal, 1.02 );","\tgl_Position = projectionMatrix * mvPosition;","}"].join("\n"),fragmentShader:["uniform vec3 uBaseColor;","uniform vec3 uDirLightPos;","uniform vec3 uDirLightColor;","uniform vec3 uAmbientLightColor;","varying vec3 vNormal;","varying vec3 vRefract;","void main() {","\tfloat directionalLightWeighting = max( dot( normalize( vNormal ), uDirLightPos ), 0.0);","\tvec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;","\tfloat intensity = smoothstep( - 0.5, 1.0, pow( length(lightWeighting), 20.0 ) );","\tintensity += length(lightWeighting) * 0.2;","\tfloat cameraWeighting = dot( normalize( vNormal ), vRefract );","\tintensity += pow( 1.0 - length( cameraWeighting ), 6.0 );","\tintensity = intensity * 0.2 + 0.3;","\tif ( intensity < 0.50 ) {","\t\tgl_FragColor = vec4( 2.0 * intensity * uBaseColor, 1.0 );","\t} else {","\t\tgl_FragColor = vec4( 1.0 - 2.0 * ( 1.0 - intensity ) * ( 1.0 - uBaseColor ), 1.0 );","}","}"].join("\n")},r={uniforms:{uDirLightPos:{value:new o.Vector3},uDirLightColor:{value:new o.Color(15658734)},uAmbientLightColor:{value:new o.Color(328965)},uBaseColor:{value:new o.Color(15658734)},uLineColor1:{value:new o.Color(8421504)},uLineColor2:{value:new o.Color(0)},uLineColor3:{value:new o.Color(0)},uLineColor4:{value:new o.Color(0)}},vertexShader:["varying vec3 vNormal;","void main() {","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","\tvNormal = normalize( normalMatrix * normal );","}"].join("\n"),fragmentShader:["uniform vec3 uBaseColor;","uniform vec3 uLineColor1;","uniform vec3 uLineColor2;","uniform vec3 uLineColor3;","uniform vec3 uLineColor4;","uniform vec3 uDirLightPos;","uniform vec3 uDirLightColor;","uniform vec3 uAmbientLightColor;","varying vec3 vNormal;","void main() {","\tfloat camera = max( dot( normalize( vNormal ), vec3( 0.0, 0.0, 1.0 ) ), 0.4);","\tfloat light = max( dot( normalize( vNormal ), uDirLightPos ), 0.0);","\tgl_FragColor = vec4( uBaseColor, 1.0 );","\tif ( length(uAmbientLightColor + uDirLightColor * light) < 1.00 ) {","\t\tgl_FragColor *= vec4( uLineColor1, 1.0 );","\t}","\tif ( length(uAmbientLightColor + uDirLightColor * camera) < 0.50 ) {","\t\tgl_FragColor *= vec4( uLineColor2, 1.0 );","\t}","}"].join("\n")},e={uniforms:{uDirLightPos:{value:new o.Vector3},uDirLightColor:{value:new o.Color(15658734)},uAmbientLightColor:{value:new o.Color(328965)},uBaseColor:{value:new o.Color(16777215)},uLineColor1:{value:new o.Color(0)},uLineColor2:{value:new o.Color(0)},uLineColor3:{value:new o.Color(0)},uLineColor4:{value:new o.Color(0)}},vertexShader:["varying vec3 vNormal;","void main() {","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","\tvNormal = normalize( normalMatrix * normal );","}"].join("\n"),fragmentShader:["uniform vec3 uBaseColor;","uniform vec3 uLineColor1;","uniform vec3 uLineColor2;","uniform vec3 uLineColor3;","uniform vec3 uLineColor4;","uniform vec3 uDirLightPos;","uniform vec3 uDirLightColor;","uniform vec3 uAmbientLightColor;","varying vec3 vNormal;","void main() {","\tfloat directionalLightWeighting = max( dot( normalize(vNormal), uDirLightPos ), 0.0);","\tvec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;","\tgl_FragColor = vec4( uBaseColor, 1.0 );","\tif ( length(lightWeighting) < 1.00 ) {","\t\tif ( mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) {","\t\t\tgl_FragColor = vec4( uLineColor1, 1.0 );","\t\t}","\t}","\tif ( length(lightWeighting) < 0.75 ) {","\t\tif (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) {","\t\t\tgl_FragColor = vec4( uLineColor2, 1.0 );","\t\t}","\t}","\tif ( length(lightWeighting) < 0.50 ) {","\t\tif (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0) {","\t\t\tgl_FragColor = vec4( uLineColor3, 1.0 );","\t\t}","\t}","\tif ( length(lightWeighting) < 0.3465 ) {","\t\tif (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0) {","\t\t\tgl_FragColor = vec4( uLineColor4, 1.0 );","\t}","\t}","}"].join("\n")},t={uniforms:{uDirLightPos:{value:new o.Vector3},uDirLightColor:{value:new o.Color(15658734)},uAmbientLightColor:{value:new o.Color(328965)},uBaseColor:{value:new o.Color(16777215)},uLineColor1:{value:new o.Color(0)}},vertexShader:["varying vec3 vNormal;","void main() {","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","\tvNormal = normalize( normalMatrix * normal );","}"].join("\n"),fragmentShader:["uniform vec3 uBaseColor;","uniform vec3 uLineColor1;","uniform vec3 uLineColor2;","uniform vec3 uLineColor3;","uniform vec3 uLineColor4;","uniform vec3 uDirLightPos;","uniform vec3 uDirLightColor;","uniform vec3 uAmbientLightColor;","varying vec3 vNormal;","void main() {","float directionalLightWeighting = max( dot( normalize(vNormal), uDirLightPos ), 0.0);","vec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;","gl_FragColor = vec4( uBaseColor, 1.0 );","if ( length(lightWeighting) < 1.00 ) {","\t\tif ( ( mod(gl_FragCoord.x, 4.001) + mod(gl_FragCoord.y, 4.0) ) > 6.00 ) {","\t\t\tgl_FragColor = vec4( uLineColor1, 1.0 );","\t\t}","\t}","\tif ( length(lightWeighting) < 0.50 ) {","\t\tif ( ( mod(gl_FragCoord.x + 2.0, 4.001) + mod(gl_FragCoord.y + 2.0, 4.0) ) > 6.00 ) {","\t\t\tgl_FragColor = vec4( uLineColor1, 1.0 );","\t\t}","\t}","}"].join("\n")};exports.ToonShader1=i,exports.ToonShader2=r,exports.ToonShaderDotted=t,exports.ToonShaderHatching=e;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("three");const i={uniforms:{uDirLightPos:{value:new o.Vector3},uDirLightColor:{value:new o.Color(15658734)},uAmbientLightColor:{value:new o.Color(328965)},uBaseColor:{value:new o.Color(16777215)}},vertexShader:["varying vec3 vNormal;","varying vec3 vRefract;","void main() {","\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );","\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","\tvec3 worldNormal = normalize ( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );","\tvNormal = normalize( normalMatrix * normal );","\tvec3 I = worldPosition.xyz - cameraPosition;","\tvRefract = refract( normalize( I ), worldNormal, 1.02 );","\tgl_Position = projectionMatrix * mvPosition;","}"].join("\n"),fragmentShader:["uniform vec3 uBaseColor;","uniform vec3 uDirLightPos;","uniform vec3 uDirLightColor;","uniform vec3 uAmbientLightColor;","varying vec3 vNormal;","varying vec3 vRefract;","void main() {","\tfloat directionalLightWeighting = max( dot( normalize( vNormal ), uDirLightPos ), 0.0);","\tvec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;","\tfloat intensity = smoothstep( - 0.5, 1.0, pow( length(lightWeighting), 20.0 ) );","\tintensity += length(lightWeighting) * 0.2;","\tfloat cameraWeighting = dot( normalize( vNormal ), vRefract );","\tintensity += pow( 1.0 - length( cameraWeighting ), 6.0 );","\tintensity = intensity * 0.2 + 0.3;","\tif ( intensity < 0.50 ) {","\t\tgl_FragColor = vec4( 2.0 * intensity * uBaseColor, 1.0 );","\t} else {","\t\tgl_FragColor = vec4( 1.0 - 2.0 * ( 1.0 - intensity ) * ( 1.0 - uBaseColor ), 1.0 );","}","}"].join("\n")},r={uniforms:{uDirLightPos:{value:new o.Vector3},uDirLightColor:{value:new o.Color(15658734)},uAmbientLightColor:{value:new o.Color(328965)},uBaseColor:{value:new o.Color(15658734)},uLineColor1:{value:new o.Color(8421504)},uLineColor2:{value:new o.Color(0)},uLineColor3:{value:new o.Color(0)},uLineColor4:{value:new o.Color(0)}},vertexShader:["varying vec3 vNormal;","void main() {","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","\tvNormal = normalize( normalMatrix * normal );","}"].join("\n"),fragmentShader:["uniform vec3 uBaseColor;","uniform vec3 uLineColor1;","uniform vec3 uLineColor2;","uniform vec3 uLineColor3;","uniform vec3 uLineColor4;","uniform vec3 uDirLightPos;","uniform vec3 uDirLightColor;","uniform vec3 uAmbientLightColor;","varying vec3 vNormal;","void main() {","\tfloat camera = max( dot( normalize( vNormal ), vec3( 0.0, 0.0, 1.0 ) ), 0.4);","\tfloat light = max( dot( normalize( vNormal ), uDirLightPos ), 0.0);","\tgl_FragColor = vec4( uBaseColor, 1.0 );","\tif ( length(uAmbientLightColor + uDirLightColor * light) < 1.00 ) {","\t\tgl_FragColor *= vec4( uLineColor1, 1.0 );","\t}","\tif ( length(uAmbientLightColor + uDirLightColor * camera) < 0.50 ) {","\t\tgl_FragColor *= vec4( uLineColor2, 1.0 );","\t}","}"].join("\n")},e={uniforms:{uDirLightPos:{value:new o.Vector3},uDirLightColor:{value:new o.Color(15658734)},uAmbientLightColor:{value:new o.Color(328965)},uBaseColor:{value:new o.Color(16777215)},uLineColor1:{value:new o.Color(0)},uLineColor2:{value:new o.Color(0)},uLineColor3:{value:new o.Color(0)},uLineColor4:{value:new o.Color(0)}},vertexShader:["varying vec3 vNormal;","void main() {","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","\tvNormal = normalize( normalMatrix * normal );","}"].join("\n"),fragmentShader:["uniform vec3 uBaseColor;","uniform vec3 uLineColor1;","uniform vec3 uLineColor2;","uniform vec3 uLineColor3;","uniform vec3 uLineColor4;","uniform vec3 uDirLightPos;","uniform vec3 uDirLightColor;","uniform vec3 uAmbientLightColor;","varying vec3 vNormal;","void main() {","\tfloat directionalLightWeighting = max( dot( normalize(vNormal), uDirLightPos ), 0.0);","\tvec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;","\tgl_FragColor = vec4( uBaseColor, 1.0 );","\tif ( length(lightWeighting) < 1.00 ) {","\t\tif ( mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) {","\t\t\tgl_FragColor = vec4( uLineColor1, 1.0 );","\t\t}","\t}","\tif ( length(lightWeighting) < 0.75 ) {","\t\tif (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) {","\t\t\tgl_FragColor = vec4( uLineColor2, 1.0 );","\t\t}","\t}","\tif ( length(lightWeighting) < 0.50 ) {","\t\tif (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0) {","\t\t\tgl_FragColor = vec4( uLineColor3, 1.0 );","\t\t}","\t}","\tif ( length(lightWeighting) < 0.3465 ) {","\t\tif (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0) {","\t\t\tgl_FragColor = vec4( uLineColor4, 1.0 );","\t}","\t}","}"].join("\n")},t={uniforms:{uDirLightPos:{value:new o.Vector3},uDirLightColor:{value:new o.Color(15658734)},uAmbientLightColor:{value:new o.Color(328965)},uBaseColor:{value:new o.Color(16777215)},uLineColor1:{value:new o.Color(0)}},vertexShader:["varying vec3 vNormal;","void main() {","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","\tvNormal = normalize( normalMatrix * normal );","}"].join("\n"),fragmentShader:["uniform vec3 uBaseColor;","uniform vec3 uLineColor1;","uniform vec3 uLineColor2;","uniform vec3 uLineColor3;","uniform vec3 uLineColor4;","uniform vec3 uDirLightPos;","uniform vec3 uDirLightColor;","uniform vec3 uAmbientLightColor;","varying vec3 vNormal;","void main() {","float directionalLightWeighting = max( dot( normalize(vNormal), uDirLightPos ), 0.0);","vec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;","gl_FragColor = vec4( uBaseColor, 1.0 );","if ( length(lightWeighting) < 1.00 ) {","\t\tif ( ( mod(gl_FragCoord.x, 4.001) + mod(gl_FragCoord.y, 4.0) ) > 6.00 ) {","\t\t\tgl_FragColor = vec4( uLineColor1, 1.0 );","\t\t}","\t}","\tif ( length(lightWeighting) < 0.50 ) {","\t\tif ( ( mod(gl_FragCoord.x + 2.0, 4.001) + mod(gl_FragCoord.y + 2.0, 4.0) ) > 6.00 ) {","\t\t\tgl_FragColor = vec4( uLineColor1, 1.0 );","\t\t}","\t}","}"].join("\n")};exports.ToonShader1=i,exports.ToonShader2=r,exports.ToonShaderDotted=t,exports.ToonShaderHatching=e;
@@ -1,53 +1,99 @@
1
- import { Uniform } from 'three';
2
-
3
- export const ToonShader1: {
1
+ import { Color, Vector3 } from 'three';
2
+ export declare const ToonShader1: {
4
3
  uniforms: {
5
- uDirLightPos: Uniform;
6
- uDirLightColor: Uniform;
7
- uAmbientLightColor: Uniform;
8
- uBaseColor: Uniform;
4
+ uDirLightPos: {
5
+ value: Vector3;
6
+ };
7
+ uDirLightColor: {
8
+ value: Color;
9
+ };
10
+ uAmbientLightColor: {
11
+ value: Color;
12
+ };
13
+ uBaseColor: {
14
+ value: Color;
15
+ };
9
16
  };
10
17
  vertexShader: string;
11
18
  fragmentShader: string;
12
19
  };
13
-
14
- export const ToonShader2: {
20
+ export declare const ToonShader2: {
15
21
  uniforms: {
16
- uDirLightPos: Uniform;
17
- uDirLightColor: Uniform;
18
- uAmbientLightColor: Uniform;
19
- uBaseColor: Uniform;
20
- uLineColor1: Uniform;
21
- uLineColor2: Uniform;
22
- uLineColor3: Uniform;
23
- uLineColor4: Uniform;
22
+ uDirLightPos: {
23
+ value: Vector3;
24
+ };
25
+ uDirLightColor: {
26
+ value: Color;
27
+ };
28
+ uAmbientLightColor: {
29
+ value: Color;
30
+ };
31
+ uBaseColor: {
32
+ value: Color;
33
+ };
34
+ uLineColor1: {
35
+ value: Color;
36
+ };
37
+ uLineColor2: {
38
+ value: Color;
39
+ };
40
+ uLineColor3: {
41
+ value: Color;
42
+ };
43
+ uLineColor4: {
44
+ value: Color;
45
+ };
24
46
  };
25
47
  vertexShader: string;
26
48
  fragmentShader: string;
27
49
  };
28
-
29
- export const ToonShaderHatching: {
50
+ export declare const ToonShaderHatching: {
30
51
  uniforms: {
31
- uDirLightPos: Uniform;
32
- uDirLightColor: Uniform;
33
- uAmbientLightColor: Uniform;
34
- uBaseColor: Uniform;
35
- uLineColor1: Uniform;
36
- uLineColor2: Uniform;
37
- uLineColor3: Uniform;
38
- uLineColor4: Uniform;
52
+ uDirLightPos: {
53
+ value: Vector3;
54
+ };
55
+ uDirLightColor: {
56
+ value: Color;
57
+ };
58
+ uAmbientLightColor: {
59
+ value: Color;
60
+ };
61
+ uBaseColor: {
62
+ value: Color;
63
+ };
64
+ uLineColor1: {
65
+ value: Color;
66
+ };
67
+ uLineColor2: {
68
+ value: Color;
69
+ };
70
+ uLineColor3: {
71
+ value: Color;
72
+ };
73
+ uLineColor4: {
74
+ value: Color;
75
+ };
39
76
  };
40
77
  vertexShader: string;
41
78
  fragmentShader: string;
42
79
  };
43
-
44
- export const ToonShaderDotted: {
80
+ export declare const ToonShaderDotted: {
45
81
  uniforms: {
46
- uDirLightPos: Uniform;
47
- uDirLightColor: Uniform;
48
- uAmbientLightColor: Uniform;
49
- uBaseColor: Uniform;
50
- uLineColor1: Uniform;
82
+ uDirLightPos: {
83
+ value: Vector3;
84
+ };
85
+ uDirLightColor: {
86
+ value: Color;
87
+ };
88
+ uAmbientLightColor: {
89
+ value: Color;
90
+ };
91
+ uBaseColor: {
92
+ value: Color;
93
+ };
94
+ uLineColor1: {
95
+ value: Color;
96
+ };
51
97
  };
52
98
  vertexShader: string;
53
99
  fragmentShader: string;
@@ -9,7 +9,7 @@ import { Vector3, Color } from 'three';
9
9
  * dotted
10
10
  */
11
11
 
12
- var ToonShader1 = {
12
+ const ToonShader1 = {
13
13
  uniforms: {
14
14
  uDirLightPos: {
15
15
  value: new Vector3()
@@ -27,7 +27,7 @@ var ToonShader1 = {
27
27
  vertexShader: ['varying vec3 vNormal;', 'varying vec3 vRefract;', 'void main() {', ' vec4 worldPosition = modelMatrix * vec4( position, 1.0 );', ' vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );', ' vec3 worldNormal = normalize ( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );', ' vNormal = normalize( normalMatrix * normal );', ' vec3 I = worldPosition.xyz - cameraPosition;', ' vRefract = refract( normalize( I ), worldNormal, 1.02 );', ' gl_Position = projectionMatrix * mvPosition;', '}'].join('\n'),
28
28
  fragmentShader: ['uniform vec3 uBaseColor;', 'uniform vec3 uDirLightPos;', 'uniform vec3 uDirLightColor;', 'uniform vec3 uAmbientLightColor;', 'varying vec3 vNormal;', 'varying vec3 vRefract;', 'void main() {', ' float directionalLightWeighting = max( dot( normalize( vNormal ), uDirLightPos ), 0.0);', ' vec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;', ' float intensity = smoothstep( - 0.5, 1.0, pow( length(lightWeighting), 20.0 ) );', ' intensity += length(lightWeighting) * 0.2;', ' float cameraWeighting = dot( normalize( vNormal ), vRefract );', ' intensity += pow( 1.0 - length( cameraWeighting ), 6.0 );', ' intensity = intensity * 0.2 + 0.3;', ' if ( intensity < 0.50 ) {', ' gl_FragColor = vec4( 2.0 * intensity * uBaseColor, 1.0 );', ' } else {', ' gl_FragColor = vec4( 1.0 - 2.0 * ( 1.0 - intensity ) * ( 1.0 - uBaseColor ), 1.0 );', '}', '}'].join('\n')
29
29
  };
30
- var ToonShader2 = {
30
+ const ToonShader2 = {
31
31
  uniforms: {
32
32
  uDirLightPos: {
33
33
  value: new Vector3()
@@ -57,7 +57,7 @@ var ToonShader2 = {
57
57
  vertexShader: ['varying vec3 vNormal;', 'void main() {', ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', ' vNormal = normalize( normalMatrix * normal );', '}'].join('\n'),
58
58
  fragmentShader: ['uniform vec3 uBaseColor;', 'uniform vec3 uLineColor1;', 'uniform vec3 uLineColor2;', 'uniform vec3 uLineColor3;', 'uniform vec3 uLineColor4;', 'uniform vec3 uDirLightPos;', 'uniform vec3 uDirLightColor;', 'uniform vec3 uAmbientLightColor;', 'varying vec3 vNormal;', 'void main() {', ' float camera = max( dot( normalize( vNormal ), vec3( 0.0, 0.0, 1.0 ) ), 0.4);', ' float light = max( dot( normalize( vNormal ), uDirLightPos ), 0.0);', ' gl_FragColor = vec4( uBaseColor, 1.0 );', ' if ( length(uAmbientLightColor + uDirLightColor * light) < 1.00 ) {', ' gl_FragColor *= vec4( uLineColor1, 1.0 );', ' }', ' if ( length(uAmbientLightColor + uDirLightColor * camera) < 0.50 ) {', ' gl_FragColor *= vec4( uLineColor2, 1.0 );', ' }', '}'].join('\n')
59
59
  };
60
- var ToonShaderHatching = {
60
+ const ToonShaderHatching = {
61
61
  uniforms: {
62
62
  uDirLightPos: {
63
63
  value: new Vector3()
@@ -87,7 +87,7 @@ var ToonShaderHatching = {
87
87
  vertexShader: ['varying vec3 vNormal;', 'void main() {', ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', ' vNormal = normalize( normalMatrix * normal );', '}'].join('\n'),
88
88
  fragmentShader: ['uniform vec3 uBaseColor;', 'uniform vec3 uLineColor1;', 'uniform vec3 uLineColor2;', 'uniform vec3 uLineColor3;', 'uniform vec3 uLineColor4;', 'uniform vec3 uDirLightPos;', 'uniform vec3 uDirLightColor;', 'uniform vec3 uAmbientLightColor;', 'varying vec3 vNormal;', 'void main() {', ' float directionalLightWeighting = max( dot( normalize(vNormal), uDirLightPos ), 0.0);', ' vec3 lightWeighting = uAmbientLightColor + uDirLightColor * directionalLightWeighting;', ' gl_FragColor = vec4( uBaseColor, 1.0 );', ' if ( length(lightWeighting) < 1.00 ) {', ' if ( mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) {', ' gl_FragColor = vec4( uLineColor1, 1.0 );', ' }', ' }', ' if ( length(lightWeighting) < 0.75 ) {', ' if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) {', ' gl_FragColor = vec4( uLineColor2, 1.0 );', ' }', ' }', ' if ( length(lightWeighting) < 0.50 ) {', ' if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0) {', ' gl_FragColor = vec4( uLineColor3, 1.0 );', ' }', ' }', ' if ( length(lightWeighting) < 0.3465 ) {', ' if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0) {', ' gl_FragColor = vec4( uLineColor4, 1.0 );', ' }', ' }', '}'].join('\n')
89
89
  };
90
- var ToonShaderDotted = {
90
+ const ToonShaderDotted = {
91
91
  uniforms: {
92
92
  uDirLightPos: {
93
93
  value: new Vector3()
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t={uniforms:{texture:{value:null},delta:{value:new(require("three").Vector2)(1,1)}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","#define ITERATIONS 10.0","uniform sampler2D texture;","uniform vec2 delta;","varying vec2 vUv;","void main() {","\tvec4 color = vec4( 0.0 );","\tfloat total = 0.0;","\tfloat offset = rand( vUv );","\tfor ( float t = -ITERATIONS; t <= ITERATIONS; t ++ ) {","\t\tfloat percent = ( t + offset - 0.5 ) / ITERATIONS;","\t\tfloat weight = 1.0 - abs( percent );","\t\tcolor += texture2D( texture, vUv + delta * percent ) * weight;","\t\ttotal += weight;","\t}","\tgl_FragColor = color / total;","}"].join("\n")};exports.TriangleBlurShader=t;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t={uniforms:{texture:{value:null},delta:{value:new(require("three").Vector2)(1,1)}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","#define ITERATIONS 10.0","uniform sampler2D texture;","uniform vec2 delta;","varying vec2 vUv;","void main() {","\tvec4 color = vec4( 0.0 );","\tfloat total = 0.0;","\tfloat offset = rand( vUv );","\tfor ( float t = -ITERATIONS; t <= ITERATIONS; t ++ ) {","\t\tfloat percent = ( t + offset - 0.5 ) / ITERATIONS;","\t\tfloat weight = 1.0 - abs( percent );","\t\tcolor += texture2D( texture, vUv + delta * percent ) * weight;","\t\ttotal += weight;","\t}","\tgl_FragColor = color / total;","}"].join("\n")};exports.TriangleBlurShader=t;
@@ -1,9 +1,12 @@
1
- import { Uniform } from 'three';
2
-
3
- export const TriangleBlurShader: {
1
+ import { Vector2 } from 'three';
2
+ export declare const TriangleBlurShader: {
4
3
  uniforms: {
5
- texture: Uniform;
6
- delta: Uniform;
4
+ texture: {
5
+ value: null;
6
+ };
7
+ delta: {
8
+ value: Vector2;
9
+ };
7
10
  };
8
11
  vertexShader: string;
9
12
  fragmentShader: string;
@@ -10,7 +10,7 @@ import { Vector2 } from 'three';
10
10
  * perpendicular triangle filters.
11
11
  */
12
12
 
13
- var TriangleBlurShader = {
13
+ const TriangleBlurShader = {
14
14
  uniforms: {
15
15
  texture: {
16
16
  value: null
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","#include <packing>","void main() {","\tfloat depth = 1.0 - unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );","\tgl_FragColor = vec4( vec3( depth ), opacity );","}"].join("\n")};exports.UnpackDepthRGBAShader=e;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","#include <packing>","void main() {","\tfloat depth = 1.0 - unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );","\tgl_FragColor = vec4( vec3( depth ), opacity );","}"].join("\n")};exports.UnpackDepthRGBAShader=e;