three-stdlib 2.8.10 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- package/index.cjs.js +1 -1
- package/index.d.ts +2 -52
- package/index.js +53 -52
- package/lines/LineMaterial.d.ts +7 -6
- package/modifiers/CurveModifier.cjs.js +1 -1
- package/modifiers/CurveModifier.d.ts +13 -9
- package/modifiers/CurveModifier.js +27 -30
- package/objects/Lensflare.cjs.js +1 -1
- package/objects/Lensflare.js +11 -3
- package/package.json +3 -3
- package/postprocessing/AfterimagePass.d.ts +2 -30
- package/postprocessing/RenderPixelatedPass.cjs.js +1 -0
- package/postprocessing/RenderPixelatedPass.js +213 -0
- package/shaders/ACESFilmicToneMappingShader.cjs.js +1 -1
- package/shaders/ACESFilmicToneMappingShader.d.ts +9 -0
- package/shaders/ACESFilmicToneMappingShader.js +1 -1
- package/shaders/AfterimageShader.d.ts +9 -15
- package/shaders/BasicShader.cjs.js +1 -1
- package/shaders/BasicShader.d.ts +5 -5
- package/shaders/BasicShader.js +1 -1
- package/shaders/BleachBypassShader.cjs.js +1 -1
- package/shaders/BleachBypassShader.d.ts +8 -9
- package/shaders/BleachBypassShader.js +1 -1
- package/shaders/BlendShader.cjs.js +1 -1
- package/shaders/BlendShader.d.ts +13 -7
- package/shaders/BlendShader.js +1 -1
- package/shaders/BokehShader.cjs.js +1 -1
- package/shaders/BokehShader.d.ts +18 -19
- package/shaders/BokehShader.js +1 -1
- package/shaders/BokehShader2.cjs.js +1 -1
- package/shaders/BokehShader2.d.ts +80 -34
- package/shaders/BokehShader2.js +2 -2
- package/shaders/BrightnessContrastShader.cjs.js +1 -1
- package/shaders/BrightnessContrastShader.d.ts +10 -6
- package/shaders/BrightnessContrastShader.js +1 -1
- package/shaders/ColorCorrectionShader.cjs.js +1 -1
- package/shaders/ColorCorrectionShader.d.ts +14 -7
- package/shaders/ColorCorrectionShader.js +1 -1
- package/shaders/ColorifyShader.cjs.js +1 -1
- package/shaders/ColorifyShader.d.ts +8 -5
- package/shaders/ColorifyShader.js +1 -1
- package/shaders/ConvolutionShader.cjs.js +1 -1
- package/shaders/ConvolutionShader.d.ts +15 -16
- package/shaders/ConvolutionShader.js +9 -14
- package/shaders/CopyShader.d.ts +8 -12
- package/shaders/DOFMipMapShader.cjs.js +1 -1
- package/shaders/DOFMipMapShader.d.ts +13 -7
- package/shaders/DOFMipMapShader.js +1 -1
- package/shaders/DepthLimitedBlurShader.cjs.js +1 -1
- package/shaders/DepthLimitedBlurShader.d.ts +26 -25
- package/shaders/DepthLimitedBlurShader.js +12 -16
- package/shaders/DigitalGlitch.cjs.js +1 -1
- package/shaders/DigitalGlitch.d.ts +34 -14
- package/shaders/DigitalGlitch.js +1 -10
- package/shaders/DotScreenShader.cjs.js +1 -1
- package/shaders/DotScreenShader.d.ts +17 -8
- package/shaders/DotScreenShader.js +1 -1
- package/shaders/FXAAShader.cjs.js +1 -1
- package/shaders/FXAAShader.d.ts +8 -5
- package/shaders/FXAAShader.js +1 -1
- package/shaders/FilmShader.cjs.js +1 -1
- package/shaders/FilmShader.d.ts +19 -9
- package/shaders/FilmShader.js +1 -1
- package/shaders/FocusShader.cjs.js +1 -1
- package/shaders/FocusShader.d.ts +16 -8
- package/shaders/FocusShader.js +1 -1
- package/shaders/FreiChenShader.cjs.js +1 -1
- package/shaders/FreiChenShader.d.ts +8 -5
- package/shaders/FreiChenShader.js +1 -1
- package/shaders/FresnelShader.cjs.js +1 -1
- package/shaders/FresnelShader.d.ts +21 -0
- package/shaders/FresnelShader.js +1 -1
- package/shaders/GammaCorrectionShader.d.ts +7 -7
- package/shaders/GodRaysShader.cjs.js +1 -1
- package/shaders/GodRaysShader.d.ts +38 -20
- package/shaders/GodRaysShader.js +4 -4
- package/shaders/HalftoneShader.cjs.js +1 -1
- package/shaders/HalftoneShader.d.ts +40 -16
- package/shaders/HalftoneShader.js +1 -1
- package/shaders/HorizontalBlurShader.d.ts +8 -8
- package/shaders/HorizontalTiltShiftShader.cjs.js +1 -1
- package/shaders/HorizontalTiltShiftShader.d.ts +10 -6
- package/shaders/HorizontalTiltShiftShader.js +1 -1
- package/shaders/HueSaturationShader.cjs.js +1 -1
- package/shaders/HueSaturationShader.d.ts +10 -6
- package/shaders/HueSaturationShader.js +1 -1
- package/shaders/KaleidoShader.cjs.js +1 -1
- package/shaders/KaleidoShader.d.ts +10 -6
- package/shaders/KaleidoShader.js +1 -1
- package/shaders/LuminosityHighPassShader.cjs.js +1 -1
- package/shaders/LuminosityHighPassShader.d.ts +17 -8
- package/shaders/LuminosityHighPassShader.js +1 -1
- package/shaders/LuminosityShader.cjs.js +1 -1
- package/shaders/LuminosityShader.d.ts +4 -4
- package/shaders/LuminosityShader.js +1 -1
- package/shaders/MirrorShader.cjs.js +1 -1
- package/shaders/MirrorShader.d.ts +7 -5
- package/shaders/MirrorShader.js +1 -1
- package/shaders/NormalMapShader.cjs.js +1 -1
- package/shaders/NormalMapShader.d.ts +14 -7
- package/shaders/NormalMapShader.js +1 -1
- package/shaders/ParallaxShader.cjs.js +1 -1
- package/shaders/ParallaxShader.d.ts +28 -0
- package/shaders/ParallaxShader.js +1 -1
- package/shaders/PixelShader.cjs.js +1 -1
- package/shaders/PixelShader.d.ts +10 -6
- package/shaders/PixelShader.js +1 -1
- package/shaders/RGBShiftShader.cjs.js +1 -1
- package/shaders/RGBShiftShader.d.ts +10 -6
- package/shaders/RGBShiftShader.js +1 -1
- package/shaders/SAOShader.cjs.js +1 -1
- package/shaders/SAOShader.d.ts +24 -29
- package/shaders/SAOShader.js +1 -5
- package/shaders/SMAAShader.cjs.js +1 -1
- package/shaders/SMAAShader.d.ts +31 -16
- package/shaders/SMAAShader.js +3 -3
- package/shaders/SSAOShader.cjs.js +1 -1
- package/shaders/SSAOShader.d.ts +58 -25
- package/shaders/SSAOShader.js +3 -3
- package/shaders/SSRShader.cjs.js +1 -1
- package/shaders/SSRShader.d.ts +67 -36
- package/shaders/SSRShader.js +3 -3
- package/shaders/SepiaShader.cjs.js +1 -1
- package/shaders/SepiaShader.d.ts +7 -5
- package/shaders/SepiaShader.js +1 -1
- package/shaders/SobelOperatorShader.cjs.js +1 -1
- package/shaders/SobelOperatorShader.d.ts +8 -5
- package/shaders/SobelOperatorShader.js +1 -1
- package/shaders/SubsurfaceScatteringShader.cjs.js +1 -1
- package/shaders/SubsurfaceScatteringShader.d.ts +2 -34
- package/shaders/SubsurfaceScatteringShader.js +3 -3
- package/shaders/TechnicolorShader.cjs.js +1 -1
- package/shaders/TechnicolorShader.d.ts +4 -4
- package/shaders/TechnicolorShader.js +1 -1
- package/shaders/ToneMapShader.cjs.js +1 -1
- package/shaders/ToneMapShader.d.ts +19 -9
- package/shaders/ToneMapShader.js +1 -1
- package/shaders/ToonShader.cjs.js +1 -1
- package/shaders/ToonShader.d.ts +80 -34
- package/shaders/ToonShader.js +4 -4
- package/shaders/TriangleBlurShader.cjs.js +1 -1
- package/shaders/TriangleBlurShader.d.ts +8 -5
- package/shaders/TriangleBlurShader.js +1 -1
- package/shaders/UnpackDepthRGBAShader.cjs.js +1 -1
- package/shaders/UnpackDepthRGBAShader.d.ts +7 -5
- package/shaders/UnpackDepthRGBAShader.js +1 -1
- package/shaders/VerticalBlurShader.cjs.js +1 -1
- package/shaders/VerticalBlurShader.d.ts +8 -8
- package/shaders/VerticalBlurShader.js +1 -1
- package/shaders/VerticalTiltShiftShader.cjs.js +1 -1
- package/shaders/VerticalTiltShiftShader.d.ts +10 -6
- package/shaders/VerticalTiltShiftShader.js +1 -1
- package/shaders/VignetteShader.cjs.js +1 -1
- package/shaders/VignetteShader.d.ts +10 -6
- package/shaders/VignetteShader.js +1 -1
- package/shaders/VolumeShader.cjs.js +1 -1
- package/shaders/VolumeShader.d.ts +20 -9
- package/shaders/VolumeShader.js +1 -1
- package/shaders/WaterRefractionShader.cjs.js +1 -1
- package/shaders/WaterRefractionShader.d.ts +16 -8
- package/shaders/WaterRefractionShader.js +1 -1
- package/shaders/index.cjs.js +1 -0
- package/shaders/index.d.ts +53 -0
- package/shaders/index.js +53 -0
- package/shaders/types.cjs.js +1 -0
- package/shaders/types.d.ts +14 -0
- package/shaders/types.js +1 -0
- package/types/shared.d.ts +0 -20
@@ -1,39 +1,57 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
export const GodRaysDepthMaskShader: {
|
1
|
+
import { Color, Vector3 } from 'three';
|
2
|
+
export declare const GodRaysDepthMaskShader: {
|
4
3
|
uniforms: {
|
5
|
-
tInput:
|
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:
|
14
|
-
|
15
|
-
|
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:
|
24
|
-
|
25
|
-
|
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:
|
34
|
-
|
35
|
-
|
36
|
-
|
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;
|
package/shaders/GodRaysShader.js
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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});
|
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
|
-
|
2
|
-
|
3
|
-
export const HalftoneShader: {
|
1
|
+
export declare const HalftoneShader: {
|
4
2
|
uniforms: {
|
5
|
-
tDiffuse:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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;
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { Texture } from 'three';
|
2
|
-
import {
|
3
|
-
export
|
4
|
-
tDiffuse:
|
5
|
-
h:
|
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
|
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});
|
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
|
-
|
2
|
-
|
3
|
-
export const HorizontalTiltShiftShader: {
|
1
|
+
export declare const HorizontalTiltShiftShader: {
|
4
2
|
uniforms: {
|
5
|
-
tDiffuse:
|
6
|
-
|
7
|
-
|
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;
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
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
|
-
|
2
|
-
|
3
|
-
export const HueSaturationShader: {
|
1
|
+
export declare const HueSaturationShader: {
|
4
2
|
uniforms: {
|
5
|
-
tDiffuse:
|
6
|
-
|
7
|
-
|
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
|
-
|
7
|
+
const HueSaturationShader = {
|
8
8
|
uniforms: {
|
9
9
|
tDiffuse: {
|
10
10
|
value: null
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
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
|
-
|
2
|
-
|
3
|
-
export const KaleidoShader: {
|
1
|
+
export declare const KaleidoShader: {
|
4
2
|
uniforms: {
|
5
|
-
tDiffuse:
|
6
|
-
|
7
|
-
|
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;
|
package/shaders/KaleidoShader.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
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 {
|
2
|
-
|
3
|
-
export const LuminosityHighPassShader: {
|
1
|
+
import { Color } from 'three';
|
2
|
+
export declare const LuminosityHighPassShader: {
|
4
3
|
shaderID: string;
|
5
4
|
uniforms: {
|
6
|
-
tDiffuse:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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;
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
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;
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={uniforms:{tDiffuse:{value:null},side:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform int side;","varying vec2 vUv;","void main() {","\tvec2 p = vUv;","\tif (side == 0){","\t\tif (p.x > 0.5) p.x = 1.0 - p.x;","\t}else if (side == 1){","\t\tif (p.x < 0.5) p.x = 1.0 - p.x;","\t}else if (side == 2){","\t\tif (p.y < 0.5) p.y = 1.0 - p.y;","\t}else if (side == 3){","\t\tif (p.y > 0.5) p.y = 1.0 - p.y;","\t} ","\tvec4 color = texture2D(tDiffuse, p);","\tgl_FragColor = color;","}"].join("\n")};exports.MirrorShader=e;
|
@@ -1,9 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
export const MirrorShader: {
|
1
|
+
export declare const MirrorShader: {
|
4
2
|
uniforms: {
|
5
|
-
tDiffuse:
|
6
|
-
|
3
|
+
tDiffuse: {
|
4
|
+
value: null;
|
5
|
+
};
|
6
|
+
side: {
|
7
|
+
value: number;
|
8
|
+
};
|
7
9
|
};
|
8
10
|
vertexShader: string;
|
9
11
|
fragmentShader: string;
|
package/shaders/MirrorShader.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three")
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");const t={uniforms:{heightMap:{value:null},resolution:{value:new e.Vector2(512,512)},scale:{value:new e.Vector2(1,1)},height:{value:.05}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float height;","uniform vec2 resolution;","uniform sampler2D heightMap;","varying vec2 vUv;","void main() {","\tfloat val = texture2D( heightMap, vUv ).x;","\tfloat valU = texture2D( heightMap, vUv + vec2( 1.0 / resolution.x, 0.0 ) ).x;","\tfloat valV = texture2D( heightMap, vUv + vec2( 0.0, 1.0 / resolution.y ) ).x;","\tgl_FragColor = vec4( ( 0.5 * normalize( vec3( val - valU, val - valV, height ) ) + 0.5 ), 1.0 );","}"].join("\n")};exports.NormalMapShader=t;
|
@@ -1,11 +1,18 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
export const NormalMapShader: {
|
1
|
+
import { Vector2 } from 'three';
|
2
|
+
export declare const NormalMapShader: {
|
4
3
|
uniforms: {
|
5
|
-
heightMap:
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
heightMap: {
|
5
|
+
value: null;
|
6
|
+
};
|
7
|
+
resolution: {
|
8
|
+
value: Vector2;
|
9
|
+
};
|
10
|
+
scale: {
|
11
|
+
value: Vector2;
|
12
|
+
};
|
13
|
+
height: {
|
14
|
+
value: number;
|
15
|
+
};
|
9
16
|
};
|
10
17
|
vertexShader: string;
|
11
18
|
fragmentShader: string;
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t={modes:{none:"NO_PARALLAX",basic:"USE_BASIC_PARALLAX",steep:"USE_STEEP_PARALLAX",occlusion:"USE_OCLUSION_PARALLAX",relief:"USE_RELIEF_PARALLAX"},uniforms:{bumpMap:{value:null},map:{value:null},parallaxScale:{value:null},parallaxMinLayers:{value:null},parallaxMaxLayers:{value:null}},vertexShader:["varying vec2 vUv;","varying vec3 vViewPosition;","varying vec3 vNormal;","void main() {","\tvUv = uv;","\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","\tvViewPosition = -mvPosition.xyz;","\tvNormal = normalize( normalMatrix * normal );","\tgl_Position = projectionMatrix * mvPosition;","}"].join("\n"),fragmentShader:["uniform sampler2D bumpMap;","uniform sampler2D map;","uniform float parallaxScale;","uniform float parallaxMinLayers;","uniform float parallaxMaxLayers;","varying vec2 vUv;","varying vec3 vViewPosition;","varying vec3 vNormal;","#ifdef USE_BASIC_PARALLAX","\tvec2 parallaxMap( in vec3 V ) {","\t\tfloat initialHeight = texture2D( bumpMap, vUv ).r;","\t\tvec2 texCoordOffset = parallaxScale * V.xy * initialHeight;","\t\treturn vUv - texCoordOffset;","\t}","#else","\tvec2 parallaxMap( in vec3 V ) {","\t\tfloat numLayers = mix( parallaxMaxLayers, parallaxMinLayers, abs( dot( vec3( 0.0, 0.0, 1.0 ), V ) ) );","\t\tfloat layerHeight = 1.0 / numLayers;","\t\tfloat currentLayerHeight = 0.0;","\t\tvec2 dtex = parallaxScale * V.xy / V.z / numLayers;","\t\tvec2 currentTextureCoords = vUv;","\t\tfloat heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;","\t\tfor ( int i = 0; i < 30; i += 1 ) {","\t\t\tif ( heightFromTexture <= currentLayerHeight ) {","\t\t\t\tbreak;","\t\t\t}","\t\t\tcurrentLayerHeight += layerHeight;","\t\t\tcurrentTextureCoords -= dtex;","\t\t\theightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;","\t\t}","\t\t#ifdef USE_STEEP_PARALLAX","\t\t\treturn currentTextureCoords;","\t\t#elif defined( USE_RELIEF_PARALLAX )","\t\t\tvec2 deltaTexCoord = dtex / 2.0;","\t\t\tfloat deltaHeight = layerHeight / 2.0;","\t\t\tcurrentTextureCoords += deltaTexCoord;","\t\t\tcurrentLayerHeight -= deltaHeight;","\t\t\tconst int numSearches = 5;","\t\t\tfor ( int i = 0; i < numSearches; i += 1 ) {","\t\t\t\tdeltaTexCoord /= 2.0;","\t\t\t\tdeltaHeight /= 2.0;","\t\t\t\theightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;","\t\t\t\tif( heightFromTexture > currentLayerHeight ) {","\t\t\t\t\tcurrentTextureCoords -= deltaTexCoord;","\t\t\t\t\tcurrentLayerHeight += deltaHeight;","\t\t\t\t} else {","\t\t\t\t\tcurrentTextureCoords += deltaTexCoord;","\t\t\t\t\tcurrentLayerHeight -= deltaHeight;","\t\t\t\t}","\t\t\t}","\t\t\treturn currentTextureCoords;","\t\t#elif defined( USE_OCLUSION_PARALLAX )","\t\t\tvec2 prevTCoords = currentTextureCoords + dtex;","\t\t\tfloat nextH = heightFromTexture - currentLayerHeight;","\t\t\tfloat prevH = texture2D( bumpMap, prevTCoords ).r - currentLayerHeight + layerHeight;","\t\t\tfloat weight = nextH / ( nextH - prevH );","\t\t\treturn prevTCoords * weight + currentTextureCoords * ( 1.0 - weight );","\t\t#else","\t\t\treturn vUv;","\t\t#endif","\t}","#endif","vec2 perturbUv( vec3 surfPosition, vec3 surfNormal, vec3 viewPosition ) {","\tvec2 texDx = dFdx( vUv );","\tvec2 texDy = dFdy( vUv );","\tvec3 vSigmaX = dFdx( surfPosition );","\tvec3 vSigmaY = dFdy( surfPosition );","\tvec3 vR1 = cross( vSigmaY, surfNormal );","\tvec3 vR2 = cross( surfNormal, vSigmaX );","\tfloat fDet = dot( vSigmaX, vR1 );","\tvec2 vProjVscr = ( 1.0 / fDet ) * vec2( dot( vR1, viewPosition ), dot( vR2, viewPosition ) );","\tvec3 vProjVtex;","\tvProjVtex.xy = texDx * vProjVscr.x + texDy * vProjVscr.y;","\tvProjVtex.z = dot( surfNormal, viewPosition );","\treturn parallaxMap( vProjVtex );","}","void main() {","\tvec2 mapUv = perturbUv( -vViewPosition, normalize( vNormal ), normalize( vViewPosition ) );","\tgl_FragColor = texture2D( map, mapUv );","}"].join("\n")};exports.ParallaxShader=t;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
export declare const ParallaxShader: {
|
2
|
+
modes: {
|
3
|
+
none: string;
|
4
|
+
basic: string;
|
5
|
+
steep: string;
|
6
|
+
occlusion: string;
|
7
|
+
relief: string;
|
8
|
+
};
|
9
|
+
uniforms: {
|
10
|
+
bumpMap: {
|
11
|
+
value: null;
|
12
|
+
};
|
13
|
+
map: {
|
14
|
+
value: null;
|
15
|
+
};
|
16
|
+
parallaxScale: {
|
17
|
+
value: null;
|
18
|
+
};
|
19
|
+
parallaxMinLayers: {
|
20
|
+
value: null;
|
21
|
+
};
|
22
|
+
parallaxMaxLayers: {
|
23
|
+
value: null;
|
24
|
+
};
|
25
|
+
};
|
26
|
+
vertexShader: string;
|
27
|
+
fragmentShader: string;
|
28
|
+
};
|
@@ -2,7 +2,7 @@
|
|
2
2
|
// http://sunandblackcat.com/tipFullView.php?topicid=28
|
3
3
|
// No tangent-space transforms logic based on
|
4
4
|
// http://mmikkelsen3d.blogspot.sk/2012/02/parallaxpoc-mapping-and-no-tangent.html
|
5
|
-
|
5
|
+
const ParallaxShader = {
|
6
6
|
// Ordered from fastest to best quality.
|
7
7
|
modes: {
|
8
8
|
none: 'NO_PARALLAX',
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={uniforms:{tDiffuse:{value:null},resolution:{value:null},pixelSize:{value:1}},vertexShader:["varying highp vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float pixelSize;","uniform vec2 resolution;","varying highp vec2 vUv;","void main(){","vec2 dxy = pixelSize / resolution;","vec2 coord = dxy * floor( vUv / dxy );","gl_FragColor = texture2D(tDiffuse, coord);","}"].join("\n")};exports.PixelShader=e;
|
package/shaders/PixelShader.d.ts
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
export const PixelShader: {
|
1
|
+
export declare const PixelShader: {
|
4
2
|
uniforms: {
|
5
|
-
tDiffuse:
|
6
|
-
|
7
|
-
|
3
|
+
tDiffuse: {
|
4
|
+
value: null;
|
5
|
+
};
|
6
|
+
resolution: {
|
7
|
+
value: null;
|
8
|
+
};
|
9
|
+
pixelSize: {
|
10
|
+
value: number;
|
11
|
+
};
|
8
12
|
};
|
9
13
|
vertexShader: string;
|
10
14
|
fragmentShader: string;
|