MoonWorks/src/Graphics/State/RasterizerState.cs

122 lines
3.2 KiB
C#
Raw Normal View History

2022-02-23 05:14:32 +00:00
namespace MoonWorks.Graphics
{
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
/// <summary>
/// Describes the width of the line rendering in terms of pixels.
/// </summary>
public float LineWidth;
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,
DepthBiasEnable = false,
LineWidth = 1f
};
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,
DepthBiasEnable = false,
LineWidth = 1f
};
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,
DepthBiasEnable = false,
LineWidth = 1f
};
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,
DepthBiasEnable = false,
LineWidth = 1f
};
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,
DepthBiasEnable = false,
LineWidth = 1f
};
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,
DepthBiasEnable = false,
LineWidth = 1f
};
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,
DepthBiasEnable = false,
LineWidth = 1f
};
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,
DepthBiasEnable = false,
LineWidth = 1f
};
}
}