Expose depth buffer to render code.

This commit is contained in:
Paul Chote
2013-02-22 23:29:34 +13:00
parent 9566385aac
commit 1b34c7d6b9
4 changed files with 32 additions and 0 deletions

View File

@@ -50,6 +50,9 @@ namespace OpenRA.FileFormats.Graphics
void SetLineWidth( float width ); void SetLineWidth( float width );
void EnableScissor( int left, int top, int width, int height ); void EnableScissor( int left, int top, int width, int height );
void DisableScissor(); void DisableScissor();
void EnableDepthBuffer();
void DisableDepthBuffer();
} }
public interface IVertexBuffer<T> public interface IVertexBuffer<T>

View File

@@ -186,5 +186,17 @@ namespace OpenRA.Graphics
Flush(); Flush();
Device.DisableScissor(); Device.DisableScissor();
} }
public void EnableDepthBuffer()
{
Flush();
Device.EnableDepthBuffer();
}
public void DisableDepthBuffer()
{
Flush();
Device.DisableDepthBuffer();
}
} }
} }

View File

@@ -38,6 +38,9 @@ namespace OpenRA.Renderer.Null
public void EnableScissor(int left, int top, int width, int height) { } public void EnableScissor(int left, int top, int width, int height) { }
public void DisableScissor() { } public void DisableScissor() { }
public void EnableDepthBuffer() { }
public void DisableDepthBuffer() { }
public void Clear() { } public void Clear() { }
public void Present() { } public void Present() { }

View File

@@ -133,6 +133,20 @@ namespace OpenRA.Renderer.SdlCommon
ErrorHandler.CheckGlError(); ErrorHandler.CheckGlError();
} }
public void EnableDepthBuffer()
{
Gl.glClear(Gl.GL_DEPTH_BUFFER_BIT);
ErrorHandler.CheckGlError();
Gl.glEnable(Gl.GL_DEPTH_TEST);
ErrorHandler.CheckGlError();
}
public void DisableDepthBuffer()
{
Gl.glDisable(Gl.GL_DEPTH_TEST);
ErrorHandler.CheckGlError();
}
public void EnableScissor(int left, int top, int width, int height) public void EnableScissor(int left, int top, int width, int height)
{ {
if (width < 0) width = 0; if (width < 0) width = 0;