Expose depth buffer to render code.
This commit is contained in:
@@ -50,6 +50,9 @@ namespace OpenRA.FileFormats.Graphics
|
||||
void SetLineWidth( float width );
|
||||
void EnableScissor( int left, int top, int width, int height );
|
||||
void DisableScissor();
|
||||
|
||||
void EnableDepthBuffer();
|
||||
void DisableDepthBuffer();
|
||||
}
|
||||
|
||||
public interface IVertexBuffer<T>
|
||||
|
||||
@@ -186,5 +186,17 @@ namespace OpenRA.Graphics
|
||||
Flush();
|
||||
Device.DisableScissor();
|
||||
}
|
||||
|
||||
public void EnableDepthBuffer()
|
||||
{
|
||||
Flush();
|
||||
Device.EnableDepthBuffer();
|
||||
}
|
||||
|
||||
public void DisableDepthBuffer()
|
||||
{
|
||||
Flush();
|
||||
Device.DisableDepthBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,9 @@ namespace OpenRA.Renderer.Null
|
||||
public void EnableScissor(int left, int top, int width, int height) { }
|
||||
public void DisableScissor() { }
|
||||
|
||||
public void EnableDepthBuffer() { }
|
||||
public void DisableDepthBuffer() { }
|
||||
|
||||
public void Clear() { }
|
||||
public void Present() { }
|
||||
|
||||
|
||||
@@ -133,6 +133,20 @@ namespace OpenRA.Renderer.SdlCommon
|
||||
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)
|
||||
{
|
||||
if (width < 0) width = 0;
|
||||
|
||||
Reference in New Issue
Block a user