Skip to content

Commit c388fc0

Browse files
Merge pull request AristurtleDev#10 from AristurtleDev/feature/exppose-rasterizerstate
Expose rasterizer state property
2 parents e6fb790 + 3007729 commit c388fc0

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/Forme.MonoGame/FormeRenderer.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ public sealed class FormeRenderer : IDisposable
6464
/// </remarks>
6565
public bool IsDisposed { get; private set; }
6666

67+
/// <summary>
68+
/// Gets or sets the <see cref="Microsoft.Xna.Framework.Graphics.RasterizerState"/> applied
69+
/// during the glyph flush in <see cref="End"/>.
70+
/// </summary>
71+
/// <remarks>
72+
/// Defaults to <see cref="RasterizerState.CullNone"/> (no face culling, scissor test
73+
/// disabled). Set this to a state with <c>ScissorTestEnable = true</c> when the caller
74+
/// manages a scissor rect for clipping (e.g. a UI renderer with panel or window clip regions).
75+
/// The value must not be <see langword="null"/>.
76+
/// </remarks>
77+
public RasterizerState RasterizerState { get; set; } = RasterizerState.CullNone;
78+
6779
/// <summary>
6880
/// Initializes a new <see cref="FormeRenderer"/> and loads the embedded Slug shader.
6981
/// </summary>
@@ -317,7 +329,7 @@ public void End()
317329

318330
_graphicsDevice.BlendState = BlendState.AlphaBlend;
319331
_graphicsDevice.DepthStencilState = DepthStencilState.None;
320-
_graphicsDevice.RasterizerState = RasterizerState.CullNone;
332+
_graphicsDevice.RasterizerState = RasterizerState;
321333
_graphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
322334
_graphicsDevice.SamplerStates[1] = SamplerState.PointClamp;
323335
_graphicsDevice.SamplerStates[2] = SamplerState.PointClamp;

0 commit comments

Comments
 (0)