Engines/FlatRedBallXNA/FlatRedBall/Graphics/PostProcessing/PostProcessingEffectBase.cs
/// <summary>
/// This function MUST be overridden for any effects that make passes with multiple techniques.
/// </summary>
/// <param name="camera"></param>
/// <param name="texture"></param>
/// <param name="clearColor"></param>
/// <param name="sourceRectangle"></param>
This function MUST be overridden for any effects that make passes with multiple techniques.
This function MUST be overridden for any effects that make passes with multiple techniques .
internal virtual void DrawToCameraRenderTarget(Camera camera,
                                        ref Texture2D texture,
                                        Color clearColor,
                                        ref Rectangle sourceRectangle)
        {
#if XNA4
            throw new NotImplementedException();
#else
            SetEffectParameters(camera);
            camera.mRenderTargetTexture.SetOnDevice();
            FlatRedBallServices.GraphicsDevice.Clear(clearColor);
            PostProcessingManager.SpriteBatch.Begin(
                SpriteBlendMode.None, SpriteSortMode.Immediate, SaveStateMode.None);
            mEffect.Begin();
            for (int i = 0; i < mEffect.CurrentTechnique.Passes.Count; i++)
            {
                mEffect.CurrentTechnique.Passes[i].Begin();
                PostProcessingManager.SpriteBatch.Draw(
                    texture,
                    sourceRectangle,
                    sourceRectangle, 
                    Color.White);
                mEffect.CurrentTechnique.Passes[i].End();
            }
            mEffect.End();
            PostProcessingManager.SpriteBatch.End();
#endif
        }
internal virtual void DrawToCameraRenderTarget ( Camera camera , ref Texture2D texture , Color clearColor , ref Rectangle sourceRectangle ) { if XNA4 throw new NotImplementedException ( ) ; else SetEffectParameters ( camera ) ; camera . mRenderTargetTexture . SetOnDevice ( ) ; FlatRedBallServices . GraphicsDevice . Clear ( clearColor ) ; PostProcessingManager . SpriteBatch . Begin ( SpriteBlendMode . None , SpriteSortMode . Immediate , SaveStateMode . None ) ; mEffect . Begin ( ) ; for ( int i = 0 ; i < mEffect . CurrentTechnique . Passes . Count ; i ++ ) { mEffect . CurrentTechnique . Passes [ i ] . Begin ( ) ; PostProcessingManager . SpriteBatch . Draw ( texture , sourceRectangle , sourceRectangle , Color . White ) ; mEffect . CurrentTechnique . Passes [ i ] . End ( ) ; } mEffect . End ( ) ; PostProcessingManager . SpriteBatch . End ( ) ; endif }
This function MUST be overridden for any effects that make passes with multiple techniques.
This function MUST be overridden for any effects that make passes with multiple techniques .
// Start the sprite batch // Draw using the current effect and technique // Use null to draw the entire source Rectangle // End the sprite batch
camera
Camera
None
Texture2D
ref
clearColor
Color
None
Rectangle
ref
texture
None
sourceRectangle
None