X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=shaderlib%2Fphong.glsl;h=234897116183a4997c625687447b65172ef8036d;hb=ae423e6ef278388f92802fbae34b1c7ec339292f;hp=ed091ce9a9374d0646ca900b9ca6210fd4be9dfb;hpb=4d276c9b986b111611b8396f94dae56dbe736387;p=libs%2Fgl.git diff --git a/shaderlib/phong.glsl b/shaderlib/phong.glsl index ed091ce9..23489711 100644 --- a/shaderlib/phong.glsl +++ b/shaderlib/phong.glsl @@ -14,6 +14,7 @@ struct BasicMaterialParameters uniform BasicMaterial { BasicMaterialParameters basic_material; + float alpha_cutoff; }; uniform sampler2D diffuse_map; @@ -30,8 +31,7 @@ layout(constant_id=auto) const bool use_emission = false; layout(constant_id=auto) const bool use_emission_map = false; layout(constant_id=auto) const bool use_reflectivity = false; layout(constant_id=auto) const bool use_reflectivity_map = false; -layout(constant_id=auto) const bool use_sky = false; -layout(constant_id=auto) const bool use_fog = false; +layout(constant_id=auto) const bool use_alpha_cutoff = false; #pragma MSP stage(fragment) virtual vec4 get_diffuse_color() @@ -99,7 +99,7 @@ vec3 phong_lighting(vec3 normal, vec3 look, vec3 surface_diffuse, vec3 surface_s if(light_sources[i].type!=0) { IncomingLight incoming = get_incoming_light(i, world_vertex.xyz); - float shadow = get_shadow_factor(i); + float shadow = get_shadow_factor(i, world_vertex); color += phong_one_light(incoming.direction, normal, look, surface_diffuse, surface_specular, shininess)*incoming.color*shadow; } @@ -114,10 +114,13 @@ vec3 phong_lighting(vec3 normal, vec3 look, vec3 surface_diffuse, vec3 surface_s void main() { + vec4 surface_diffuse = get_diffuse_color(); + if(use_alpha_cutoff && surface_diffuse.a