aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'assets/shaders')
-rw-r--r--assets/shaders/Cloud.frag.glsl4
-rw-r--r--assets/shaders/Cloud.vert.glsl2
-rw-r--r--assets/shaders/Flag.vert.glsl2
-rwxr-xr-xassets/shaders/linearGradient.frag.glsl18
-rwxr-xr-xassets/shaders/linearGradient.vert.glsl16
-rw-r--r--assets/shaders/radialGradient.frag.glsl18
-rwxr-xr-xassets/shaders/test_fshader.glsl44
-rwxr-xr-xassets/shaders/test_fshader_full.glsl22
-rwxr-xr-xassets/shaders/test_vshader.glsl10
-rwxr-xr-xassets/shaders/ub_fshader.glsl102
-rwxr-xr-xassets/shaders/ub_vshader.glsl44
11 files changed, 141 insertions, 141 deletions
diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl
index dc984191..1149f11b 100644
--- a/assets/shaders/Cloud.frag.glsl
+++ b/assets/shaders/Cloud.frag.glsl
@@ -43,5 +43,5 @@ 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 c709bc27..a33429fe 100644
--- a/assets/shaders/Cloud.vert.glsl
+++ b/assets/shaders/Cloud.vert.glsl
@@ -70,6 +70,6 @@ void main()
70 pos.z = z; 70 pos.z = z;
71 71
72 gl_Position = u_projMatrix * u_mvMatrix * pos; 72 gl_Position = u_projMatrix * u_mvMatrix * pos;
73 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 49eaaccb..51ec8f8b 100644
--- a/assets/shaders/Flag.vert.glsl
+++ b/assets/shaders/Flag.vert.glsl
@@ -70,6 +70,6 @@ void main()
70 v.z *= u_waveHeight; 70 v.z *= u_waveHeight;
71 v.z -= 2.0*u_waveHeight; 71 v.z -= 2.0*u_waveHeight;
72 v.z *= x * 0.09; 72 v.z *= x * 0.09;
73 73
74 gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ; 74 gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ;
75} 75}
diff --git a/assets/shaders/linearGradient.frag.glsl b/assets/shaders/linearGradient.frag.glsl
index 56a55d86..03310255 100755
--- a/assets/shaders/linearGradient.frag.glsl
+++ b/assets/shaders/linearGradient.frag.glsl
@@ -33,14 +33,14 @@ precision highp float;
33#endif 33#endif
34 34
35 35
36uniform vec4 u_color1; 36uniform vec4 u_color1;
37uniform vec4 u_color2; 37uniform vec4 u_color2;
38uniform vec4 u_color3; 38uniform vec4 u_color3;
39uniform vec4 u_color4; 39uniform vec4 u_color4;
40uniform float u_colorStop1; 40uniform float u_colorStop1;
41uniform float u_colorStop2; 41uniform float u_colorStop2;
42uniform float u_colorStop3; 42uniform float u_colorStop3;
43uniform float u_colorStop4; 43uniform float u_colorStop4;
44uniform vec2 u_cos_sin_angle; 44uniform vec2 u_cos_sin_angle;
45//uniform int u_colorCount; // currently using 4 45//uniform int u_colorCount; // currently using 4
46 46
@@ -73,4 +73,4 @@ void main(void)
73 color = u_color4; 73 color = u_color4;
74 74
75 gl_FragColor =color; 75 gl_FragColor =color;
76} 76}
diff --git a/assets/shaders/linearGradient.vert.glsl b/assets/shaders/linearGradient.vert.glsl
index fcdc5e96..12b36c0f 100755
--- a/assets/shaders/linearGradient.vert.glsl
+++ b/assets/shaders/linearGradient.vert.glsl
@@ -51,14 +51,14 @@ uniform mat4 u_normalMatrix;
51uniform mat4 u_projMatrix; 51uniform mat4 u_projMatrix;
52uniform mat4 u_worldMatrix; 52uniform mat4 u_worldMatrix;
53 53
54uniform vec4 u_color1; 54uniform vec4 u_color1;
55uniform vec4 u_color2; 55uniform vec4 u_color2;
56uniform vec4 u_color3; 56uniform vec4 u_color3;
57uniform vec4 u_color4; 57uniform vec4 u_color4;
58uniform float u_colorStop1; 58uniform float u_colorStop1;
59uniform float u_colorStop2; 59uniform float u_colorStop2;
60uniform float u_colorStop3; 60uniform float u_colorStop3;
61uniform float u_colorStop4; 61uniform float u_colorStop4;
62uniform vec2 u_cos_sin_angle; 62uniform vec2 u_cos_sin_angle;
63//uniform int u_colorCount; // currently using 4 63//uniform int u_colorCount; // currently using 4
64uniform mat3 u_texTransform; 64uniform mat3 u_texTransform;
diff --git a/assets/shaders/radialGradient.frag.glsl b/assets/shaders/radialGradient.frag.glsl
index b78e38bb..58b43a74 100644
--- a/assets/shaders/radialGradient.frag.glsl
+++ b/assets/shaders/radialGradient.frag.glsl
@@ -32,17 +32,17 @@ POSSIBILITY OF SUCH DAMAGE.
32precision highp float; 32precision highp float;
33#endif 33#endif
34 34
35uniform vec4 u_color1; 35uniform vec4 u_color1;
36uniform vec4 u_color2; 36uniform vec4 u_color2;
37uniform vec4 u_color3; 37uniform vec4 u_color3;
38uniform vec4 u_color4; 38uniform vec4 u_color4;
39uniform float u_colorStop1; 39uniform float u_colorStop1;
40uniform float u_colorStop2; 40uniform float u_colorStop2;
41uniform float u_colorStop3; 41uniform float u_colorStop3;
42uniform float u_colorStop4; 42uniform float u_colorStop4;
43uniform vec2 u_cos_sin_angle; 43uniform vec2 u_cos_sin_angle;
44//uniform int u_colorCount; // currently using all 4 44//uniform int u_colorCount; // currently using all 4
45 45
46varying vec2 v_uv; 46varying vec2 v_uv;
47 47
48void main(void) 48void main(void)
diff --git a/assets/shaders/test_fshader.glsl b/assets/shaders/test_fshader.glsl
index 1fa78e44..de5da773 100755
--- a/assets/shaders/test_fshader.glsl
+++ b/assets/shaders/test_fshader.glsl
@@ -40,7 +40,7 @@ uniform vec4 u_light0Amb;
40// diffuse map 40// diffuse map
41uniform sampler2D u_colMap; 41uniform sampler2D u_colMap;
42 42
43// environment map 43// environment map
44uniform sampler2D envMap; 44uniform sampler2D envMap;
45 45
46// normal map 46// normal map
@@ -77,7 +77,7 @@ void main()
77 float dist = vShadowCoord.w/200.0; 77 float dist = vShadowCoord.w/200.0;
78 float d = dot(rgba_depth, bit_shift); 78 float d = dot(rgba_depth, bit_shift);
79 float shadowCoef = (dist > d + 0.00779) ? (0.6) : (1.0); 79 float shadowCoef = (dist > d + 0.00779) ? (0.6) : (1.0);
80 80
81 vec4 colMapTexel = vec4(0); 81 vec4 colMapTexel = vec4(0);
82 if (u_renderGlow <= 0.5) { 82 if (u_renderGlow <= 0.5) {
83 colMapTexel = vec4(texture2D(u_colMap, vec2(vNormal.w, vECPos.w)).rgb, 1.0); 83 colMapTexel = vec4(texture2D(u_colMap, vec2(vNormal.w, vECPos.w)).rgb, 1.0);
@@ -89,32 +89,32 @@ void main()
89 vec3 normal = normalize(vNormal.xyz); 89 vec3 normal = normalize(vNormal.xyz);
90 vec3 mapNormal = texture2D(u_normalMap, vec2(vNormal.w, vECPos.w)).xyz * 2.0 - 1.0; 90 vec3 mapNormal = texture2D(u_normalMap, vec2(vNormal.w, vECPos.w)).xyz * 2.0 - 1.0;
91 mapNormal = normalize(mapNormal.x*vec3(normal.z, 0.0, -normal.x) + vec3(0.0, mapNormal.y, 0.0) + mapNormal.z*normal); 91 mapNormal = normalize(mapNormal.x*vec3(normal.z, 0.0, -normal.x) + vec3(0.0, mapNormal.y, 0.0) + mapNormal.z*normal);
92 92
93 // create envmap coordinates 93 // create envmap coordinates
94 vec3 r = reflect( normalize(vec3(vECPos.xyz - vEyePos.xyz)), mapNormal); 94 vec3 r = reflect( normalize(vec3(vECPos.xyz - vEyePos.xyz)), mapNormal);
95 float m = 2.0 * sqrt( r.x*r.x + r.y*r.y + r.z*r.z ); 95 float m = 2.0 * sqrt( r.x*r.x + r.y*r.y + r.z*r.z );
96 96
97 // calculate environment map texel 97 // calculate environment map texel
98 vec4 envMapTexel = vec4(texture2D(envMap, vec2(r.x/m + 0.5, r.y/m + 0.5)).rgb, 0.0); 98 vec4 envMapTexel = vec4(texture2D(envMap, vec2(r.x/m + 0.5, r.y/m + 0.5)).rgb, 0.0);
99 99
100 // lighting 100 // lighting
101 vec3 lightDirection = u_light0Pos - vECPos.xyz; 101 vec3 lightDirection = u_light0Pos - vECPos.xyz;
102 float lightDist = length(lightDirection); 102 float lightDist = length(lightDirection);
103 lightDirection /= lightDist; 103 lightDirection /= lightDist;
104 104
105 float attenuation = clamp(1.0 - lightDist * 0.01, 0.0, 1.0); 105 float attenuation = clamp(1.0 - lightDist * 0.01, 0.0, 1.0);
106 106
107 vec3 halfVec = normalize(lightDirection + vEyePos); 107 vec3 halfVec = normalize(lightDirection + vEyePos);
108 108
109 float diffuseIntensity = max(0.0, dot(mapNormal, lightDirection)); 109 float diffuseIntensity = max(0.0, dot(mapNormal, lightDirection));
110 float specularModifier = max(0.0, dot(mapNormal, halfVec)); 110 float specularModifier = max(0.0, dot(mapNormal, halfVec));
111 111
112 float pf; 112 float pf;
113 if(diffuseIntensity == 0.0) 113 if(diffuseIntensity == 0.0)
114 pf = 0.0; 114 pf = 0.0;
115 else 115 else
116 pf = pow(specularModifier, 76.0); 116 pf = pow(specularModifier, 76.0);
117 117
118 vec4 ambient = u_matAmbient * u_light0Amb; 118 vec4 ambient = u_matAmbient * u_light0Amb;
119 119
120 vec4 diffuse = u_matDiffuse * (colMapTexel + envMapTexel)*shadowCoef; 120 vec4 diffuse = u_matDiffuse * (colMapTexel + envMapTexel)*shadowCoef;
@@ -122,9 +122,9 @@ void main()
122 if (u_renderGlow <= 0.5) { 122 if (u_renderGlow <= 0.5) {
123 diffuse *= u_light0Diff; 123 diffuse *= u_light0Diff;
124 } 124 }
125 125
126 vec4 specular = 2.0 * pf * envMapTexel; 126 vec4 specular = 2.0 * pf * envMapTexel;
127 127
128 //gl_FragColor = vec4(dist, dist, dist, 1.0); 128 //gl_FragColor = vec4(dist, dist, dist, 1.0);
129 gl_FragColor = ((colMapTexel*(ambient + diffuse)) + specular); 129 gl_FragColor = ((colMapTexel*(ambient + diffuse)) + specular);
130} 130}
@@ -141,40 +141,40 @@ void main()
141 vec3 normal = normalize(vNormal.xyz); 141 vec3 normal = normalize(vNormal.xyz);
142// vec3 mapNormal = texture2D(u_normalMap, vec2(vNormal.w, vECPos.w)).xyz * 2.0 - 1.0; 142// vec3 mapNormal = texture2D(u_normalMap, vec2(vNormal.w, vECPos.w)).xyz * 2.0 - 1.0;
143// mapNormal = normalize(mapNormal.x*vec3(normal.z, 0.0, -normal.x) + vec3(0.0, mapNormal.y, 0.0) + mapNormal.z*normal); 143// mapNormal = normalize(mapNormal.x*vec3(normal.z, 0.0, -normal.x) + vec3(0.0, mapNormal.y, 0.0) + mapNormal.z*normal);
144// 144//
145// // create envmap coordinates 145// // create envmap coordinates
146// vec3 r = reflect( (vec3(vECPos.xyz - vEyePos.xyz)), mapNormal); 146//