X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=shaderlib%2Fshadow.glsl;fp=shaderlib%2Fshadow.glsl;h=0a20b3a513998272fc13d14f386f621f32864e8d;hb=5ca47579de51342ac3e8ecda2cbb9be2f8b4643a;hp=0000000000000000000000000000000000000000;hpb=3500f13f51dabadd2e7f06b81820936520cc8115;p=libs%2Fgl.git diff --git a/shaderlib/shadow.glsl b/shaderlib/shadow.glsl new file mode 100644 index 00000000..0a20b3a5 --- /dev/null +++ b/shaderlib/shadow.glsl @@ -0,0 +1,21 @@ +import msp_interface; + +const bool use_shadow_map = false; + +#pragma MSP stage(vertex) +void shadow_transform(vec4 eye_vertex) +{ + out vec3 shadow_coord = (shd_eye_matrix*eye_vertex).xyz; +} + +#pragma MSP stage(fragment) +float get_shadow_factor(int index) +{ + if(use_shadow_map) + { + float shadow_sample = texture(shadow_map, shadow_coord); + return mix(1.0, shadow_sample, shadow_darkness); + } + else + return 1.0; +}