//-----------------------------------------------------------------------------
// light.sha
// 
// Contains the defaults for all the lighting parameters of the scene, and 
// also the shaders for rendering the point lights.
//
// Changing the ambient default here will effect all the other shaders.
//-----------------------------------------------------------------------------

texture tGlare;
texture tGlare2;

DWord cColor = 0xffffffff;

// These constants are copied from this shader and spread to all other shaders unless overridden
DWord cAmbientDefault = 0x40404040;
DWord dwNumLights = 1;
DWord cLight  = 0xffffffff;
DWord cLight2 = 0xffffffff;
DWord cLight3 = 0xffffffff;
DWord cLight4 = 0xffffffff;

technique Flare
{
    pass P0
    {
        VertexShaderConstant[0] = <cAmbientDefault>;  // Forces it to be seen as a Used parameter
        VertexShaderConstant[1] = <dwNumLights>;
        VertexShaderConstant[2] = <cLight>;

        TextureFactor = <cColor>;

        CullMode = None;

        // Stage0
        Texture[0]   = <tGlare>;
        MinFilter[0] = Linear;
        MagFilter[0] = Linear;
	    MipFilter[0] = Linear;
        ColorOp[0]   = Modulate;
        ColorArg1[0] = Texture;
        ColorArg2[0] = TFactor;
        AlphaOp[0]   = Modulate;
        AlphaArg1[0] = Texture;
        AlphaArg2[0] = TFactor;

        ColorOp[1] = Disable;

        // Dest
        ZWriteEnable = False;
        AlphaBlendEnable = True;
        SrcBlend = SrcAlpha;
        DestBlend = One;
    }
}

Float RefectionFlareScale = 3.0f;

technique ReflectionCubeMap
{
    pass P0
    {
        TextureFactor = <cColor>;

        CullMode = None;

        // Stage0
        Texture[0]   = <tGlare2>;
        MinFilter[0] = Linear;
	    MagFilter[0] = Linear;
	    MipFilter[0] = Linear;
        ColorOp[0]   = Modulate;
        ColorArg1[0] = Texture;
        ColorArg2[0] = TFactor;
        AlphaOp[0]   = Modulate;
        AlphaArg1[0] = Texture;
        AlphaArg2[0] = TFactor;

        ColorOp[1] = Disable;
            
        // Dest
        ZWriteEnable = False;
        AlphaBlendEnable = True;
        SrcBlend = SrcAlpha;
        DestBlend = One;
    }
}
