Show More
Commit Description:
Add missing component and message.
Commit Description:
Add missing component and message.
References:
File last commit:
Show/Diff file:
Action:
FNA/src/Graphics/States/DepthStencilState.cs
280 lines | 4.5 KiB | text/x-csharp | CSharpLexer
280 lines | 4.5 KiB | text/x-csharp | CSharpLexer
r0 | #region License | |||
/* FNA - XNA4 Reimplementation for Desktop Platforms | ||||
r690 | * Copyright 2009-2022 Ethan Lee and the MonoGame Team | |||
r0 | * | |||
* Released under the Microsoft Public License. | ||||
* See LICENSE for details. | ||||
*/ | ||||
#endregion | ||||
#region Using Statements | ||||
using System; | ||||
#endregion | ||||
namespace Microsoft.Xna.Framework.Graphics | ||||
{ | ||||
public class DepthStencilState : GraphicsResource | ||||
{ | ||||
#region Public Properties | ||||
public bool DepthBufferEnable | ||||
{ | ||||
r690 | get | |||
{ | ||||
return state.depthBufferEnable == 1; | ||||
} | ||||
set | ||||
{ | ||||
state.depthBufferEnable = (byte) (value ? 1 : 0); | ||||
} | ||||
r0 | } | |||
public bool DepthBufferWriteEnable | ||||
{ | ||||
r690 | get | |||
{ | ||||
return state.depthBufferWriteEnable == 1; | ||||
} | ||||
set | ||||
{ | ||||
state.depthBufferWriteEnable = (byte) (value ? 1 : 0); | ||||
} | ||||
r0 | } | |||
public StencilOperation CounterClockwiseStencilDepthBufferFail | ||||
{ | ||||
r690 | get | |||
{ | ||||
return state.ccwStencilDepthBufferFail; | ||||
} | ||||
set | ||||
{ | ||||
state.ccwStencilDepthBufferFail = value; | ||||
} | ||||
r0 | } | |||
public StencilOperation CounterClockwiseStencilFail | ||||
{ | ||||
r690 | get | |||
{ | ||||
return state.ccwStencilFail; | ||||
} | ||||
set | ||||
{ | ||||
state.ccwStencilFail = value; | ||||
} | ||||
r0 | } | |||
public CompareFunction CounterClockwiseStencilFunction | ||||
{ | ||||
r690 | get | |||
{ | ||||
return state.ccwStencilFunction; | ||||
} | ||||
set | ||||
{ | ||||
state.ccwStencilFunction = value; | ||||
} | ||||
r0 | } | |||
public StencilOperation CounterClockwiseStencilPass | ||||
{ | ||||
r690 | get | |||
{ | ||||
return state.ccwStencilPass; | ||||
} | ||||
set | ||||
{ | ||||
state.ccwStencilPass = value; | ||||
} | ||||
r0 | } | |||
public CompareFunction DepthBufferFunction | ||||
{ | ||||
r690 | get | |||
{ | ||||
return state.depthBufferFunction; | ||||
} | ||||
set | ||||
{ | ||||
state.depthBufferFunction = value; | ||||
} | ||||
r0 | } | |||
public int ReferenceStencil | ||||
{ | ||||
r690 | get | |||
{ | ||||
return state.referenceStencil; | ||||
} | ||||
set | ||||
{ | ||||
state.referenceStencil = value; | ||||
} | ||||
r0 | } | |||
public StencilOperation StencilDepthBufferFail | ||||
{ | ||||
r690 | get | |||
{ | ||||
return state.stencilDepthBufferFail; | ||||
} | ||||
set | ||||
{ | ||||
state.stencilDepthBufferFail = value; | ||||
} | ||||
r0 | } | |||
public bool StencilEnable | ||||
{ | ||||
r690 | get | |||
{ | ||||
return state.stencilEnable == 1; | ||||
} | ||||
set | ||||
{ | ||||
state.stencilEnable = (byte) (value ? 1 : 0); | ||||
} | ||||
r0 | } | |||
public StencilOperation StencilFail | ||||
{ | ||||
r690 | get | |||
{ | ||||
return state.stencilFail; | ||||
} | ||||
set | ||||
{ | ||||
state.stencilFail = value; | ||||
} | ||||
r0 | } | |||
public CompareFunction StencilFunction | ||||
{ | ||||
r690 | get | |||
{ | ||||
return state.stencilFunction; | ||||
} | ||||
set | ||||
{ | ||||
state.stencilFunction = value; | ||||
} | ||||
r0 | } | |||
public int StencilMask | ||||
{ | ||||
r690 | get | |||
{ | ||||
return state.stencilMask; | ||||
} | ||||
set | ||||
{ | ||||
state.stencilMask = value; | ||||
} | ||||
r0 | } | |||
public StencilOperation StencilPass | ||||
{ | ||||
r690 | get | |||
{ | ||||
return state.stencilPass; | ||||
} | ||||
set | ||||
{ | ||||
state.stencilPass = value; | ||||
} | ||||
r0 | } | |||
public int StencilWriteMask | ||||
{ | ||||
r690 | get | |||
{ | ||||
return state.stencilWriteMask; | ||||
} | ||||
set | ||||
{ | ||||
state.stencilWriteMask = value; | ||||
} | ||||
r0 | } | |||
public bool TwoSidedStencilMode | ||||
{ | ||||
r690 | get | |||
{ | ||||
return state.twoSidedStencilMode == 1; | ||||
} | ||||
set | ||||
{ | ||||
state.twoSidedStencilMode = (byte) (value ? 1 : 0); | ||||
} | ||||
r0 | } | |||
#endregion | ||||
#region Public DepthStencilState Presets | ||||
public static readonly DepthStencilState Default = new DepthStencilState( | ||||
"DepthStencilState.Default", | ||||
true, | ||||
true | ||||
); | ||||
public static readonly DepthStencilState DepthRead = new DepthStencilState( | ||||
"DepthStencilState.DepthRead", | ||||
true, | ||||
false | ||||
); | ||||
public static readonly DepthStencilState None = new DepthStencilState( | ||||
"DepthStencilState.None", | ||||
false, | ||||
false | ||||
); | ||||
#endregion | ||||
r690 | #region Internal FNA3D Variables | |||
internal FNA3D.FNA3D_DepthStencilState state; | ||||
#endregion | ||||
r0 | #region Public Constructor | |||
public DepthStencilState() | ||||
{ | ||||
DepthBufferEnable = true; | ||||
DepthBufferWriteEnable = true; | ||||
DepthBufferFunction = CompareFunction.LessEqual; | ||||
StencilEnable = false; | ||||
StencilFunction = CompareFunction.Always; | ||||
StencilPass = StencilOperation.Keep; | ||||
StencilFail = StencilOperation.Keep; | ||||
StencilDepthBufferFail = StencilOperation.Keep; | ||||
TwoSidedStencilMode = false; | ||||
CounterClockwiseStencilFunction = CompareFunction.Always; | ||||
CounterClockwiseStencilFail = StencilOperation.Keep; | ||||
CounterClockwiseStencilPass = StencilOperation.Keep; | ||||
CounterClockwiseStencilDepthBufferFail = StencilOperation.Keep; | ||||
StencilMask = Int32.MaxValue; | ||||
StencilWriteMask = Int32.MaxValue; | ||||
ReferenceStencil = 0; | ||||
} | ||||
#endregion | ||||
#region Private Constructor | ||||
private DepthStencilState( | ||||
string name, | ||||
bool depthBufferEnable, | ||||
bool depthBufferWriteEnable | ||||
) : this() { | ||||
Name = name; | ||||
DepthBufferEnable = depthBufferEnable; | ||||
DepthBufferWriteEnable = depthBufferWriteEnable; | ||||
} | ||||
#endregion | ||||
} | ||||
} | ||||