public void ResolveShadows(LightArea Area, bool attenuateShadows, Texture mask = null)
        {
            RenderImage Result       = Area.RenderTarget;
            Texture     MaskTexture  = mask == null ? Area.Mask.Texture : mask;
            Vector4f    MaskProps    = Vector4f.Zero;
            Vector4f    diffuseColor = Vector4f.One;

            //Debug.DebugRendertarget(Area.RenderTarget);
            ExecuteTechnique(Area.RenderTarget, distancesRT, "ComputeDistances");
            //Debug.DebugRendertarget(distancesRT);
            ExecuteTechnique(distancesRT, distortRT, "Distort");
            //Debug.DebugRendertarget(distortRT);

            // Working now
            ApplyHorizontalReduction(distortRT, shadowMap);

            //only DrawShadows needs these vars
            resolveShadowsEffectTechnique["DrawShadows"].SetParameter("AttenuateShadows", attenuateShadows ? 0 : 1);
            resolveShadowsEffectTechnique["DrawShadows"].SetParameter("MaskProps", MaskProps);
            resolveShadowsEffectTechnique["DrawShadows"].SetParameter("DiffuseColor", diffuseColor);

            var         maskSize   = MaskTexture.Size;
            RenderImage MaskTarget = new RenderImage("MaskTarget", maskSize.X, maskSize.Y);

            //Debug.DebugRendertarget(shadowMap, "ShadowMap");
            ExecuteTechnique(MaskTarget, Result, "DrawShadows", shadowMap);
            //Debug.DebugRendertarget(Result, "DrawShadowsResult");

            resolveShadowsEffectTechnique["DrawShadows"].ResetCurrentShader();
        }
Ejemplo n.º 2
0
 public void SetRadius(int radius)
 {
     if (Radius != radius)
     {
         Radius    = radius;
         LightArea = new LightArea(RadiusToShadowMapSize(radius));
     }
 }
Ejemplo n.º 3
0
 public void SetMask(string mask)
 {
     LightArea.SetMask(mask);
 }