Debian Codegraph @

plugins/core/GL/qEDL/shaders/EDL/edl_mix.frag

raw
1 //////////////////////////////////////////////////////////////////////////////////////
2 //
3 //
4 // EyeDome Lighting - Compositing
5 //
6 // C.B. - 04/23/2008
7 // D.G-M. - 10/21/2010
8 //
9 // IN:
10 // s2_I1 - full scale shading image
11 // s2_I2 - half-size shading image
12 // s2_I4 - quarter-size shading image
13 // s2_D - depth image
14 // OUT:
15 // composited image
16 //
17 //////////////////////////////////////////////////////////////////////////////////////
18 //#extension GL_ARB_draw_buffers : enable
19
20 /**************************************************/
21 uniform sampler2D s2_I1; // X1 scale
22 uniform sampler2D s2_I2; // X2 scale
23 uniform sampler2D s2_I4; // X4 scale
24 uniform sampler2D s2_D; // initial depth texture
25 //
26 uniform float A0;
27 uniform float A1;
28 uniform float A2;
29 /**************************************************/
30
31 void main (void)
32 {
33 float d = texture2D(s2_D,gl_TexCoord[0].st).r;
34 if( d > 0.999)
35 {
36 gl_FragData[0].rgb = texture2D(s2_I1,gl_TexCoord[0].st).rgb;
37 gl_FragData[0].a = 1.;
38 return;
39 }
40
41 //color version
42 vec3 C1 = texture2D(s2_I1,gl_TexCoord[0].st).rgb;
43 vec3 C2 = texture2D(s2_I2,gl_TexCoord[0].st).rgb;
44 vec3 C4 = texture2D(s2_I4,gl_TexCoord[0].st).rgb;
45 vec3 C = (A0*C1 + A1*C2 + A2*C4) / (A0+A1+A2);
46
47 gl_FragData[0] = vec4(C.x,C.y,C.z,1.);
48 }