Beispiel #1
0
        private void ExecuteTechniqueDistortAndComputeDistance(ShadowCasterMap shadowCasterMap, LightSource light, RenderTarget2D destination, string techniqueName, Camera gameCamera)
        {
            graphicsDevice.SetRenderTarget(destination);
            graphicsDevice.Clear(Color.White);

            this.lightsFX.ResolveShadowsEffect.Parameters["lightRelativeZero"].SetValue(light.RelativeZeroHLSL(shadowCasterMap, gameCamera));

            Vector2 shadowCasterMapPortion = (light.Size * shadowCasterMap.PrecisionRatio) / shadowCasterMap.Size;
            this.lightsFX.ResolveShadowsEffect.Parameters["shadowCasterMapPortion"].SetValue(shadowCasterMapPortion);

            this.lightsFX.ResolveShadowsEffect.Parameters["InputTexture"].SetValue(shadowCasterMap.Map);

            this.lightsFX.ResolveShadowsEffect.CurrentTechnique = this.lightsFX.ResolveShadowsEffect.Techniques[techniqueName];

            this.lightsFX.ResolveShadowsEffect.CurrentTechnique.Passes[0].Apply();
            ShadowMapResolver.QuadRender.Render(this.graphicsDevice, Vector2.One * -1, Vector2.One);

            graphicsDevice.SetRenderTarget(null);
        }