diff options
author | Kris Kowal | 2012-07-06 11:52:06 -0700 |
---|---|---|
committer | Kris Kowal | 2012-07-06 15:01:48 -0700 |
commit | 648ee61ae84216d0236e0dbc211addc13b2cfa3a (patch) | |
tree | 8f0f55557bd0c47a84e49c1977c950645d284607 /assets/shaders/test_fshader.glsl | |
parent | aedd14b18695d031f695d27dfbd94df5614495bb (diff) | |
download | ninja-648ee61ae84216d0236e0dbc211addc13b2cfa3a.tar.gz |
Expand tabs
Diffstat (limited to 'assets/shaders/test_fshader.glsl')
-rwxr-xr-x | assets/shaders/test_fshader.glsl | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/assets/shaders/test_fshader.glsl b/assets/shaders/test_fshader.glsl index d2b3bd40..1fa78e44 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 |
@@ -72,12 +72,12 @@ varying float vDiffuseIntensity; | |||
72 | 72 | ||
73 | void main() | 73 | void main() |
74 | { | 74 | { |
75 | vec4 rgba_depth = texture2D(depthMap, vShadowCoord.xy/vShadowCoord.w, -32.0); | 75 | vec4 rgba_depth = texture2D(depthMap, vShadowCoord.xy/vShadowCoord.w, -32.0); |
76 | const vec4 bit_shift = vec4(1.0/(256.0*256.0*256.0), 1.0/(256.0*256.0), 1.0/256.0, 1.0); | 76 | const vec4 bit_shift = vec4(1.0/(256.0*256.0*256.0), 1.0/(256.0*256.0), 1.0/256.0, 1.0); |
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); |
@@ -120,7 +120,7 @@ void main() | |||
120 | vec4 diffuse = u_matDiffuse * (colMapTexel + envMapTexel)*shadowCoef; | 120 | vec4 diffuse = u_matDiffuse * (colMapTexel + envMapTexel)*shadowCoef; |
121 | 121 | ||
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; |
@@ -138,7 +138,7 @@ void main() | |||
138 | vec4 colMapTexel = vec4(texture2D(u_colMap, vec2(vNormal.w, vECPos.w)).rgb, 1.0); | 138 | vec4 colMapTexel = vec4(texture2D(u_colMap, vec2(vNormal.w, vECPos.w)).rgb, 1.0); |
139 | 139 | ||
140 | // // normal mapping | 140 | // // normal mapping |
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 | // |