示例#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 AlphaTestState current, DeviceContext device)
        {
            device.SetRenderState(RenderState.AlphaTestEnable, Enabled);
            device.SetRenderState(RenderState.AlphaFunc, AlphaTestFunction);
            device.SetRenderState(RenderState.AlphaRef, ReferenceAlpha);

            current._mode = _mode;
        }
示例#3
0
        internal bool ApplyState(ref AlphaTestState current, DeviceContext device)
        {
            bool changed = false;

            if (Enabled)
            {
#if DEBUG
                changed = _mode != current._mode;
#endif

                if (!current.Enabled)
                {
                    device.SetRenderState(RenderState.AlphaTestEnable, true);
                }

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

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

                current._mode = _mode;
            }
            else
            {
                if (current.Enabled)
                {
#if DEBUG
                    changed = true;
#endif
                    device.SetRenderState(RenderState.AlphaTestEnable, false);
                    current.Enabled = false;
                }
            }
            return(changed);
        }
示例#4
0
        internal void ResetState(ref AlphaTestState current, DeviceContext device)
        {
            device.SetRenderState(RenderState.AlphaTestEnable, Enabled);
            device.SetRenderState(RenderState.AlphaFunc, AlphaTestFunction);
            device.SetRenderState(RenderState.AlphaRef, ReferenceAlpha);

            current._mode = _mode;
        }
示例#5
0
        internal bool ApplyState(ref AlphaTestState current, DeviceContext device)
        {
            bool changed = false;
            if (Enabled)
            {

            #if DEBUG
                changed = _mode != current._mode;
            #endif

                if (!current.Enabled)
                    device.SetRenderState(RenderState.AlphaTestEnable, true);

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

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

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