///Shader by Pashock_Razor
///PP_SunLightGlossy
/// 
///           .      
///   Emissive
/*HLSLSTART SunLightGlossy

float2    screenLightPos    =float2(0.5,0.5);
float    Weight      = 0.005f;
float    Decay      = 0.997f;
#define SAMPLES 250
float noBlur=1.0f;
texture processedTexture;

sampler processedTextureSampler = 
sampler_state
{
   Texture = <processedTexture>;
   MinFilter = LINEAR;
   MagFilter = LINEAR;
   AddressU = Clamp;
   AddressV = Clamp;
};

texture screenTexture;

sampler screenTextureSampler = 
sampler_state
{
    Texture = <screenTexture>;
    MinFilter = POINT;
    MagFilter = POINT;

    AddressU = Clamp;
    AddressV = Clamp;
};


#define NUM 13
float2 tKH[NUM];
static const float BlurWeights[NUM] = 
{
    0.002216,
    0.008764,
    0.026995,
    0.064759,
    0.120985,
    0.176033,
    0.199471,
    0.176033,
    0.120985,
    0.064759,
    0.026995,
    0.008764,
    0.002216,
};

float4 DefaultRender( in float2 textureUV : TEXCOORD0 ) : COLOR 
{
  half illuminationDecay = 0.5f;  
  half Blur = 0.1f; 
  half3 color = tex2D(screenTextureSampler, textureUV.xy);
  half2 deltaTexCoord = (textureUV - screenLightPos.xy);  
  deltaTexCoord *= 0.9f / SAMPLES * 4;    
    for (int i = 0; i < SAMPLES; i++)  
    {    
       textureUV -= deltaTexCoord;
       half3 sample = tex2D(screenTextureSampler, textureUV.y);   
       if (sample.r+sample.g+sample.b < 2.0f) 
       {
       sample.rgb=0;
       }
       sample *= illuminationDecay * Weight;  
       half3 sample2 = tex2D(screenTextureSampler, textureUV.x);
       if (sample2.r+sample2.g+sample2.b < 2.0f) sample2.rgb=0;
       sample2 *= illuminationDecay * Weight;              
       illuminationDecay *= Decay;
 color += sample+sample2;
    
}   
return float4(color,noBlur); 
}
technique PostProcessing
{
    pass P0
    {        
        PixelShader = compile ps_3_0 DefaultRender();
    }
}

HLSLEND*/


float Cam = OBJ_22;
void Main()
{
   if (iInitializing())
   {
      iShaderStack(Cam,"",1.0f);
      iShaderStack(Cam,"SunLightGlossy",1.0f);
   }
}
