/////////////////////////////////////////////////////////////////////////////// // // ## ###### // ###### ### // ## ############### Shark 3D Engine (www.shark3d.com) // ########## # # # // ######## Copyright (c) 1996-2006 Spinor GmbH. // ######### # # # All rights reserved. // ## ########## // ## // /////////////////////////////////////////////////////////////////////////////// struct VS_INPUT { float4 posObj: POSITION; float2 mainTexCoord: TEXCOORD0; }; struct VS_OUTPUT { float4 posScr: POSITION; float fog: FOG; float4 diffuse: COLOR0; float2 mainTexCoord: TEXCOORD0; float4 baseVec: TEXCOORD2; }; /////////////////////////////////////////////////////////////////////////////// const float4x4 matProjView; const float4x4 matView; const float4 mtrlEmissive; const float4 passInfo; const float4 tex0RcpSize; /////////////////////////////////////////////////////////////////////////////// // Vertexshader // Profile: 1x1 VS_OUTPUT main( VS_INPUT input ) { VS_OUTPUT output = (VS_OUTPUT)0; //Transform position to clip space output.posScr = mul(input.posObj, matProjView); //Transform position to eye space -> pos float4 posView = mul(input.posObj, matView); //fog output.fog = posView.z / posView.w; //Color output.diffuse = mtrlEmissive; // Texture coordinates output.mainTexCoord = input.mainTexCoord; // Scaling offset int iter = passInfo.x; float2 offsScale = tex0RcpSize * pow(2, iter) * 0.5; float4 dirVec; int fiter = fmod(iter, 4.0); if(fiter < 2.0) { if(fiter < 1.0) dirVec = float4(1, 0, 0, 1); // Vectors (1, 0) and (0, 1) else dirVec = float4(1, 1,-1, 1); // Vectors (1, 1) and (-1, 1) } else { if(fiter < 3.0) dirVec = float4(2, 1,-1, 2); // Vectors (2, 1) and (-1, 2) else dirVec = float4(1, 2,-2, 1); // Vectors (1, 2) and (-2, 1) } output.baseVec = dirVec * offsScale.xyxy; return output; } ///////////////////////////////////////////////////////////////////////////////