X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=shaderlib%2Fshadow.glsl;h=d533b4ec389913cef931cd7cce4021f5c253ef3d;hb=5593d59bfe30fd7eecc55bc3580d87fcb91f0248;hp=d6e2b385f8955009abf737d998fbe7dd984f8996;hpb=57588abbefc8f0162332ac2310c69b62a14b2404;p=libs%2Fgl.git diff --git a/shaderlib/shadow.glsl b/shaderlib/shadow.glsl index d6e2b385..d533b4ec 100644 --- a/shaderlib/shadow.glsl +++ b/shaderlib/shadow.glsl @@ -1,4 +1,4 @@ -import msp_interface; +import lighting; struct ShadowParameters { @@ -9,13 +9,13 @@ struct ShadowParameters vec2 bias; }; -uniform ShadowMap +layout(set=0) uniform ShadowMap { ShadowParameters shadows[max_lights]; mat4 shd_world_matrix[max_lights*4]; }; -uniform sampler2DShadow shadow_map; +layout(set=0) uniform sampler2DShadow shadow_map; layout(constant_id=auto) const bool use_shadow_map = false; @@ -52,7 +52,7 @@ virtual float get_shadow_factor(int index, vec4 world_pos) return 1.0; vec4 region = shadows[index].region; - float shadow_sample = texture(shadow_map, vec3(shadow_coord.xy*region.zw+region.xy, shadow_coord.z)); + float shadow_sample = texture(shadow_map, vec3(shadow_coord.xy*region.zw+region.xy, min(shadow_coord.z, 1.0))); return mix(1.0, shadow_sample, shadows[index].darkness); } else