X-Git-Url: https://eleni.mutantstargoat.com/git/?p=demo;a=blobdiff_plain;f=gl_shaders%2Fdefault.f.glsl;h=ad4b77ac2731e7ab3e669ebf2673c4e4386d6f8e;hp=f0f61d83eaa85c143c461eea22e381c35b33a3e0;hb=73b9db25a6deff93da45f3c45290ca8a56fefed3;hpb=78426c695a2bc5812508806771ed1affa7c0bcf7 diff --git a/gl_shaders/default.f.glsl b/gl_shaders/default.f.glsl index f0f61d8..ad4b77a 100644 --- a/gl_shaders/default.f.glsl +++ b/gl_shaders/default.f.glsl @@ -1,15 +1,17 @@ #version 450 uniform sampler2D tex; +uniform samplerCube dstex; uniform vec4 diffuse; uniform vec4 specular; uniform float shininess; varying vec3 pos; -varying vec3 normal; -varying vec3 ldir; +// varying vec3 normal; +// varying vec3 ldir; varying vec2 tex_coord; +varying vec3 world_normal; // const float fog_density = 0.005; uniform float fog_density; @@ -19,7 +21,9 @@ out vec4 color; void main() { - vec3 p = normalize(pos); // view space dir + vec4 itexel = textureCube(dstex, normalize(world_normal)); + +/* vec3 p = normalize(pos); // view space dir vec3 n = normalize(normal); vec3 l = normalize(ldir); @@ -27,14 +31,15 @@ void main() vec3 vdir = normalize(-p); float cdiff = max(dot(l, n), 0.0); - float cspec = pow(max(dot(r, vdir), 0.0), shininess); + float cspec = pow(max(dot(r, vdir), 0.0), shininess); */ float dist = -pos.z; float fog = clamp(exp(-fog_density * dist), 0.0, 1.0); vec4 texel = texture2D(tex, tex_coord); - vec3 object_color = diffuse.xyz * cdiff * texel.xyz + specular.xyz * cspec; + // vec3 object_color = (diffuse.xyz * cdiff * texel.xyz + specular.xyz * cspec) * itexel.xyz; + vec3 object_color = diffuse.xyz * texel.xyz * itexel.xyz; color.xyz = mix(sky_color, object_color, fog); color.w = 1.0;