aboutsummaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
Diffstat (limited to 'assets')
-rw-r--r--assets/shaders/Basic.frag.glsl4
-rw-r--r--assets/shaders/Basic.vert.glsl3
-rw-r--r--assets/shaders/Taper.vert.glsl21
3 files changed, 19 insertions, 9 deletions
diff --git a/assets/shaders/Basic.frag.glsl b/assets/shaders/Basic.frag.glsl
index a2c21afa..c1f9a5c8 100644
--- a/assets/shaders/Basic.frag.glsl
+++ b/assets/shaders/Basic.frag.glsl
@@ -11,7 +11,9 @@ precision highp float;
11 11
12 12
13uniform vec4 color; 13uniform vec4 color;
14varying vec4 v_color;
14 15
15void main() { 16void main() {
16 gl_FragColor = color; 17 gl_FragColor = v_color;
18 //gl_FragColor = color;
17} 19}
diff --git a/assets/shaders/Basic.vert.glsl b/assets/shaders/Basic.vert.glsl
index 028786d1..40b97ad7 100644
--- a/assets/shaders/Basic.vert.glsl
+++ b/assets/shaders/Basic.vert.glsl
@@ -12,7 +12,9 @@ precision highp float;
12 12
13// attributes 13// attributes
14attribute vec3 a_pos; 14attribute vec3 a_pos;
15attribute vec2 texcoord;
15 16
17varying vec4 v_color;
16 18
17 19
18// matrix uniforms 20// matrix uniforms
@@ -22,5 +24,6 @@ uniform mat4 u_worldMatrix;
22 24
23void main(void) 25void main(void)
24{ 26{
27 v_color = vec4(texcoord.x, texcoord.y, 0, 1);
25 gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0) ; 28 gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0) ;
26} \ No newline at end of file 29} \ No newline at end of file
diff --git a/assets/shaders/Taper.vert.glsl b/assets/shaders/Taper.vert.glsl
index 46f04fb3..82151f13 100644
--- a/assets/shaders/Taper.vert.glsl
+++ b/assets/shaders/Taper.vert.glsl
@@ -20,6 +20,7 @@ uniform float u_limit1;
20uniform float u_limit2; 20uniform float u_limit2;
21uniform float u_limit3; 21uniform float u_limit3;
22uniform float u_taperAmount; 22uniform float u_taperAmount;
23uniform float u_center;
23 24
24uniform vec4 color; 25uniform vec4 color;
25 26
@@ -31,31 +32,35 @@ uniform mat4 u_worldMatrix;
31 32
32varying vec4 v_color; 33varying vec4 v_color;
33 34
35float TaperAmount( float param )
36{
37 float y0 = 1.0, y1 = 1.0, y2 = 0.0, y3 = 0.0;
38 float yA0 = y0 + param*(y1 - y0), yA1 = y1 + param*(y2 - y1), yA2 = y2 + param*(y3 - y2);
39 float yB0 = yA0 + param*(yA1 - yA0), yB1 = yA1 + param*(yA2 - yA1);
40 float yC0 = yB0 + param*(yB1 - yB0);
41
42 return yC0;
43}
34 44
35void main(void) 45void main(void)
36{ 46{
37 vec3 pos = vert; 47 vec3 pos = vert;
38 vec2 uv = texcoord; 48 vec2 uv = texcoord;
39 49
40 v_color = vec4(0, 1, 0, 1); 50 v_color = vec4(texcoord.x, texcoord.y, 0, 1);
41 if (uv.x > u_limit1) 51 if (uv.x > u_limit1)
42 { 52 {
43 if (uv.x < u_limit2) 53 if (uv.x < u_limit2)
44 { 54 {
45 float t = (uv.x - u_limit1)/(u_limit2 - u_limit1); 55 float t = (uv.x - u_limit1)/(u_limit2 - u_limit1);
46 pos.y = pos.y - t*u_taperAmount; 56 pos.y = pos.y - pos.y*TaperAmount(t)*u_taperAmount;
47 v_color = vec4( 1, 1, 0, 1 );
48 } 57 }
49 else if (uv.x < u_limit3) 58 else if (uv.x < u_limit3)
50 { 59 {
51 float t = 1.0 - (uv.x - u_limit2)/(u_limit3 - u_limit2); 60 float t = 1.0 - (uv.x - u_limit2)/(u_limit3 - u_limit2);
52 pos.y = pos.y - t*u_taperAmount; 61 pos.y = pos.y - pos.y*TaperAmount(t)*u_taperAmount;
53 v_color = vec4( 0, 1, 1, 1 );
54 } 62 }
55 else
56 v_color = vec4(0,0,1,1);
57 } 63 }
58 64
59
60 gl_Position = u_projMatrix * u_mvMatrix * vec4(pos,1.0) ; 65 gl_Position = u_projMatrix * u_mvMatrix * vec4(pos,1.0) ;
61} \ No newline at end of file 66} \ No newline at end of file