3 #if SILICONSTUDIO_PARADOX_GRAPHICS_API_DIRECT3D
5 using SiliconStudio.Core.Mathematics;
8 namespace SiliconStudio.
Paradox.Graphics
13 public partial class BlendState
21 internal BlendState(GraphicsDevice device, BlendStateDescription blendStateDescription)
24 BlendFactor = SiliconStudio.Core.Mathematics.Color4.White;
27 Description = blendStateDescription;
29 CreateNativeDeviceChild();
33 protected internal override void OnDestroyed()
40 protected internal override bool OnRecreate()
43 CreateNativeDeviceChild();
47 private void CreateNativeDeviceChild()
49 var nativeDescription =
new SharpDX.Direct3D11.BlendStateDescription();
51 nativeDescription.AlphaToCoverageEnable = Description.AlphaToCoverageEnable;
52 nativeDescription.IndependentBlendEnable = Description.IndependentBlendEnable;
53 for (
int i = 0; i < Description.RenderTargets.Length; ++i)
55 nativeDescription.RenderTarget[i].IsBlendEnabled = Description.RenderTargets[i].BlendEnable;
56 nativeDescription.RenderTarget[i].SourceBlend = (SharpDX.Direct3D11.BlendOption)Description.RenderTargets[i].ColorSourceBlend;
57 nativeDescription.RenderTarget[i].DestinationBlend = (SharpDX.Direct3D11.BlendOption)Description.RenderTargets[i].ColorDestinationBlend;
58 nativeDescription.RenderTarget[i].BlendOperation = (SharpDX.Direct3D11.BlendOperation)Description.RenderTargets[i].ColorBlendFunction;
59 nativeDescription.RenderTarget[i].SourceAlphaBlend = (SharpDX.Direct3D11.BlendOption)Description.RenderTargets[i].AlphaSourceBlend;
60 nativeDescription.RenderTarget[i].DestinationAlphaBlend = (SharpDX.Direct3D11.BlendOption)Description.RenderTargets[i].AlphaDestinationBlend;
61 nativeDescription.RenderTarget[i].AlphaBlendOperation = (SharpDX.Direct3D11.BlendOperation)Description.RenderTargets[i].AlphaBlendFunction;
62 nativeDescription.RenderTarget[i].RenderTargetWriteMask = (SharpDX.Direct3D11.ColorWriteMaskFlags)Description.RenderTargets[i].ColorWriteChannels;
65 NativeDeviceChild =
new SharpDX.Direct3D11.BlendState(NativeDevice, nativeDescription);
The data source is the blend factor set with GraphicsDevice.BlendStates. No pre-blend operation...