////////////////////////////////////////////////////////////////////////////////// // Some transformations float4x4 WorldToObjectTranspose : WorldInverseTranspose < string UIWidget="None"; >; float4x4 ObjectToClip : WorldViewProjection < string UIWidget="None"; >; float4x4 ObjectToWorld : World < string UIWidget="None"; >; float4x4 ViewToWorld : ViewInverse < string UIWidget="None"; >; float4x4 WorldToClip : ViewProjection < string UIWidget="None"; >; ////////////////////////////////////////////////////////////////////////////////// // Global parameters texture TestTexture < string ResourceName = "earth.png"; string ResourceType = "2D"; // string UIWidget = "Texture"; >; sampler2D TestSampler = sampler_state { texture = ; AddressU = CLAMP; AddressV = WRAP; AddressW = WRAP; MIPFILTER = POINT; MINFILTER = POINT; MAGFILTER = POINT; }; float BlinkScale = 0.0f; float3 BlinkColor = float3(1,1,0); ////////////////////////////////////////////////////////////////////////////////// // Connector structures struct VSIn { float4 Position : POSITION; float2 TexCoord : TEXCOORD0; }; struct VSOut { float4 ClipPosition : POSITION; float2 TexCoord : TEXCOORD0; }; ////////////////////////////////////////////////////////////////////////////////// // Vertex shading VSOut VS_Default( VSIn vin ) { VSOut vout = (VSOut)0; vout.ClipPosition = mul( ObjectToClip, float4(vin.Position.xyz,1) ); vout.TexCoord = vin.TexCoord; return vout; } ////////////////////////////////////////////////////////////////////////////////// // Pixel shading float4 PS_SimpleTexture( VSOut pin ) : COLOR { float3 result = tex2D( TestSampler, pin.TexCoord.xy ).rgb; return float4(result+0.1,1); } float4 PS_Blink( VSOut pin ) : COLOR { return float4(BlinkColor.rgb, BlinkScale); } ////////////////////////////////////////////////////////////////////////////////// // Techniques technique TestMultiPass < string Script = "Pass=p0;"; > { pass p0 < string Script = "Draw=geometry;"; > { VertexShader = compile arbvp1 VS_Default(); PixelShader = compile arbfp1 PS_SimpleTexture(); ZEnable = true; ZWriteEnable = true; AlphaBlendEnable = false; } pass p1 < string Script = "Draw=geometry;"; > { VertexShader = compile arbvp1 VS_Default(); PixelShader = compile arbfp1 PS_Blink(); ZEnable = true; ZWriteEnable = true; ZFunc = LESSEQUAL; AlphaBlendEnable = true; BlendOp = ADD; // SrcBlend = SRCALPHA; // DestBlend = INVSRCALPHA; // stupid gl syntax... BlendFunc = int2(SrcAlpha, OneMinusSrcAlpha); } }