Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float4x4 WorldViewProj;
- texture Base <
- string UIName = "Base Texture";
- string ResourceType = "2D";
- >;
- sampler2D BaseTexture = sampler_state {
- Texture = <Base>;
- AddressU = Wrap;
- AddressV = Wrap;
- };
- texture Overlay <
- string UIName = "Overlay Texture";
- string ResourceType = "2D";
- >;
- sampler2D OverlayTexture = sampler_state {
- Texture = <Overlay>;
- AddressU = Wrap;
- AddressV = Wrap;
- };
- texture PreRender : RENDERCOLORTARGET
- <
- string Format = "X8R8G8B8" ;
- >;
- sampler2D PreRenderSampler = sampler_state {
- Texture = <PreRender>;
- };
- struct VS_INPUT
- {
- float4 Position : POSITION0;
- float2 Tex : TEXCOORD0;
- };
- struct VS_OUTPUT
- {
- float4 Position : POSITION0;
- float2 Tex : TEXCOORD0;
- };
- VS_OUTPUT cap_mainVS(VS_INPUT Input)
- {
- VS_OUTPUT Output;
- Output.Position = mul( Input.Position, WorldViewProj );
- Output.Tex = Input.Tex;
- return( Output );
- }
- float4 cap_mainPS(float2 tex: TEXCOORD0, float2 pos: VPOS) : COLOR
- {
- // пришлось захардкодить разрешение экрана, т.к. лезть в основной код лень
- // особенно без наличия MSVS 2012
- pos /= float2(1920.0f, 1080.0f);
- pos = pos * 2.0f - 1.0f;
- float d = distance(pos, float2(0.f, 0.f));
- float2 rg;
- sincos(d, rg.r, rg.g); // можно было бы сделать через look-up table, но сэкономим одно сэмплирование из текстур :)
- return tex2D(BaseTexture, tex) * float4(abs(rg), 0.0f, 1.0f);
- }
- ///////////////////////////////////////////////////////
- struct Overlay_VS_INPUT
- {
- float4 Position : POSITION0;
- float2 Texture1 : TEXCOORD0;
- };
- struct Overlay_VS_OUTPUT
- {
- float4 Position : POSITION0;
- float2 Texture1 : TEXCOORD0;
- float2 Texture2 : TEXCOORD1;
- };
- Overlay_VS_OUTPUT over_mainVS(Overlay_VS_INPUT Input)
- {
- Overlay_VS_OUTPUT Output;
- Output.Position = mul( Input.Position, WorldViewProj );
- Output.Texture1 = Input.Texture1;
- Output.Texture2 = Output.Position.xy*float2(0.5,0.5) + float2(0.5,0.5);
- return( Output );
- }
- float4 over_mainPS(float2 tex :TEXCOORD0, float2 pos :TEXCOORD1) : COLOR
- {
- vector tmp = tex2D(PreRenderSampler, tex);
- return tmp;
- }
- technique technique0
- {
- pass p0
- {
- CullMode = None;
- VertexShader = compile vs_3_0 cap_mainVS();
- PixelShader = compile ps_3_0 cap_mainPS();
- }
- pass p1
- {
- CullMode = None;
- VertexShader = compile vs_3_0 over_mainVS();
- PixelShader = compile ps_3_0 over_mainPS();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement