X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=shaderlib%2Foccluder.glsl;h=abd29a0aaa07dde0db265fd95eec33d4464aed9d;hb=ae423e6ef278388f92802fbae34b1c7ec339292f;hp=b5d05f09ad25dee7b98563dac8564dd0ff98bb82;hpb=57588abbefc8f0162332ac2310c69b62a14b2404;p=libs%2Fgl.git diff --git a/shaderlib/occluder.glsl b/shaderlib/occluder.glsl index b5d05f09..abd29a0a 100644 --- a/shaderlib/occluder.glsl +++ b/shaderlib/occluder.glsl @@ -1,5 +1,14 @@ import msp_interface; +uniform AlphaCutoff +{ + float alpha_cutoff; +}; + +uniform sampler2D alpha_map; + +layout(constant_id=auto) const bool use_alpha_cutoff = false; + #pragma MSP stage(vertex) virtual vec4 get_vertex_position() { @@ -20,4 +29,19 @@ void main() vec4 eye_vertex = eye_world_matrix*get_vertex_transform()*get_vertex_position(); clipping(eye_vertex.xyz); gl_Position = clip_eye_matrix*eye_vertex; + passthrough; +} + +#pragma MSP stage(fragment) +layout(location=0) out vec4 frag_color; + +void main() +{ + if(use_alpha_cutoff) + { + float alpha = texture(alpha_map, texcoord.xy).a; + if(alpha