Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DepthOfFieldEffect"/> class.
 /// </summary>
 public DepthOfFieldEffect(GraphicsDevice graphics)
 {
     Material = combine = new DepthOfFieldMaterial(graphics);
     Passes.Add(new PostEffectChain(TextureUsage.Blur,
                                    depthScaleEffect = new PostEffect()
     {
         Material = depthScale = new DepthOfFieldMaterial(graphics)
         {
             IsDownScale = true
         }, RenderTargetScale = 0.5f
     },
                                    scaleEffect = new PostEffect()
     {
         Material = new ScaleMaterial(graphics), RenderTargetScale = 0.5f, Enabled = false
     },
                                    blur = new BlurEffect(graphics)
     {
         DepthBufferEnabled = true
     },
                                    new PostEffect()
     {
         Material = new ScaleMaterial(graphics), RenderTargetScale = 2.0f
     }
                                    ));
 }
Beispiel #2
0
 public Material GetDepthOfFieldMaterial()
 {
     return(_dofMaterial ?? (_dofMaterial = DepthOfFieldMaterial.CreateMaterial()));
 }