Light: Sunlight uses the new shaders.
This commit is contained in:
@@ -1,23 +1,21 @@
|
||||
#version 130
|
||||
uniform sampler2D ntex;
|
||||
uniform sampler2D cloudtex;
|
||||
//uniform sampler2D cloudtex;
|
||||
|
||||
uniform vec3 center;
|
||||
uniform vec3 direction;
|
||||
uniform vec3 col;
|
||||
uniform vec2 screen;
|
||||
uniform mat4 invproj;
|
||||
uniform int hasclouds;
|
||||
uniform vec2 wind;
|
||||
//uniform int hasclouds;
|
||||
//uniform vec2 wind;
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 Diff;
|
||||
out vec4 Spec;
|
||||
out vec4 SpecularMap;
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 texc = gl_FragCoord.xy / screen;
|
||||
float z = texture(ntex, texc).a;
|
||||
vec4 xpos = 2.0 * vec4(texc, z, 1.0) - 1.0;
|
||||
float z = texture(ntex, uv).a;
|
||||
vec4 xpos = 2.0 * vec4(uv, z, 1.0) - 1.0;
|
||||
xpos = invproj * xpos;
|
||||
xpos.xyz /= xpos.w;
|
||||
|
||||
@@ -29,11 +27,11 @@ void main() {
|
||||
return;
|
||||
}
|
||||
|
||||
vec3 norm = texture(ntex, texc).xyz;
|
||||
vec3 norm = texture(ntex, uv).xyz;
|
||||
norm = (norm - 0.5) * 2.0;
|
||||
|
||||
// Normalized on the cpu
|
||||
vec3 L = center;
|
||||
vec3 L = direction;
|
||||
|
||||
float NdotL = max(0.0, dot(norm, L));
|
||||
vec3 R = reflect(L, norm);
|
||||
@@ -42,14 +40,14 @@ void main() {
|
||||
|
||||
vec3 outcol = NdotL * col;
|
||||
|
||||
if (hasclouds == 1)
|
||||
/* if (hasclouds == 1)
|
||||
{
|
||||
vec2 cloudcoord = (xpos.xz * 0.00833333) + wind;
|
||||
float cloud = texture(cloudtex, cloudcoord).x;
|
||||
//float cloud = step(0.5, cloudcoord.x) * step(0.5, cloudcoord.y);
|
||||
|
||||
outcol *= cloud;
|
||||
}
|
||||
}*/
|
||||
|
||||
Diff = vec4(NdotL * col, 1.);
|
||||
Spec = vec4(Specular * col, 1.);
|
||||
|
||||
Reference in New Issue
Block a user