Class RasterizerState
Contains rasterizer state, which determines how to convert vector data (shapes) into raster data (pixels).
public class RasterizerState : GraphicsResource, IDisposable
- Inheritance
-
RasterizerState
- Implements
- Inherited Members
Constructors
RasterizerState()
Creates a new instance of RasterizerState.
public RasterizerState()
Fields
CullClockwise
A built-in state object with settings for culling primitives with clockwise winding order.
public static readonly RasterizerState CullClockwise
Field Value
Remarks
This build-in state object has the following settings
CullMode = CullMode.CullClockwiseFace
CullCounterClockwise
A built-in state object with settings for culling primitives with counter-clockwise winding order.
public static readonly RasterizerState CullCounterClockwise
Field Value
Remarks
This build-in state object has the following settings
CullMode = CullMode.CullCounterClockwiseFace
CullNone
A built-in state object with settings for not culling any primitives.
public static readonly RasterizerState CullNone
Field Value
Remarks
This build-in state object has the following settings
CullMode = CullMode.None
Properties
CullMode
Gets or Sets the conditions for culling or removing triangles. The default value is CullCounterClockwiseFace
public CullMode CullMode { get; set; }
Property Value
DepthBias
Gets or Sets the depth bias for polygons, which is the amount of bias to apply to the depth of a primitive
to alleviate depth testing problems for primitives of similar depth.
The default value is 0.0f
.
public float DepthBias { get; set; }
Property Value
Remarks
A polygon with a larger z-bias value appears in front of a polygon with a smaller value. For example, a
a polygon with a value of 1.0f
appears drawn in front of a polygon with a value of 0.0f
DepthClipEnable
Gets or Sets a value that indicates whether depth clipping is enabled.
public bool DepthClipEnable { get; set; }
Property Value
FillMode
Gets or Sets the fille mode, which defines how a triangle is filled during rendering. The default is Solid.
public FillMode FillMode { get; set; }
Property Value
MultiSampleAntiAlias
Gets or Sets a value that indicates whether multisample antialiasing is enabled.
public bool MultiSampleAntiAlias { get; set; }
Property Value
Remarks
When multisample antialiasing is enabled, full-scene antialiasing is performed by calculating sampling locations at different sample positions for each multiple sample. When disabled, each multiple sample is written with the same sample value (sampled at a pixel center) which allows non-antialiased rendering to a mutlisample buffer. This property has no effect when rendering to a buffer that does not support multisampling.
ScissorTestEnable
Gets or Sets a value that indicates whether scissor testing is enabled.
public bool ScissorTestEnable { get; set; }
Property Value
Remarks
Scissor testing can improve drawing performance by only drawing triangles (or parts of triangles) that are contained within a GraphicsDevice.ScissorRectangle
SlopeScaleDepthBias
Gets or Sets a bias value that takes into account the slope of a polygon. This bias value is applied to coplanar primitives to reduce aliasing and other rendering artifacts caused by z-fighting.
public float SlopeScaleDepthBias { get; set; }
Property Value
Remarks
An application can help ensure that coplanar polygons are rendered property by adding a bias to the z-values that the system uses when rendering sets of coplanar polygons. The following formula shows how to calculate the bias to be applied to coplanar primitives
bias = (m x SlopeScaleDepthBias) + DepthBias
Where m is the maximum depth slope of the triangle being rendered, defined as
m = max( abs(delta z / delta x), abs(delta z / delta y) )
Methods
Dispose(bool)
The method that derived classes should override to implement disposing of managed and native resources.
protected override void Dispose(bool disposing)
Parameters
disposing
boolTrue if managed objects should be disposed.
Remarks
Native resources should always be released regardless of the value of the disposing parameter.