当前位置: 首页>>代码示例>>C#>>正文


C# DeviceContext.SetRenderState方法代码示例

本文整理汇总了C#中DeviceContext.SetRenderState方法的典型用法代码示例。如果您正苦于以下问题:C# DeviceContext.SetRenderState方法的具体用法?C# DeviceContext.SetRenderState怎么用?C# DeviceContext.SetRenderState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DeviceContext的用法示例。


在下文中一共展示了DeviceContext.SetRenderState方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ResetState

        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;
        }
开发者ID:TormentedEmu,项目名称:OpenUO,代码行数:8,代码来源:AlphaTestState.cs

示例2: ResetState

        internal void ResetState(ref DepthColourCullState current, DeviceContext device, bool reverseCull)
        {
            device.SetRenderState(RenderState.ZEnable, DepthTestEnabled);
            device.SetRenderState(RenderState.ZWriteEnable, DepthWriteEnabled);
            device.SetRenderState(RenderState.ZFunc, DepthTestFunction);
            device.SetRenderState(RenderState.CullMode, GetCullMode(reverseCull));
            device.SetRenderState(RenderState.FillMode, FillMode);

            current._mode = _mode;
        }
开发者ID:TormentedEmu,项目名称:OpenUO,代码行数:10,代码来源:DepthColourCullState.cs

示例3: ApplyState

        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;
        }
开发者ID:TormentedEmu,项目名称:OpenUO,代码行数:34,代码来源:AlphaTestState.cs

示例4: ApplyState

        internal bool ApplyState(ref DepthColourCullState current, DeviceContext device, bool reverseCull)
        {
            bool changed = false;

            // bits 6 to 14 are used.. so ignore bits 1-5
            if ((current._mode & (~63)) != (_mode & (~63)))
            {
            #if DEBUG
                changed = true;
            #endif
                Cull cull = CullMode;
                if (cull != current.CullMode)
                {
                    device.SetRenderState(RenderState.CullMode, GetCullMode(reverseCull));
                    current.CullMode = cull;
                }

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

            if (DepthTestEnabled)
            {
                if (!current.DepthTestEnabled)
                {
            #if DEBUG
                    changed = true;
            #endif
                    device.SetRenderState(RenderState.ZEnable, true);
                }

                if (DepthWriteEnabled != current.DepthWriteEnabled)
                {
            #if DEBUG
                    changed = true;
            #endif
                    device.SetRenderState(RenderState.ZWriteEnable, DepthWriteEnabled);
                }

                if (DepthTestFunction != current.DepthTestFunction)
                {
            #if DEBUG
                    changed = true;
            #endif
                    device.SetRenderState(RenderState.ZFunc, DepthTestFunction);
                }

                current._mode = _mode;
            }
            else
            {
                if (current.DepthTestEnabled)
                {
            #if DEBUG
                    changed = true;
            #endif
                    device.SetRenderState(RenderState.ZEnable, false);
                    current.DepthTestEnabled = false;
                }
            }
            return changed;
        }
开发者ID:TormentedEmu,项目名称:OpenUO,代码行数:66,代码来源:DepthColourCullState.cs

示例5: ResetState

        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;
        }
开发者ID:TormentedEmu,项目名称:OpenUO,代码行数:13,代码来源:AlphaBlendState.cs

示例6: ApplyState

        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;
        }
开发者ID:TormentedEmu,项目名称:OpenUO,代码行数:49,代码来源:AlphaBlendState.cs

示例7: ResetState

        internal void ResetState(ref StencilTestState current, DeviceContext device)
        {
            device.SetRenderState(RenderState.StencilZFail, StencilPassZFailOperation);
            device.SetRenderState(RenderState.StencilPass, StencilPassOperation);
            device.SetRenderState(RenderState.StencilFail, StencilFailOperation);
            device.SetRenderState(RenderState.CcwStencilZFail, BackfaceStencilPassZFailOperation);
            device.SetRenderState(RenderState.CcwStencilPass, BackfaceStencilPassOperation);
            device.SetRenderState(RenderState.CcwStencilFail, BackfaceStencilFailOperation);
            device.SetRenderState(RenderState.StencilFunc, StencilFunction);
            device.SetRenderState(RenderState.CcwStencilFunc, BackfaceStencilFunction);

            device.SetRenderState(RenderState.StencilEnable, Enabled);
            device.SetRenderState(RenderState.TwoSidedStencilMode, TwoSidedStencilModeEnabled);

            device.SetRenderState(RenderState.StencilRef, ReferenceValue);
            device.SetRenderState(RenderState.StencilMask, StencilReadMask);
            device.SetRenderState(RenderState.StencilWriteMask, StencilWriteMask);

            current._op = _op;
            current._mode = _mode;
        }
开发者ID:TormentedEmu,项目名称:OpenUO,代码行数:21,代码来源:StencilTestState.cs

示例8: ApplyState

        internal bool ApplyState(ref StencilTestState current, DeviceContext device)
        {
            bool changed = false;
            if (Enabled)
            {
            #if DEBUG
                changed = _mode != current._mode ||
                    _op != current._op;
            #endif
                if (!current.Enabled)
                    device.SetRenderState(RenderState.StencilEnable, true);

                if (_op != current._op)
                {
                    if (current.StencilPassZFailOperation != StencilPassZFailOperation)
                        device.SetRenderState(RenderState.StencilZFail, StencilPassZFailOperation);

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

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

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

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

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

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

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

                    current._op = _op;
                }

                if (current._mode != _mode)
                {
                    if (current.TwoSidedStencilModeEnabled != TwoSidedStencilModeEnabled)
                        device.SetRenderState(RenderState.TwoSidedStencilMode, TwoSidedStencilModeEnabled);

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

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

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

                current._mode = _mode;
            }
            else
            {
                if (current.Enabled)
                {
            #if DEBUG
                    changed = true;
            #endif
                    device.SetRenderState(RenderState.StencilEnable, false);
                    current.Enabled = false;
                }
            }
            return changed;
        }
开发者ID:TormentedEmu,项目名称:OpenUO,代码行数:71,代码来源:StencilTestState.cs


注:本文中的DeviceContext.SetRenderState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。