private void ExecuteTechnique(Texture2D source, RenderTarget2D destination, string techniqueName, Texture2D shadowMap)
        {
            Vector2 renderTargetSize;

            renderTargetSize = new Vector2((float)baseSize, (float)baseSize);
            graphicsDevice.SetRenderTarget(destination);
            graphicsDevice.Clear(Color.White);
            resolveShadowsEffect.Parameters["renderTargetSize"].SetValue(renderTargetSize);

            if (source != null)
            {
                resolveShadowsEffect.Parameters["InputTexture"].SetValue(source);
            }
            if (shadowMap != null)
            {
                resolveShadowsEffect.Parameters["ShadowMapTexture"].SetValue(shadowMap);
            }

            if (techniqueName != null)
            {
                resolveShadowsEffect.CurrentTechnique = resolveShadowsEffect.Techniques[techniqueName];
            }

            foreach (EffectPass pass in resolveShadowsEffect.CurrentTechnique.Passes)
            {
                pass.Apply();
                quadRender.Render(Vector2.One * -1, Vector2.One);
            }
            graphicsDevice.SetRenderTarget(null);
        }
Exemplo n.º 2
0
        public void NeighborhoodBlendingPass(Texture src, Surface dst)
        {
            _device.SetRenderTarget(0, dst);
            _effect.SetTexture("colorTex2D", src);
            _effect.SetTexture("blendTex2D", _blendTex);
            _effect.SetValue("pixelSize", new float[] { 1.0f / _width, 1.0f / _height });
            _effect.Technique = _effect.GetTechnique("NeighborhoodBlending");

            _effect.Begin();
            _effect.BeginPass(0);
            _quadRender.Render(_device);
            _effect.EndPass();
            _effect.End();
        }