[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 vec4 passInfo;
|
---|
| 15 | uniform vec4 tex0RcpSize;
|
---|
| 16 |
|
---|
| 17 | varying vec4 baseVec;
|
---|
| 18 |
|
---|
| 19 | void main(void)
|
---|
| 20 | {
|
---|
| 21 | gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
---|
| 22 |
|
---|
| 23 | vec4 posView = gl_ModelViewMatrix * gl_Vertex;
|
---|
| 24 | gl_FogFragCoord = posView.z / posView.w;
|
---|
| 25 |
|
---|
| 26 | gl_FrontColor = gl_Color;
|
---|
| 27 | gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;
|
---|
| 28 |
|
---|
| 29 | // Scaling offset
|
---|
| 30 | float iter = passInfo.x;
|
---|
| 31 |
|
---|
| 32 | // Use fractional basis value to reduce banding:
|
---|
| 33 | vec2 offsScale = tex0RcpSize.xy * pow(2.1, iter) * 0.5;
|
---|
| 34 |
|
---|
| 35 | vec4 dirVec;
|
---|
| 36 | float fiter = mod(iter, 4.0);
|
---|
| 37 | if(fiter < 2.0)
|
---|
| 38 | {
|
---|
| 39 | if(fiter < 1.0)
|
---|
| 40 | dirVec = vec4(1.0, 0.0, 0.0, 1.0); // Vectors (1, 0) and (0, 1)
|
---|
| 41 | else
|
---|
| 42 | dirVec = vec4(1.0, 1.0,-1.0, 1.0); // Vectors (1, 1) and (-1, 1)
|
---|
| 43 | }
|
---|
| 44 | else
|
---|
| 45 | {
|
---|
| 46 | if(fiter < 3.0)
|
---|
| 47 | dirVec = vec4(2.0, 1.0, -1.0, 2.0); // Vectors (2, 1) and (-1, 2)
|
---|
| 48 | else
|
---|
| 49 | dirVec = vec4(1.0, 2.0, -2.0, 1.0); // Vectors (1, 2) and (-2, 1)
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | baseVec = dirVec * offsScale.xyxy;
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | ///////////////////////////////////////////////////////////////////////////////
|
---|