Ejemplo n.º 1
0
 /// <summary>
 /// <p>Create a blend-state object that encapsulates blend state for the output-merger stage.</p>
 /// </summary>
 /// <param name="device">The  <see cref="DirectXDevice"/>.</param>
 /// <param name="sourceBlend">The source blend.</param>
 /// <param name="destinationBlend">The destination blend.</param>
 /// <param name="blendOperation">The blend operation.</param>
 /// <param name="sourceAlphaBlend">The source alpha blend.</param>
 /// <param name="destinationAlphaBlend">The destination alpha blend.</param>
 /// <param name="alphaBlendOperation">The alpha blend operation.</param>
 /// <param name="renderTargetWriteMask">The render target write mask.</param>
 /// <param name="mask">The mask.</param>
 /// <returns>A new <see cref="BlendState" /> instance.</returns>
 /// <msdn-id>ff476500</msdn-id>
 ///   <unmanaged>HRESULT ID3D11Device::CreateBlendState([In] const D3D11_BLEND_DESC* pBlendStateDesc,[Out, Fast] ID3D11BlendState** ppBlendState)</unmanaged>
 ///   <unmanaged-short>ID3D11Device::CreateBlendState</unmanaged-short>
 /// <remarks><p>An application can create up to 4096 unique blend-state objects. For each object created, the runtime checks to see if a previous object  has the same state. If such a previous object exists, the runtime will return a reference to previous instance instead of creating a duplicate object.</p></remarks>
 public static BlendState New(DirectXDevice device, BlendOption sourceBlend, BlendOption destinationBlend,
                              BlendOperation blendOperation, BlendOption sourceAlphaBlend, BlendOption destinationAlphaBlend,
                              BlendOperation alphaBlendOperation, ColorWriteMaskFlags renderTargetWriteMask = ColorWriteMaskFlags.All,
                              int mask = -1)
 {
     return(New(device, sourceBlend, destinationBlend, blendOperation, sourceAlphaBlend, destinationAlphaBlend,
                alphaBlendOperation, renderTargetWriteMask, Color.White, mask));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// <p>Create a blend-state object that encapsulates blend state for the output-merger stage.</p>
 /// </summary>
 /// <param name="device">The  <see cref="DirectXDevice"/>.</param>
 /// <param name="sourceBlend">The source blend.</param>
 /// <param name="destinationBlend">The destination blend.</param>
 /// <param name="blendOperation">The blend operation.</param>
 /// <param name="sourceAlphaBlend">The source alpha blend.</param>
 /// <param name="destinationAlphaBlend">The destination alpha blend.</param>
 /// <param name="alphaBlendOperation">The alpha blend operation.</param>
 /// <param name="renderTargetWriteMask">The render target write mask.</param>
 /// <param name="blendFactor">The blend factor.</param>
 /// <param name="mask">The mask.</param>
 /// <returns>A new <see cref="BlendState"/> instance.</returns>
 /// <msdn-id>ff476500</msdn-id>
 ///   <unmanaged>HRESULT ID3D11Device::CreateBlendState([In] const D3D11_BLEND_DESC* pBlendStateDesc,[Out, Fast] ID3D11BlendState** ppBlendState)</unmanaged>
 ///   <unmanaged-short>ID3D11Device::CreateBlendState</unmanaged-short>
 /// <remarks><p>An application can create up to 4096 unique blend-state objects. For each object created, the runtime checks to see if a previous object  has the same state. If such a previous object exists, the runtime will return a reference to previous instance instead of creating a duplicate object.</p></remarks>
 public static BlendState New(DirectXDevice device, BlendOption sourceBlend, BlendOption destinationBlend,
                              BlendOperation blendOperation, BlendOption sourceAlphaBlend, BlendOption destinationAlphaBlend,
                              BlendOperation alphaBlendOperation, ColorWriteMaskFlags renderTargetWriteMask, Color4 blendFactor,
                              int mask = -1)
 {
     return(New(device,
                new RenderTargetBlendDescription(true, sourceBlend, destinationBlend, blendOperation, sourceAlphaBlend,
                                                 destinationAlphaBlend, alphaBlendOperation, renderTargetWriteMask), blendFactor, mask));
 }
Ejemplo n.º 3
0
 public void Load(BinaryReader reader)
 {
     AlphaBlendOperation   = (BlendOperation)reader.ReadByte();
     BlendOperation        = (BlendOperation)reader.ReadByte();
     ColourWriteMask       = (ColorWriteMaskFlags)reader.ReadByte();
     DestinationAlphaBlend = (BlendOption)reader.ReadByte();
     DestinationBlend      = (BlendOption)reader.ReadByte();
     SourceAlphaBlend      = (BlendOption)reader.ReadByte();
     SourceBlend           = (BlendOption)reader.ReadByte();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RenderTargetBlendDescription" /> struct.
 /// </summary>
 /// <param name="isBlendEnabled">The is blend enabled.</param>
 /// <param name="sourceBlend">The source blend.</param>
 /// <param name="destinationBlend">The destination blend.</param>
 /// <param name="blendOperation">The blend operation.</param>
 /// <param name="sourceAlphaBlend">The source alpha blend.</param>
 /// <param name="destinationAlphaBlend">The destination alpha blend.</param>
 /// <param name="alphaBlendOperation">The alpha blend operation.</param>
 /// <param name="renderTargetWriteMask">The render target write mask.</param>
 public RenderTargetBlendDescription(bool isBlendEnabled, BlendOption sourceBlend, BlendOption destinationBlend, BlendOperation blendOperation, BlendOption sourceAlphaBlend, BlendOption destinationAlphaBlend, BlendOperation alphaBlendOperation, ColorWriteMaskFlags renderTargetWriteMask)
 {
     IsBlendEnabled        = isBlendEnabled;
     SourceBlend           = sourceBlend;
     DestinationBlend      = destinationBlend;
     BlendOperation        = blendOperation;
     SourceAlphaBlend      = sourceAlphaBlend;
     DestinationAlphaBlend = destinationAlphaBlend;
     AlphaBlendOperation   = alphaBlendOperation;
     RenderTargetWriteMask = renderTargetWriteMask;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RenderTargetBlendDescription" /> struct.
 /// </summary>
 /// <param name="isBlendEnabled">The is blend enabled.</param>
 /// <param name="sourceBlend">The source blend.</param>
 /// <param name="destinationBlend">The destination blend.</param>
 /// <param name="blendOperation">The blend operation.</param>
 /// <param name="sourceAlphaBlend">The source alpha blend.</param>
 /// <param name="destinationAlphaBlend">The destination alpha blend.</param>
 /// <param name="alphaBlendOperation">The alpha blend operation.</param>
 /// <param name="renderTargetWriteMask">The render target write mask.</param>
 public RenderTargetBlendDescription(bool isBlendEnabled, BlendOption sourceBlend, BlendOption destinationBlend, BlendOperation blendOperation, BlendOption sourceAlphaBlend, BlendOption destinationAlphaBlend, BlendOperation alphaBlendOperation, ColorWriteMaskFlags renderTargetWriteMask)
 {
     IsBlendEnabled = isBlendEnabled;
     SourceBlend = sourceBlend;
     DestinationBlend = destinationBlend;
     BlendOperation = blendOperation;
     SourceAlphaBlend = sourceAlphaBlend;
     DestinationAlphaBlend = destinationAlphaBlend;
     AlphaBlendOperation = alphaBlendOperation;
     RenderTargetWriteMask = renderTargetWriteMask;
 }
Ejemplo n.º 6
0
        public void Evaluate(int SpreadMax)
        {
            if (this.red.IsChanged ||
                this.green.IsChanged ||
                this.blue.IsChanged ||
                this.alpha.IsChanged ||
                this.FInState.IsChanged)
            {
                this.FOutState.SliceCount = SpreadMax;

                for (int i = 0; i < SpreadMax; i++)
                {
                    DX11RenderState rs;
                    if (this.FInState.IsConnected)
                    {
                        rs = this.FInState[i].Clone();
                    }
                    else
                    {
                        rs = new DX11RenderState();
                    }

                    ColorWriteMaskFlags flag = ColorWriteMaskFlags.None;
                    if (red[i])
                    {
                        flag |= ColorWriteMaskFlags.Red;
                    }
                    if (green[i])
                    {
                        flag |= ColorWriteMaskFlags.Green;
                    }
                    if (blue[i])
                    {
                        flag |= ColorWriteMaskFlags.Blue;
                    }
                    if (alpha[i])
                    {
                        flag |= ColorWriteMaskFlags.Alpha;
                    }

                    BlendStateDescription bs = rs.Blend;
                    bs.RenderTargets[0].RenderTargetWriteMask = flag;


                    rs.Blend = bs;

                    this.FOutState[i] = rs;
                }
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WriteMaskEditor"/> class.
        /// </summary>
        /// <param name="writeMask">The current write mask flags.</param>
        public WriteMaskEditor(ColorWriteMaskFlags writeMask)
            : this()
        {
            var maskBits =
                ((ColorWriteMaskFlags[])Enum.GetValues(typeof(ColorWriteMaskFlags))).Where(item => item != ColorWriteMaskFlags.All && item != ColorWriteMaskFlags.None)
                .ToArray();

            Items.Clear();

            foreach (ColorWriteMaskFlags flag in maskBits)
            {
                Items.Add(flag, (writeMask & flag) == flag);
            }


            CheckOnClick = true;
        }
Ejemplo n.º 8
0
 /// <summary>
 /// <p>Create a blend-state object that encapsulates blend state for the output-merger stage.</p>
 /// </summary>
 /// <param name="device">The  <see cref="GraphicsDevice"/>.</param>
 /// <param name="sourceBlend">The source blend.</param>
 /// <param name="destinationBlend">The destination blend.</param>
 /// <param name="blendOperation">The blend operation.</param>
 /// <param name="sourceAlphaBlend">The source alpha blend.</param>
 /// <param name="destinationAlphaBlend">The destination alpha blend.</param>
 /// <param name="alphaBlendOperation">The alpha blend operation.</param>
 /// <param name="renderTargetWriteMask">The render target write mask.</param>
 /// <param name="blendFactor">The blend factor.</param>
 /// <param name="mask">The mask.</param>
 /// <returns>A new <see cref="BlendState"/> instance.</returns>
 /// <msdn-id>ff476500</msdn-id>
 ///   <unmanaged>HRESULT ID3D11Device::CreateBlendState([In] const D3D11_BLEND_DESC* pBlendStateDesc,[Out, Fast] ID3D11BlendState** ppBlendState)</unmanaged>
 ///   <unmanaged-short>ID3D11Device::CreateBlendState</unmanaged-short>
 /// <remarks><p>An application can create up to 4096 unique blend-state objects. For each object created, the runtime checks to see if a previous object  has the same state. If such a previous object exists, the runtime will return a reference to previous instance instead of creating a duplicate object.</p></remarks>
 public static BlendState New(GraphicsDevice device, BlendOption sourceBlend, BlendOption destinationBlend, BlendOperation blendOperation, BlendOption sourceAlphaBlend, BlendOption destinationAlphaBlend, BlendOperation alphaBlendOperation, ColorWriteMaskFlags renderTargetWriteMask, Color4 blendFactor, int mask = -1)
 {
     return New(device, new RenderTargetBlendDescription(true, sourceBlend, destinationBlend, blendOperation, sourceAlphaBlend, destinationAlphaBlend, alphaBlendOperation, renderTargetWriteMask), blendFactor, mask);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// <p>Create a blend-state object that encapsulates blend state for the output-merger stage.</p>
 /// </summary>
 /// <param name="device">The  <see cref="GraphicsDevice"/>.</param>
 /// <param name="sourceBlend">The source blend.</param>
 /// <param name="destinationBlend">The destination blend.</param>
 /// <param name="blendOperation">The blend operation.</param>
 /// <param name="sourceAlphaBlend">The source alpha blend.</param>
 /// <param name="destinationAlphaBlend">The destination alpha blend.</param>
 /// <param name="alphaBlendOperation">The alpha blend operation.</param>
 /// <param name="renderTargetWriteMask">The render target write mask.</param>
 /// <param name="mask">The mask.</param>
 /// <returns>A new <see cref="BlendState" /> instance.</returns>
 /// <msdn-id>ff476500</msdn-id>
 ///   <unmanaged>HRESULT ID3D11Device::CreateBlendState([In] const D3D11_BLEND_DESC* pBlendStateDesc,[Out, Fast] ID3D11BlendState** ppBlendState)</unmanaged>
 ///   <unmanaged-short>ID3D11Device::CreateBlendState</unmanaged-short>
 /// <remarks><p>An application can create up to 4096 unique blend-state objects. For each object created, the runtime checks to see if a previous object  has the same state. If such a previous object exists, the runtime will return a reference to previous instance instead of creating a duplicate object.</p></remarks>
 public static BlendState New(GraphicsDevice device, BlendOption sourceBlend, BlendOption destinationBlend, BlendOperation blendOperation, BlendOption sourceAlphaBlend, BlendOption destinationAlphaBlend, BlendOperation alphaBlendOperation, ColorWriteMaskFlags renderTargetWriteMask = ColorWriteMaskFlags.All, int mask = -1)
 {
     return New(device, sourceBlend, destinationBlend, blendOperation, sourceAlphaBlend, destinationAlphaBlend, alphaBlendOperation, renderTargetWriteMask, Color.White, mask);            
 }
Ejemplo n.º 10
0
        public static BlendState CreateBlendState(Device device, bool blendEnable, BlendOperation op, BlendOption src, BlendOption dst, BlendOperation opAlpha, BlendOption srcAlpha, BlendOption dstAlpha, ColorWriteMaskFlags writeMask)
        {
            BlendStateDescription bsd = new BlendStateDescription();

            //ZeroMemory(&bsd, sizeof(bsd));
            bsd.RenderTarget[0].IsBlendEnabled        = blendEnable;
            bsd.RenderTarget[0].BlendOperation        = op;
            bsd.RenderTarget[0].SourceBlend           = src;
            bsd.RenderTarget[0].DestinationBlend      = dst;
            bsd.RenderTarget[0].AlphaBlendOperation   = opAlpha;
            bsd.RenderTarget[0].SourceAlphaBlend      = srcAlpha;
            bsd.RenderTarget[0].DestinationAlphaBlend = dstAlpha;
            bsd.RenderTarget[0].RenderTargetWriteMask = writeMask;
            BlendState bs = new BlendState(device, bsd);

            return(bs);
        }