X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=shaderlib%2Fshadow.glsl;h=f0338b95f8a10c1f0a9ced28210d59fb345e5d4d;hb=18449fc11c620be7b3115f28a5edfb57eb5985ef;hp=6f4acd2786a6319c242d9ff8300a00ecc535d0a7;hpb=6dcf74922f46b086ad394c19fd6ce083a635b290;p=libs%2Fgl.git diff --git a/shaderlib/shadow.glsl b/shaderlib/shadow.glsl index 6f4acd27..f0338b95 100644 --- a/shaderlib/shadow.glsl +++ b/shaderlib/shadow.glsl @@ -1,5 +1,13 @@ import msp_interface; +uniform ShadowMap +{ + float shadow_darkness; + mat4 shd_eye_matrix; +}; + +uniform sampler2DShadow shadow_map; + layout(constant_id=auto) const bool use_shadow_map = false; #pragma MSP stage(vertex) @@ -13,6 +21,8 @@ virtual float get_shadow_factor(int index) { if(use_shadow_map) { + if(shadow_coord.x<0 || shadow_coord.x>1 || shadow_coord.y<0 || shadow_coord.y>1) + return 1.0; float shadow_sample = texture(shadow_map, shadow_coord); return mix(1.0, shadow_sample, shadow_darkness); }