[2453] | 1 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 2 | //
|
---|
| 3 | // ## ######
|
---|
| 4 | // ###### ###
|
---|
| 5 | // ## ############### Shark 3D Engine (www.shark3d.com)
|
---|
| 6 | // ########## # # #
|
---|
| 7 | // ######## Copyright (c) 1996-2006 Spinor GmbH.
|
---|
| 8 | // ######### # # # All rights reserved.
|
---|
| 9 | // ## ##########
|
---|
| 10 | // ##
|
---|
| 11 | //
|
---|
| 12 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 13 |
|
---|
| 14 | uniform sampler2D tex0;
|
---|
| 15 |
|
---|
| 16 | uniform vec4 passInfo;
|
---|
| 17 |
|
---|
| 18 | varying vec4 baseVec;
|
---|
| 19 |
|
---|
| 20 | void main(void)
|
---|
| 21 | {
|
---|
| 22 | vec2 mainTexCoord = gl_TexCoord[0].xy;
|
---|
| 23 | vec2 offsPix0 = baseVec.xy;
|
---|
| 24 | vec2 offsPix1 = baseVec.zw;
|
---|
| 25 | vec2 offsPix2 = offsPix0 + offsPix1;
|
---|
| 26 | vec2 offsPix3 = offsPix0 - offsPix1;
|
---|
| 27 |
|
---|
| 28 | vec4 val = texture2D(tex0, mainTexCoord);
|
---|
| 29 | vec4 val0 = texture2D(tex0, mainTexCoord.xy + offsPix0);
|
---|
| 30 | vec4 val1 = texture2D(tex0, mainTexCoord.xy + offsPix1);
|
---|
| 31 | vec4 val2 = texture2D(tex0, mainTexCoord.xy + offsPix2);
|
---|
| 32 | vec4 val3 = texture2D(tex0, mainTexCoord.xy + offsPix3);
|
---|
| 33 | vec4 val4 = texture2D(tex0, mainTexCoord.xy - offsPix0);
|
---|
| 34 | vec4 val5 = texture2D(tex0, mainTexCoord.xy - offsPix1);
|
---|
| 35 | vec4 val6 = texture2D(tex0, mainTexCoord.xy - offsPix2);
|
---|
| 36 | vec4 val7 = texture2D(tex0, mainTexCoord.xy - offsPix3);
|
---|
| 37 |
|
---|
| 38 | vec4 sum
|
---|
| 39 | = (val * val + val0 * val0 + val1 * val1 + val2 * val2 + val3 * val3
|
---|
| 40 | + 0.5 * (val4 * val4 + val5 * val5 + val6 * val6 + val7 * val7))
|
---|
| 41 | * 0.142857; // = approx. 1.0 / 7.0
|
---|
| 42 |
|
---|
| 43 | gl_FragColor = sqrt(sum);
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | ///////////////////////////////////////////////////////////////////////////////
|
---|