diff options
author | Kris Kowal | 2012-07-06 12:42:16 -0700 |
---|---|---|
committer | Kris Kowal | 2012-07-06 15:01:49 -0700 |
commit | 6803c0abd279fcb640c38b3881b751bab982cbe0 (patch) | |
tree | 876211d178954cbaa73e0fbb658fe0c6ffb7ac8d /assets/shaders | |
parent | 3644cb6def4f681c99959e5729e78ea353441fad (diff) | |
download | ninja-6803c0abd279fcb640c38b3881b751bab982cbe0.tar.gz |
Remove trailing spaces
Diffstat (limited to 'assets/shaders')
-rw-r--r-- | assets/shaders/Cloud.frag.glsl | 4 | ||||
-rw-r--r-- | assets/shaders/Cloud.vert.glsl | 2 | ||||
-rw-r--r-- | assets/shaders/Flag.vert.glsl | 2 | ||||
-rwxr-xr-x | assets/shaders/linearGradient.frag.glsl | 18 | ||||
-rwxr-xr-x | assets/shaders/linearGradient.vert.glsl | 16 | ||||
-rw-r--r-- | assets/shaders/radialGradient.frag.glsl | 18 | ||||
-rwxr-xr-x | assets/shaders/test_fshader.glsl | 44 | ||||
-rwxr-xr-x | assets/shaders/test_fshader_full.glsl | 22 | ||||
-rwxr-xr-x | assets/shaders/test_vshader.glsl | 10 | ||||
-rwxr-xr-x | assets/shaders/ub_fshader.glsl | 102 | ||||
-rwxr-xr-x | assets/shaders/ub_vshader.glsl | 44 |
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 | ||
36 | uniform vec4 u_color1; | 36 | uniform vec4 u_color1; |
37 | uniform vec4 u_color2; | 37 | uniform vec4 u_color2; |
38 | uniform vec4 u_color3; | 38 | uniform vec4 u_color3; |
39 | uniform vec4 u_color4; | 39 | uniform vec4 u_color4; |
40 | uniform float u_colorStop1; | 40 | uniform float u_colorStop1; |
41 | uniform float u_colorStop2; | 41 | uniform float u_colorStop2; |
42 | uniform float u_colorStop3; | 42 | uniform float u_colorStop3; |
43 | uniform float u_colorStop4; | 43 | uniform float u_colorStop4; |
44 | uniform vec2 u_cos_sin_angle; | 44 | uniform 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; | |||
51 | uniform mat4 u_projMatrix; | 51 | uniform mat4 u_projMatrix; |
52 | uniform mat4 u_worldMatrix; | 52 | uniform mat4 u_worldMatrix; |
53 | 53 | ||
54 | uniform vec4 u_color1; | 54 | uniform vec4 u_color1; |
55 | uniform vec4 u_color2; | 55 | uniform vec4 u_color2; |
56 | uniform vec4 u_color3; | 56 | uniform vec4 u_color3; |
57 | uniform vec4 u_color4; | 57 | uniform vec4 u_color4; |
58 | uniform float u_colorStop1; | 58 | uniform float u_colorStop1; |
59 | uniform float u_colorStop2; | 59 | uniform float u_colorStop2; |
60 | uniform float u_colorStop3; | 60 | uniform float u_colorStop3; |
61 | uniform float u_colorStop4; | 61 | uniform float u_colorStop4; |
62 | uniform vec2 u_cos_sin_angle; | 62 | uniform vec2 u_cos_sin_angle; |
63 | //uniform int u_colorCount; // currently using 4 | 63 | //uniform int u_colorCount; // currently using 4 |
64 | uniform mat3 u_texTransform; | 64 | uniform 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. | |||
32 | precision highp float; | 32 | precision highp float; |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | uniform vec4 u_color1; | 35 | uniform vec4 u_color1; |
36 | uniform vec4 u_color2; | 36 | uniform vec4 u_color2; |
37 | uniform vec4 u_color3; | 37 | uniform vec4 u_color3; |
38 | uniform vec4 u_color4; | 38 | uniform vec4 u_color4; |
39 | uniform float u_colorStop1; | 39 | uniform float u_colorStop1; |
40 | uniform float u_colorStop2; | 40 | uniform float u_colorStop2; |
41 | uniform float u_colorStop3; | 41 | uniform float u_colorStop3; |
42 | uniform float u_colorStop4; | 42 | uniform float u_colorStop4; |
43 | uniform vec2 u_cos_sin_angle; | 43 | uniform 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 | ||
46 | varying vec2 v_uv; | 46 | varying vec2 v_uv; |
47 | 47 | ||
48 | void main(void) | 48 | void 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 |
41 | uniform sampler2D u_colMap; | 41 | uniform sampler2D u_colMap; |
42 | 42 | ||
43 | // environment map | 43 | // environment map |
44 | uniform sampler2D envMap; | 44 | uniform 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 |