finished clear functions in GraphicsDeviceWindowsDX10

This commit is contained in:
Glatzemann 2011-11-10 15:22:44 +00:00
parent feb4114a4c
commit 705edf47e1

View File

@ -99,6 +99,7 @@ namespace ANX.Framework.Windows.DX10
private Device device; private Device device;
private SwapChain swapChain; private SwapChain swapChain;
private RenderTargetView renderView; private RenderTargetView renderView;
private DepthStencilView depthStencilView;
private SharpDX.Direct3D10.Texture2D backBuffer; private SharpDX.Direct3D10.Texture2D backBuffer;
internal Effect_DX10 currentEffect; internal Effect_DX10 currentEffect;
private VertexBuffer currentVertexBuffer; private VertexBuffer currentVertexBuffer;
@ -154,8 +155,49 @@ namespace ANX.Framework.Windows.DX10
clearColor.Blue = color.B * ColorMultiplier; clearColor.Blue = color.B * ColorMultiplier;
clearColor.Alpha = color.A * ColorMultiplier; clearColor.Alpha = color.A * ColorMultiplier;
} }
device.ClearRenderTargetView(renderView, clearColor);
this.device.ClearRenderTargetView(this.renderView, this.clearColor);
} }
public void Clear(ClearOptions options, Vector4 color, float depth, int stencil)
{
if ((options & ClearOptions.Target) == ClearOptions.Target)
{
// Clear a RenderTarget (or BackBuffer)
this.clearColor.Red = color.X;
this.clearColor.Green = color.Y;
this.clearColor.Blue = color.Z;
this.clearColor.Alpha = color.W;
this.device.ClearRenderTargetView(this.renderView, this.clearColor);
}
if (this.depthStencilView != null)
{
if ((options | ClearOptions.Stencil | ClearOptions.DepthBuffer) == options)
{
// Clear the stencil buffer
device.ClearDepthStencilView(this.depthStencilView, DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, depth, (byte)stencil);
}
else if ((options | ClearOptions.Stencil) == options)
{
device.ClearDepthStencilView(this.depthStencilView, DepthStencilClearFlags.Stencil, depth, (byte)stencil);
}
else
{
device.ClearDepthStencilView(this.depthStencilView, DepthStencilClearFlags.Depth, depth, (byte)stencil);
}
}
if ((options & ClearOptions.Target) == ClearOptions.Target)
{
// Clear a RenderTarget
throw new NotImplementedException();
}
}
#endregion #endregion
public void Present() public void Present()
@ -377,12 +419,6 @@ namespace ANX.Framework.Windows.DX10
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void Clear(ClearOptions options, Vector4 color, float depth, int stencil)
{
throw new NotImplementedException();
}
public void DrawInstancedPrimitives(PrimitiveType primitiveType, int baseVertex, int minVertexIndex, int numVertices, int startIndex, int primitiveCount, int instanceCount) public void DrawInstancedPrimitives(PrimitiveType primitiveType, int baseVertex, int minVertexIndex, int numVertices, int startIndex, int primitiveCount, int instanceCount)
{ {
throw new NotImplementedException(); throw new NotImplementedException();