C# Class hyades.graphics.PostProcessor

Show file Open project: zfedoran/bubblebound Class Usage Examples

Public Properties

Property Type Description
color_rt Microsoft.Xna.Framework.Graphics.RenderTarget2D
depth_rt Microsoft.Xna.Framework.Graphics.RenderTarget2D
result_rt Microsoft.Xna.Framework.Graphics.RenderTarget2D

Public Methods

Method Description
Bloom ( RenderTarget2D source, RenderTarget2D result, float threshold, float bloom_intensity, float base_intensity, float bloom_saturation, float base_saturation ) : void

Applies a bloom effect to the specified render target, writes the result to the specified render target.

Blur ( RenderTarget2D source, RenderTarget2D result, float sigma ) : void

Applies a blur to the specified render target, writes the result to the specified render target.

DepthBlur ( RenderTarget2D source, RenderTarget2D result, RenderTarget2D depthTexture, float sigma ) : void

Applies a blur to the specified render target, using a depth texture to prevent pixels from blurring with pixels that are "in front"

DepthOfField ( RenderTarget2D source, RenderTarget2D result, RenderTarget2D depthTexture, Camera camera, DepthOfFieldType dofType, float focalDistance, float focalWidth, float time ) : void

Performs tone mapping on the specified render target

FlushCache ( ) : void

Disposes all intermediate textures in the cache

GetInstance ( GraphicsDevice device ) : PostProcessor
PostProcessor ( GraphicsDevice device ) : System

The class constructor

Private Methods

Method Description
GenerateDownscaleTargetHW ( RenderTarget2D source, RenderTarget2D result ) : void

Downscales the source to 1/16th size, using hardware filtering

GenerateDownscaleTargetSW ( RenderTarget2D source, RenderTarget2D result ) : void

Downscales the source to 1/16th size, using software(shader) filtering

GetIntermediateTexture ( int width, int height, SurfaceFormat format ) : IntermediateTexture

Checks the cache to see if a suitable rendertarget has already been created and isn't in use. Otherwise, creates one according to the parameters

GetIntermediateTexture ( int width, int height, SurfaceFormat format, int msQuality ) : IntermediateTexture
PostProcess ( RenderTarget2D source, RenderTarget2D result, Effect effect ) : void

Performs a post-processing step using a single source texture

Swap ( RenderTarget2D &rt1, RenderTarget2D &rt2 ) : void

Swaps two RenderTarget's

Method Details

Bloom() public method

Applies a bloom effect to the specified render target, writes the result to the specified render target.
public Bloom ( RenderTarget2D source, RenderTarget2D result, float threshold, float bloom_intensity, float base_intensity, float bloom_saturation, float base_saturation ) : void
source Microsoft.Xna.Framework.Graphics.RenderTarget2D The render target to use as the source
result Microsoft.Xna.Framework.Graphics.RenderTarget2D The render target to use as the result
threshold float
bloom_intensity float
base_intensity float
bloom_saturation float
base_saturation float
return void

Blur() public method

Applies a blur to the specified render target, writes the result to the specified render target.
public Blur ( RenderTarget2D source, RenderTarget2D result, float sigma ) : void
source Microsoft.Xna.Framework.Graphics.RenderTarget2D The render target to use as the source
result Microsoft.Xna.Framework.Graphics.RenderTarget2D The render target to use as the result
sigma float The standard deviation used for gaussian weights
return void

DepthBlur() public method

Applies a blur to the specified render target, using a depth texture to prevent pixels from blurring with pixels that are "in front"
public DepthBlur ( RenderTarget2D source, RenderTarget2D result, RenderTarget2D depthTexture, float sigma ) : void
source Microsoft.Xna.Framework.Graphics.RenderTarget2D The render target to use as the source
result Microsoft.Xna.Framework.Graphics.RenderTarget2D The render target to use as the result
depthTexture Microsoft.Xna.Framework.Graphics.RenderTarget2D The depth texture to use
sigma float The standard deviation used for gaussian weights
return void

DepthOfField() public method

Performs tone mapping on the specified render target
public DepthOfField ( RenderTarget2D source, RenderTarget2D result, RenderTarget2D depthTexture, Camera camera, DepthOfFieldType dofType, float focalDistance, float focalWidth, float time ) : void
source Microsoft.Xna.Framework.Graphics.RenderTarget2D The source render target
result Microsoft.Xna.Framework.Graphics.RenderTarget2D The render target to which the result will be output
depthTexture Microsoft.Xna.Framework.Graphics.RenderTarget2D The render target containing scene depth
camera Camera The camera used to render the scene
dofType DepthOfFieldType The type of DOF effect to apply
focalDistance float The distance to the camera focal point
focalWidth float The width of the camera focal point
time float
return void

FlushCache() public method

Disposes all intermediate textures in the cache
public FlushCache ( ) : void
return void

GetInstance() public static method

public static GetInstance ( GraphicsDevice device ) : PostProcessor
device GraphicsDevice
return PostProcessor

PostProcessor() public method

The class constructor
public PostProcessor ( GraphicsDevice device ) : System
device GraphicsDevice The GraphicsDevice to use for rendering
return System

Property Details

color_rt public property

public RenderTarget2D,Microsoft.Xna.Framework.Graphics color_rt
return Microsoft.Xna.Framework.Graphics.RenderTarget2D

depth_rt public property

public RenderTarget2D,Microsoft.Xna.Framework.Graphics depth_rt
return Microsoft.Xna.Framework.Graphics.RenderTarget2D

result_rt public property

public RenderTarget2D,Microsoft.Xna.Framework.Graphics result_rt
return Microsoft.Xna.Framework.Graphics.RenderTarget2D