本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}