add support for controling depth-writes in RenderState
This commit is contained in:
parent
d06cba8263
commit
17807036d4
|
@ -40,6 +40,7 @@ namespace Blarg.GameFramework.Graphics
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DepthTesting;
|
public bool DepthTesting;
|
||||||
|
public bool DepthWriting;
|
||||||
public DepthFunc DepthFunc;
|
public DepthFunc DepthFunc;
|
||||||
public bool FaceCulling;
|
public bool FaceCulling;
|
||||||
public CullMode FaceCullingMode;
|
public CullMode FaceCullingMode;
|
||||||
|
@ -76,6 +77,8 @@ namespace Blarg.GameFramework.Graphics
|
||||||
else
|
else
|
||||||
graphicsDevice.GL.glDisable(GL20.GL_DEPTH_TEST);
|
graphicsDevice.GL.glDisable(GL20.GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
graphicsDevice.GL.glDepthMask(DepthWriting);
|
||||||
|
|
||||||
if (FaceCulling)
|
if (FaceCulling)
|
||||||
{
|
{
|
||||||
graphicsDevice.GL.glEnable(GL20.GL_CULL_FACE);
|
graphicsDevice.GL.glEnable(GL20.GL_CULL_FACE);
|
||||||
|
@ -95,6 +98,7 @@ namespace Blarg.GameFramework.Graphics
|
||||||
private void Init()
|
private void Init()
|
||||||
{
|
{
|
||||||
DepthTesting = true;
|
DepthTesting = true;
|
||||||
|
DepthWriting = true;
|
||||||
DepthFunc = DepthFunc.Less;
|
DepthFunc = DepthFunc.Less;
|
||||||
FaceCulling = true;
|
FaceCulling = true;
|
||||||
FaceCullingMode = CullMode.Back;
|
FaceCullingMode = CullMode.Back;
|
||||||
|
@ -106,6 +110,7 @@ namespace Blarg.GameFramework.Graphics
|
||||||
var clone = new RenderState();
|
var clone = new RenderState();
|
||||||
clone.DepthFunc = DepthFunc;
|
clone.DepthFunc = DepthFunc;
|
||||||
clone.DepthTesting = DepthTesting;
|
clone.DepthTesting = DepthTesting;
|
||||||
|
clone.DepthWriting = DepthWriting;
|
||||||
clone.FaceCulling = FaceCulling;
|
clone.FaceCulling = FaceCulling;
|
||||||
clone.FaceCullingMode = FaceCullingMode;
|
clone.FaceCullingMode = FaceCullingMode;
|
||||||
clone.LineWidth = LineWidth;
|
clone.LineWidth = LineWidth;
|
||||||
|
|
Reference in a new issue