Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
BlendStateFactory.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using SiliconStudio.Core;
4 
5 namespace SiliconStudio.Paradox.Graphics
6 {
7  /// <summary>
8  /// Base factory for <see cref="BlendState"/>.
9  /// </summary>
11  {
12  /// <summary>
13  /// Initializes a new instance of the <see cref="BlendStateFactory"/> class.
14  /// </summary>
15  /// <param name="device">The device.</param>
16  internal BlendStateFactory(GraphicsDevice device)
17  {
18  var blendDescription = new BlendStateDescription(Blend.One, Blend.Zero);
19  blendDescription.SetDefaults();
20  Default = BlendState.New(device, blendDescription).KeepAliveBy(device);
21  Default.Name = "Default";
22 
23  Additive = BlendState.New(device, new BlendStateDescription(Blend.SourceAlpha, Blend.One)).KeepAliveBy(device);
24  Additive.Name = "Additive";
25 
26  AlphaBlend = BlendState.New(device, new BlendStateDescription(Blend.One, Blend.InverseSourceAlpha)).KeepAliveBy(device);
27  AlphaBlend.Name = "AlphaBlend";
28 
29  NonPremultiplied = BlendState.New(device, new BlendStateDescription(Blend.SourceAlpha, Blend.InverseSourceAlpha)).KeepAliveBy(device);
30  NonPremultiplied.Name = "NonPremultiplied";
31 
32  Opaque = BlendState.New(device, new BlendStateDescription(Blend.One, Blend.Zero)).KeepAliveBy(device);
33  Opaque.Name = "Opaque";
34 
35  var colorDisabledDescription = new BlendStateDescription();
36  colorDisabledDescription.SetDefaults();
37  colorDisabledDescription.RenderTargets[0].ColorWriteChannels = ColorWriteChannels.None;
38  ColorDisabled = BlendState.New(device, colorDisabledDescription).KeepAliveBy(device);
39  ColorDisabled.Name = "ColorDisabled";
40  }
41 
42  /// <summary>
43  /// A built-in state object with settings for default blend, that is no blend at all.
44  /// </summary>
45  public readonly BlendState Default;
46 
47  /// <summary>
48  /// A built-in state object with settings for additive blend, that is adding the destination data to the source data without using alpha.
49  /// </summary>
50  public readonly BlendState Additive;
51 
52  /// <summary>
53  /// A built-in state object with settings for alpha blend, that is blending the source and destination data using alpha.
54  /// </summary>
55  public readonly BlendState AlphaBlend;
56 
57  /// <summary>
58  /// A built-in state object with settings for blending with non-premultipled alpha, that is blending source and destination data using alpha while assuming the color data contains no alpha information.
59  /// </summary>
60  public readonly BlendState NonPremultiplied;
61 
62  /// <summary>
63  /// A built-in state object with settings for opaque blend, that is overwriting the source with the destination data.
64  /// </summary>
65  public readonly BlendState Opaque;
66 
67  /// <summary>
68  /// A built-in state object with settings for no color rendering on target 0, that is only render to depth stencil buffer.
69  /// </summary>
70  public readonly BlendState ColorDisabled;
71  }
72 }
73 
readonly BlendState Default
A built-in state object with settings for default blend, that is no blend at all. ...
readonly BlendState Additive
A built-in state object with settings for additive blend, that is adding the destination data to the ...
readonly BlendState ColorDisabled
A built-in state object with settings for no color rendering on target 0, that is only render to dept...
Base class for a framework component.
Performs primitive-based rendering, creates resources, handles system-level variables, adjusts gamma ramp levels, and creates shaders. See The+GraphicsDevice+class to learn more about the class.
Use the default mode depending on the type of the field/property.
readonly BlendState Opaque
A built-in state object with settings for opaque blend, that is overwriting the source with the desti...
readonly BlendState AlphaBlend
A built-in state object with settings for alpha blend, that is blending the source and destination da...
readonly BlendState NonPremultiplied
A built-in state object with settings for blending with non-premultipled alpha, that is blending sour...
ColorWriteChannels
Identify which components of each pixel of a render target are writable during blending.
Blend
Blend option. A blend option identifies the data source and an optional pre-blend operation...
Definition: Blend.cs:14