aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'assets/shaders')
-rwxr-xr-xassets/shaders/Basic.vert.glsl6
-rw-r--r--assets/shaders/BasicTex.frag.glsl2
-rw-r--r--assets/shaders/Cloud.frag.glsl10
-rw-r--r--assets/shaders/Cloud.vert.glsl28
-rw-r--r--assets/shaders/Flag.vert.glsl25
-rw-r--r--assets/shaders/Pulse.frag.glsl1
-rw-r--r--assets/shaders/Taper.vert.glsl152
-rw-r--r--assets/shaders/TwistVert.frag.glsl8
-rw-r--r--assets/shaders/TwistVert.vert.glsl84
-rwxr-xr-xassets/shaders/linearGradient.frag.glsl68
-rwxr-xr-xassets/shaders/linearGradient.vert.glsl30
-rw-r--r--assets/shaders/radialGradient.frag.glsl70
-rw-r--r--assets/shaders/radialGradient.vert.glsl8
-rwxr-xr-xassets/shaders/test_fshader.glsl58
-rwxr-xr-xassets/shaders/test_fshader_full.glsl30
-rwxr-xr-xassets/shaders/test_vshader.glsl62
-rwxr-xr-xassets/shaders/ub_fshader.glsl432
-rwxr-xr-xassets/shaders/ub_vshader.glsl232
18 files changed, 654 insertions, 652 deletions
diff --git a/assets/shaders/Basic.vert.glsl b/assets/shaders/Basic.vert.glsl
index ae454411..80b2f088 100755
--- a/assets/shaders/Basic.vert.glsl
+++ b/assets/shaders/Basic.vert.glsl
@@ -39,7 +39,7 @@ attribute vec3 a_pos;
39attribute vec2 texcoord; 39attribute vec2 texcoord;
40 40
41// varying 41// varying
42varying vec2 v_texCoord0; 42varying vec2 v_texCoord0;
43 43
44// matrix uniforms 44// matrix uniforms
45uniform mat4 u_mvMatrix; 45uniform mat4 u_mvMatrix;
@@ -48,6 +48,6 @@ uniform mat4 u_worldMatrix;
48 48
49void main(void) 49void main(void)
50{ 50{
51 v_texCoord0 = texcoord; 51 v_texCoord0 = texcoord;
52 gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0) ; 52 gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0) ;
53} 53}
diff --git a/assets/shaders/BasicTex.frag.glsl b/assets/shaders/BasicTex.frag.glsl
index 4fee288d..d89e2ead 100644
--- a/assets/shaders/BasicTex.frag.glsl
+++ b/assets/shaders/BasicTex.frag.glsl
@@ -35,7 +35,7 @@ precision highp float;
35 35
36uniform sampler2D u_tex0; 36uniform sampler2D u_tex0;
37 37
38varying vec2 v_texCoord0; 38varying vec2 v_texCoord0;
39 39
40 40
41void main() { 41void main() {
diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl
index 85a43699..1149f11b 100644
--- a/assets/shaders/Cloud.frag.glsl
+++ b/assets/shaders/Cloud.frag.glsl
@@ -36,12 +36,12 @@ precision highp float;
36uniform sampler2D u_tex0; 36uniform sampler2D u_tex0;
37uniform float u_surfaceAlpha; 37uniform float u_surfaceAlpha;
38 38
39varying vec2 v_texCoord0; 39varying vec2 v_texCoord0;
40 40
41 41
42void main() 42void main()
43{ 43{
44 vec4 c = texture2D(u_tex0, v_texCoord0); 44 vec4 c = texture2D(u_tex0, v_texCoord0);
45 gl_FragColor = c; 45 gl_FragColor = c;
46} 46}
47 47
diff --git a/assets/shaders/Cloud.vert.glsl b/assets/shaders/Cloud.vert.glsl
index 95c14132..a33429fe 100644
--- a/assets/shaders/Cloud.vert.glsl
+++ b/assets/shaders/Cloud.vert.glsl
@@ -34,7 +34,7 @@ precision highp float;
34#endif 34#endif
35 35
36// attributes 36// attributes
37attribute vec3 a_pos; 37attribute vec3 a_pos;
38attribute vec2 texcoord; 38attribute vec2 texcoord;
39 39
40// uniforms 40// uniforms
@@ -48,7 +48,7 @@ uniform mat4 u_mvMatrix;
48uniform mat4 u_projMatrix; 48uniform mat4 u_projMatrix;
49 49
50// varying 50// varying
51varying vec2 v_texCoord0; 51varying vec2 v_texCoord0;
52 52
53// constants 53// constants
54const float zSpeed = 10.0; 54const float zSpeed = 10.0;
@@ -57,19 +57,19 @@ const float zSpeed = 10.0;
57void main() 57void main()
58{ 58{
59 // Transform position 59 // Transform position
60 vec4 pos = vec4(a_pos,1); 60 vec4 pos = vec4(a_pos,1);
61 61
62 float dz = u_time*zSpeed; 62 float dz = u_time*zSpeed;
63 float n = floor( dz/(u_zmax-u_zmin) ); 63 float n = floor( dz/(u_zmax-u_zmin) );
64 dz -= n*(u_zmax - u_zmin); 64 dz -= n*(u_zmax - u_zmin);
65 float z = pos.z + dz; 65 float z = pos.z + dz;
66 if (z > u_zmax) 66 if (z > u_zmax)
67 { 67 {
68 z = u_zmin + (z - u_zmax); 68 z = u_zmin + (z - u_zmax);
69 } 69 }
70 pos.z = z; 70 pos.z = z;
71
72 gl_Position = u_projMatrix * u_mvMatrix * pos;
71 73
72 gl_Position = u_projMatrix * u_mvMatrix * pos;
73
74 v_texCoord0 = texcoord; 74 v_texCoord0 = texcoord;
75} 75}
diff --git a/assets/shaders/Flag.vert.glsl b/assets/shaders/Flag.vert.glsl
index fe3ff722..6e2854ee 100644
--- a/assets/shaders/Flag.vert.glsl
+++ b/assets/shaders/Flag.vert.glsl
@@ -55,21 +55,22 @@ varying vec2 v_uv;
55 55
56void main() 56void main()
57{ 57{
58 float time = u_time * u_speed; 58 float time = u_time * u_speed;
59 const float pi = 3.14159; 59 const float pi = 3.14159;
60 float angle = time; 60 float angle = time;
61 61
62 v_uv = texcoord; 62 v_uv.x = texcoord.x;
63 v_uv.y = texcoord.y;
63 64
64 float x = 2.0*pi*texcoord.x/u_waveWidth; 65 float x = 2.0*pi*texcoord.x/u_waveWidth;
65 float y = 2.0*pi*texcoord.y; 66 float y = 2.0*pi*texcoord.y;
66 67
67 vec3 v = a_pos; 68 vec3 v = a_pos;
68 v.z = sin( x + angle ); 69 v.z = sin( x + angle );
69 v.z += sin( 0.2*y + angle); 70 v.z += sin( 0.2*y + angle);
70 v.z *= u_waveHeight; 71 v.z *= u_waveHeight;
71 v.z -= 2.0*u_waveHeight; 72 v.z -= 2.0*u_waveHeight;
72 v.z *= x * 0.09; 73 v.z *= x * 0.09;
73 74
74 gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ; 75 gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ;
75} 76}
diff --git a/assets/shaders/Pulse.frag.glsl b/assets/shaders/Pulse.frag.glsl
index 9aeb05c9..b717d359 100644
--- a/assets/shaders/Pulse.frag.glsl
+++ b/assets/shaders/Pulse.frag.glsl
@@ -22,6 +22,7 @@ void main(void)
22 float cLength = length(cPos); 22 float cLength = length(cPos);
23 23
24 vec2 uv = gl_FragCoord.xy/u_resolution.xy+(cPos/cLength)*sin(cLength/30.0-time*10.0)/25.0; 24 vec2 uv = gl_FragCoord.xy/u_resolution.xy+(cPos/cLength)*sin(cLength/30.0-time*10.0)/25.0;
25 uv.y = 1.0 - uv.y;
25 vec3 col = texture2D(u_tex0,uv).xyz*50.0/cLength; 26 vec3 col = texture2D(u_tex0,uv).xyz*50.0/cLength;
26 27
27 gl_FragColor = vec4(col,1.0); 28 gl_FragColor = vec4(col,1.0);
diff --git a/assets/shaders/Taper.vert.glsl b/assets/shaders/Taper.vert.glsl
index 5fe173b2..e55aeede 100644
--- a/assets/shaders/Taper.vert.glsl
+++ b/assets/shaders/Taper.vert.glsl
@@ -60,85 +60,85 @@ varying vec4 v_color;
60 60
61float TaperAmount( float param ) 61float TaperAmount( float param )
62{ 62{
63 // Bezier coordinates of the X coordinate. 63 // Bezier coordinates of the X coordinate.
64 // Adjust these to get tighter or looser 64 // Adjust these to get tighter or looser
65 float tightness = 0.8; 65 float tightness = 0.8;
66 66
67 float x0, y0, x1, y1, x2, y2; 67 float x0, y0, x1, y1, x2, y2;
68 float t; 68 float t;
69 if (param < 0.5) 69 if (param < 0.5)
70 { 70 {
71 t = 2.0*param; 71 t = 2.0*param;
72 x0 = 0.0; y0 = 0.0; 72 x0 = 0.0; y0 = 0.0;
73 x1 = tightness; y1 = 0.0; 73 x1 = tightness; y1 = 0.0;
74 x2 = 1.0; y2 = 0.5; 74 x2 = 1.0; y2 = 0.5;
75 } 75 }
76 else 76 else
77 { 77 {
78 t = (param - 0.5)*2.0; 78 t = (param - 0.5)*2.0;
79 x0 = 0.0; y0 = 0.5; 79 x0 = 0.0; y0 = 0.5;
80 x1 = 1.0 - tightness; y1 = 1.0; 80 x1 = 1.0 - tightness; y1 = 1.0;
81 x2 = 1.0; y2 = 1.0; 81 x2 = 1.0; y2 = 1.0;
82 } 82 }
83 83
84 float a = x0 - 2.0*x1 + x2; 84 float a = x0 - 2.0*x1 + x2;
85 float b = 2.0*(x1 - x0); 85 float b = 2.0*(x1 - x0);
86 float c = x0 - t; 86 float c = x0 - t;
87 87
88 float descr = sqrt( b*b - 4.0*a*c ); 88 float descr = sqrt( b*b - 4.0*a*c );
89 float denom = 2.0*a; 89 float denom = 2.0*a;
90 float n1 = (-b + descr)/denom; 90 float n1 = (-b + descr)/denom;
91 float n2 = (-b - descr)/denom; 91 float n2 = (-b - descr)/denom;
92 if ((n1 >= 0.0) || (n1 <= 1.0)) t = n1; 92 if ((n1 >= 0.0) || (n1 <= 1.0)) t = n1;
93 else if ((n2 >= 0.0) || (n2 <= 1.0)) t = n2; 93 else if ((n2 >= 0.0) || (n2 <= 1.0)) t = n2;
94 else 94 else
95 t = 0.0; 95 t = 0.0;
96