diff options
Diffstat (limited to 'assets/shaders')
-rwxr-xr-x | assets/shaders/Basic.vert.glsl | 6 | ||||
-rw-r--r-- | assets/shaders/BasicTex.frag.glsl | 2 | ||||
-rw-r--r-- | assets/shaders/Cloud.frag.glsl | 10 | ||||
-rw-r--r-- | assets/shaders/Cloud.vert.glsl | 28 | ||||
-rw-r--r-- | assets/shaders/Flag.vert.glsl | 22 | ||||
-rw-r--r-- | assets/shaders/Taper.vert.glsl | 152 | ||||
-rw-r--r-- | assets/shaders/TwistVert.frag.glsl | 8 | ||||
-rw-r--r-- | assets/shaders/TwistVert.vert.glsl | 84 | ||||
-rwxr-xr-x | assets/shaders/linearGradient.frag.glsl | 68 | ||||
-rwxr-xr-x | assets/shaders/linearGradient.vert.glsl | 30 | ||||
-rw-r--r-- | assets/shaders/radialGradient.frag.glsl | 70 | ||||
-rw-r--r-- | assets/shaders/radialGradient.vert.glsl | 8 | ||||
-rwxr-xr-x | assets/shaders/test_fshader.glsl | 58 | ||||
-rwxr-xr-x | assets/shaders/test_fshader_full.glsl | 28 | ||||
-rwxr-xr-x | assets/shaders/test_vshader.glsl | 62 | ||||
-rwxr-xr-x | assets/shaders/ub_fshader.glsl | 432 | ||||
-rwxr-xr-x | assets/shaders/ub_vshader.glsl | 232 |
17 files changed, 650 insertions, 650 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; | |||
39 | attribute vec2 texcoord; | 39 | attribute vec2 texcoord; |
40 | 40 | ||
41 | // varying | 41 | // varying |
42 | varying vec2 v_texCoord0; | 42 | varying vec2 v_texCoord0; |
43 | 43 | ||
44 | // matrix uniforms | 44 | // matrix uniforms |
45 | uniform mat4 u_mvMatrix; | 45 | uniform mat4 u_mvMatrix; |
@@ -48,6 +48,6 @@ uniform mat4 u_worldMatrix; | |||
48 | 48 | ||
49 | void main(void) | 49 | void 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 | ||
36 | uniform sampler2D u_tex0; | 36 | uniform sampler2D u_tex0; |
37 | 37 | ||
38 | varying vec2 v_texCoord0; | 38 | varying vec2 v_texCoord0; |
39 | 39 | ||
40 | 40 | ||
41 | void main() { | 41 | void 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; | |||
36 | uniform sampler2D u_tex0; | 36 | uniform sampler2D u_tex0; |
37 | uniform float u_surfaceAlpha; | 37 | uniform float u_surfaceAlpha; |
38 | 38 | ||
39 | varying vec2 v_texCoord0; | 39 | varying vec2 v_texCoord0; |
40 | 40 | ||
41 | 41 | ||
42 | void main() | 42 | void 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 |
37 | attribute vec3 a_pos; | 37 | attribute vec3 a_pos; |
38 | attribute vec2 texcoord; | 38 | attribute vec2 texcoord; |
39 | 39 | ||
40 | // uniforms | 40 | // uniforms |
@@ -48,7 +48,7 @@ uniform mat4 u_mvMatrix; | |||
48 | uniform mat4 u_projMatrix; | 48 | uniform mat4 u_projMatrix; |
49 | 49 | ||
50 | // varying | 50 | // varying |
51 | varying vec2 v_texCoord0; | 51 | varying vec2 v_texCoord0; |
52 | 52 | ||
53 | // constants | 53 | // constants |
54 | const float zSpeed = 10.0; | 54 | const float zSpeed = 10.0; |
@@ -57,19 +57,19 @@ const float zSpeed = 10.0; | |||
57 | void main() | 57 | void 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 2d5c4494..6e2854ee 100644 --- a/assets/shaders/Flag.vert.glsl +++ b/assets/shaders/Flag.vert.glsl | |||
@@ -55,22 +55,22 @@ varying vec2 v_uv; | |||
55 | 55 | ||
56 | void main() | 56 | void 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.x = texcoord.x; | 62 | v_uv.x = texcoord.x; |
63 | v_uv.y = texcoord.y; | 63 | v_uv.y = texcoord.y; |
64 | 64 | ||
65 | float x = 2.0*pi*texcoord.x/u_waveWidth; | 65 | float x = 2.0*pi*texcoord.x/u_waveWidth; |
66 | float y = 2.0*pi*texcoord.y; | 66 | float y = 2.0*pi*texcoord.y; |
67 | 67 | ||
68 | vec3 v = a_pos; | 68 | vec3 v = a_pos; |
69 | v.z = sin( x + angle ); | 69 | v.z = sin( x + angle ); |
70 | v.z += sin( 0.2*y + angle); | 70 | v.z += sin( 0.2*y + angle); |
71 | v.z *= u_waveHeight; | 71 | v.z *= u_waveHeight; |
72 | v.z -= 2.0*u_waveHeight; | 72 | v.z -= 2.0*u_waveHeight; |
73 | v.z *= x * 0.09; | 73 | v.z *= x * 0.09; |
74 | 74 | ||
75 | gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ; | 75 | gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ; |
76 | } | 76 | } |
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 | ||
61 | float TaperAmount( float param ) | 61 | float 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 | 96 | ||
97 | float ya = y0 + t*(y1 - y0); | 97 | float ya = y0 + t*(y1 - y0); |
98 | float yb = y1 + t*(y2 - y1); | 98 | float yb = y1 + t*(y2 - y1); |
99 | float yc = ya + t*(yb - ya); | 99 | float yc = ya + t*(yb - ya); |
100 | 100 | ||
101 | return yc; | 101 | return yc; |
102 | }< |