2022-02-23 05:14:32 +00:00
|
|
|
|
namespace MoonWorks.Graphics
|
2021-01-20 03:33:27 +00:00
|
|
|
|
{
|
2022-02-23 05:14:32 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Specifies how the rasterizer should be configured for a graphics pipeline.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public struct RasterizerState
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Specifies whether front faces, back faces, none, or both should be culled.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public CullMode CullMode;
|
2021-02-24 20:43:35 +00:00
|
|
|
|
|
2022-02-23 05:14:32 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Specifies maximum depth bias of a fragment. Only applies if depth biasing is enabled.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public float DepthBiasClamp;
|
2021-02-24 20:43:35 +00:00
|
|
|
|
|
2022-02-23 05:14:32 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The constant depth value added to each fragment. Only applies if depth biasing is enabled.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public float DepthBiasConstantFactor;
|
2021-02-24 20:43:35 +00:00
|
|
|
|
|
2022-02-23 05:14:32 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Specifies whether depth biasing is enabled. Only applies if depth biasing is enabled.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool DepthBiasEnable;
|
2021-02-24 20:43:35 +00:00
|
|
|
|
|
2022-02-23 05:14:32 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Factor applied to a fragment's slope in depth bias calculations. Only applies if depth biasing is enabled.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public float DepthBiasSlopeFactor;
|
|
|
|
|
public bool DepthClampEnable;
|
2021-02-24 20:43:35 +00:00
|
|
|
|
|
2022-02-23 05:14:32 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Specifies how triangles should be drawn.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public FillMode FillMode;
|
2021-02-24 20:43:35 +00:00
|
|
|
|
|
2022-02-23 05:14:32 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Specifies which triangle winding order is designated as front-facing.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public FrontFace FrontFace;
|
2021-02-24 20:43:35 +00:00
|
|
|
|
|
2022-02-23 05:14:32 +00:00
|
|
|
|
public static readonly RasterizerState CW_CullFront = new RasterizerState
|
|
|
|
|
{
|
|
|
|
|
CullMode = CullMode.Front,
|
|
|
|
|
FrontFace = FrontFace.Clockwise,
|
|
|
|
|
FillMode = FillMode.Fill,
|
2022-03-14 17:48:31 +00:00
|
|
|
|
DepthBiasEnable = false
|
2022-02-23 05:14:32 +00:00
|
|
|
|
};
|
2021-01-20 03:33:27 +00:00
|
|
|
|
|
2022-02-23 05:14:32 +00:00
|
|
|
|
public static readonly RasterizerState CW_CullBack = new RasterizerState
|
|
|
|
|
{
|
|
|
|
|
CullMode = CullMode.Back,
|
|
|
|
|
FrontFace = FrontFace.Clockwise,
|
|
|
|
|
FillMode = FillMode.Fill,
|
2022-03-14 17:48:31 +00:00
|
|
|
|
DepthBiasEnable = false
|
2022-02-23 05:14:32 +00:00
|
|
|
|
};
|
2021-01-20 03:33:27 +00:00
|
|
|
|
|
2022-02-23 05:14:32 +00:00
|
|
|
|
public static readonly RasterizerState CW_CullNone = new RasterizerState
|
|
|
|
|
{
|
|
|
|
|
CullMode = CullMode.None,
|
|
|
|
|
FrontFace = FrontFace.Clockwise,
|
|
|
|
|
FillMode = FillMode.Fill,
|
2022-03-14 17:48:31 +00:00
|
|
|
|
DepthBiasEnable = false
|
2022-02-23 05:14:32 +00:00
|
|
|
|
};
|
2021-01-20 03:33:27 +00:00
|
|
|
|
|
2022-02-23 05:14:32 +00:00
|
|
|
|
public static readonly RasterizerState CW_Wireframe = new RasterizerState
|
|
|
|
|
{
|
|
|
|
|
CullMode = CullMode.None,
|
|
|
|
|
FrontFace = FrontFace.Clockwise,
|
|
|
|
|
FillMode = FillMode.Fill,
|
2022-03-14 17:48:31 +00:00
|
|
|
|
DepthBiasEnable = false
|
2022-02-23 05:14:32 +00:00
|
|
|
|
};
|
2021-01-22 01:27:25 +00:00
|
|
|
|
|
2022-02-23 05:14:32 +00:00
|
|
|
|
public static readonly RasterizerState CCW_CullFront = new RasterizerState
|
|
|
|
|
{
|
|
|
|
|
CullMode = CullMode.Front,
|
|
|
|
|
FrontFace = FrontFace.CounterClockwise,
|
|
|
|
|
FillMode = FillMode.Fill,
|
2022-03-14 17:48:31 +00:00
|
|
|
|
DepthBiasEnable = false
|
2022-02-23 05:14:32 +00:00
|
|
|
|
};
|
2021-01-22 01:27:25 +00:00
|
|
|
|
|
2022-02-23 05:14:32 +00:00
|
|
|
|
public static readonly RasterizerState CCW_CullBack = new RasterizerState
|
|
|
|
|
{
|
|
|
|
|
CullMode = CullMode.Back,
|
|
|
|
|
FrontFace = FrontFace.CounterClockwise,
|
|
|
|
|
FillMode = FillMode.Fill,
|
2022-03-14 17:48:31 +00:00
|
|
|
|
DepthBiasEnable = false
|
2022-02-23 05:14:32 +00:00
|
|
|
|
};
|
2021-01-22 01:27:25 +00:00
|
|
|
|
|
2022-02-23 05:14:32 +00:00
|
|
|
|
public static readonly RasterizerState CCW_CullNone = new RasterizerState
|
|
|
|
|
{
|
|
|
|
|
CullMode = CullMode.None,
|
|
|
|
|
FrontFace = FrontFace.CounterClockwise,
|
|
|
|
|
FillMode = FillMode.Fill,
|
2022-03-14 17:48:31 +00:00
|
|
|
|
DepthBiasEnable = false
|
2022-02-23 05:14:32 +00:00
|
|
|
|
};
|
2021-01-22 01:27:25 +00:00
|
|
|
|
|
2022-02-23 05:14:32 +00:00
|
|
|
|
public static readonly RasterizerState CCW_Wireframe = new RasterizerState
|
|
|
|
|
{
|
|
|
|
|
CullMode = CullMode.None,
|
|
|
|
|
FrontFace = FrontFace.CounterClockwise,
|
|
|
|
|
FillMode = FillMode.Fill,
|
2022-03-14 17:48:31 +00:00
|
|
|
|
DepthBiasEnable = false
|
2022-02-23 05:14:32 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
2021-01-20 03:33:27 +00:00
|
|
|
|
}
|