Пример #1
0
 public DeviceRenderState(AlphaBlendState alphaBlendState, AlphaTestState alphaTestState, DepthColourCullState depthState, StencilTestState stencilState)
 {
     StencilTest     = stencilState;
     AlphaBlend      = alphaBlendState;
     AlphaTest       = alphaTestState;
     DepthColourCull = depthState;
 }
Пример #2
0
        internal void ResetState(ref AlphaBlendState current, DeviceContext device)
        {
            device.SetRenderState(RenderState.AlphaBlendEnable, Enabled);
            device.SetRenderState(RenderState.SeparateAlphaBlendEnable, SeparateAlphaBlendEnabled);
            device.SetRenderState(RenderState.BlendOperation, BlendOperation);
            device.SetRenderState(RenderState.BlendOperationAlpha, BlendOperationAlpha);
            device.SetRenderState(RenderState.SourceBlend, SourceBlend);
            device.SetRenderState(RenderState.DestinationBlend, DestinationBlend);
            device.SetRenderState(RenderState.SourceBlendAlpha, SourceBlendAlpha);
            device.SetRenderState(RenderState.DestinationBlendAlpha, DestinationBlendAlpha);

            current._mode = _mode;
        }
Пример #3
0
        internal void ResetState(ref AlphaBlendState current, DeviceContext device)
        {
            device.SetRenderState(RenderState.AlphaBlendEnable, Enabled);
            device.SetRenderState(RenderState.SeparateAlphaBlendEnable, SeparateAlphaBlendEnabled);
            device.SetRenderState(RenderState.BlendOperation, BlendOperation);
            device.SetRenderState(RenderState.BlendOperationAlpha, BlendOperationAlpha);
            device.SetRenderState(RenderState.SourceBlend, SourceBlend);
            device.SetRenderState(RenderState.DestinationBlend, DestinationBlend);
            device.SetRenderState(RenderState.SourceBlendAlpha, SourceBlendAlpha);
            device.SetRenderState(RenderState.DestinationBlendAlpha, DestinationBlendAlpha);

            current._mode = _mode;
        }
Пример #4
0
        internal bool ApplyState(ref AlphaBlendState current, DeviceContext device)
        {
            bool changed = false;

            if (Enabled)
            {
            #if DEBUG
                if (_mode != current._mode)
                    changed = true;
            #endif
                if (!current.Enabled)
                    device.SetRenderState(RenderState.AlphaBlendEnable, true);

                if (SeparateAlphaBlendEnabled != current.SeparateAlphaBlendEnabled)
                    device.SetRenderState(RenderState.SeparateAlphaBlendEnable, SeparateAlphaBlendEnabled);

                if (BlendOperation != current.BlendOperation)
                    device.SetRenderState(RenderState.BlendOperation, BlendOperation);

                if (BlendOperationAlpha != current.BlendOperationAlpha)
                    device.SetRenderState(RenderState.BlendOperationAlpha, BlendOperationAlpha);

                if (SourceBlend != current.SourceBlend)
                    device.SetRenderState(RenderState.SourceBlend, SourceBlend);

                if (DestinationBlend != current.DestinationBlend)
                    device.SetRenderState(RenderState.DestinationBlend, DestinationBlend);

                if (SourceBlendAlpha != current.SourceBlendAlpha)
                    device.SetRenderState(RenderState.SourceBlendAlpha, SourceBlendAlpha);

                if (DestinationBlendAlpha != current.DestinationBlendAlpha)
                    device.SetRenderState(RenderState.DestinationBlendAlpha, DestinationBlendAlpha);

                current._mode = _mode;
            }
            else
            {
                if (current.Enabled)
                {
                    device.SetRenderState(RenderState.AlphaBlendEnable, false);
                    current.Enabled = false;
            #if DEBUG
                    changed = true;
            #endif
                }
            }
            return changed;
        }
Пример #5
0
        internal bool ApplyState(ref AlphaBlendState current, DeviceContext device)
        {
            bool changed = false;

            if (Enabled)
            {
#if DEBUG
                if (_mode != current._mode)
                {
                    changed = true;
                }
#endif
                if (!current.Enabled)
                {
                    device.SetRenderState(RenderState.AlphaBlendEnable, true);
                }

                if (SeparateAlphaBlendEnabled != current.SeparateAlphaBlendEnabled)
                {
                    device.SetRenderState(RenderState.SeparateAlphaBlendEnable, SeparateAlphaBlendEnabled);
                }

                if (BlendOperation != current.BlendOperation)
                {
                    device.SetRenderState(RenderState.BlendOperation, BlendOperation);
                }

                if (BlendOperationAlpha != current.BlendOperationAlpha)
                {
                    device.SetRenderState(RenderState.BlendOperationAlpha, BlendOperationAlpha);
                }

                if (SourceBlend != current.SourceBlend)
                {
                    device.SetRenderState(RenderState.SourceBlend, SourceBlend);
                }

                if (DestinationBlend != current.DestinationBlend)
                {
                    device.SetRenderState(RenderState.DestinationBlend, DestinationBlend);
                }

                if (SourceBlendAlpha != current.SourceBlendAlpha)
                {
                    device.SetRenderState(RenderState.SourceBlendAlpha, SourceBlendAlpha);
                }

                if (DestinationBlendAlpha != current.DestinationBlendAlpha)
                {
                    device.SetRenderState(RenderState.DestinationBlendAlpha, DestinationBlendAlpha);
                }

                current._mode = _mode;
            }
            else
            {
                if (current.Enabled)
                {
                    device.SetRenderState(RenderState.AlphaBlendEnable, false);
                    current.Enabled = false;
#if DEBUG
                    changed = true;
#endif
                }
            }
            return(changed);
        }