From d4d48ee21b6a45d57a90ae3ae2d56082005ebb35 Mon Sep 17 00:00:00 2001 From: Glatzemann Date: Tue, 29 Nov 2011 14:32:33 +0000 Subject: [PATCH] fixed issue #467 (DepthStencilState not settable) --- ANX.Framework/Graphics/DepthStencilState.cs | 22 ++++++++++++++----- .../GraphicsDeviceWindowsDX10.cs | 4 ++-- .../Properties/AssemblyInfo.cs | 4 ++-- Samples/StencilBuffer/Game1.cs | 4 ++-- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/ANX.Framework/Graphics/DepthStencilState.cs b/ANX.Framework/Graphics/DepthStencilState.cs index 0afcfa11..46013b81 100644 --- a/ANX.Framework/Graphics/DepthStencilState.cs +++ b/ANX.Framework/Graphics/DepthStencilState.cs @@ -85,19 +85,24 @@ namespace ANX.Framework.Graphics { nativeDepthStencilState = AddInSystemFactory.Instance.GetDefaultCreator().CreateDepthStencilState(); + // BackFace CounterClockwiseStencilDepthBufferFail = StencilOperation.Keep; CounterClockwiseStencilFail = StencilOperation.Keep; CounterClockwiseStencilFunction = CompareFunction.Always; CounterClockwiseStencilPass = StencilOperation.Keep; + + // FrontFace + StencilDepthBufferFail = StencilOperation.Keep; + StencilFail = StencilOperation.Keep; + StencilFunction = CompareFunction.Always; + StencilPass = StencilOperation.Keep; + DepthBufferEnable = true; DepthBufferFunction = CompareFunction.LessEqual; DepthBufferWriteEnable = true; ReferenceStencil = 0; - StencilDepthBufferFail = StencilOperation.Keep; StencilEnable = false; - StencilFunction = CompareFunction.Always; StencilMask = int.MaxValue; - StencilPass = StencilOperation.Keep; StencilWriteMask = int.MaxValue; TwoSidedStencilMode = false; } @@ -106,19 +111,24 @@ namespace ANX.Framework.Graphics { nativeDepthStencilState = AddInSystemFactory.Instance.GetDefaultCreator().CreateDepthStencilState(); + // BackFace CounterClockwiseStencilDepthBufferFail = StencilOperation.Keep; CounterClockwiseStencilFail = StencilOperation.Keep; CounterClockwiseStencilFunction = CompareFunction.Always; CounterClockwiseStencilPass = StencilOperation.Keep; + + // FrontFace + StencilDepthBufferFail = StencilOperation.Keep; + StencilFail = StencilOperation.Keep; + StencilFunction = CompareFunction.Always; + StencilPass = StencilOperation.Keep; + DepthBufferEnable = depthBufferEnabled; DepthBufferFunction = CompareFunction.LessEqual; DepthBufferWriteEnable = depthBufferWriteEnabled; ReferenceStencil = 0; - StencilDepthBufferFail = StencilOperation.Keep; StencilEnable = false; - StencilFunction = CompareFunction.Always; StencilMask = int.MaxValue; - StencilPass = StencilOperation.Keep; StencilWriteMask = int.MaxValue; TwoSidedStencilMode = false; diff --git a/RenderSystems/ANX.Framework.Windows.DX10/GraphicsDeviceWindowsDX10.cs b/RenderSystems/ANX.Framework.Windows.DX10/GraphicsDeviceWindowsDX10.cs index 41ea796a..553b99b0 100644 --- a/RenderSystems/ANX.Framework.Windows.DX10/GraphicsDeviceWindowsDX10.cs +++ b/RenderSystems/ANX.Framework.Windows.DX10/GraphicsDeviceWindowsDX10.cs @@ -299,7 +299,7 @@ namespace ANX.Framework.Windows.DX10 device.InputAssembler.PrimitiveTopology = FormatConverter.Translate(primitiveType); device.Rasterizer.SetViewports(currentViewport); - device.OutputMerger.SetTargets(this.renderView); + device.OutputMerger.SetTargets(this.depthStencilView, this.renderView); for (int i = 0; i < technique.Description.PassCount; ++i) { @@ -318,7 +318,7 @@ namespace ANX.Framework.Windows.DX10 // Prepare All the stages device.InputAssembler.PrimitiveTopology = FormatConverter.Translate(primitiveType); device.Rasterizer.SetViewports(currentViewport); - device.OutputMerger.SetTargets(this.renderView); + device.OutputMerger.SetTargets(this.depthStencilView, this.renderView); for (int i = 0; i < technique.Description.PassCount; ++i) { diff --git a/RenderSystems/ANX.Framework.Windows.DX10/Properties/AssemblyInfo.cs b/RenderSystems/ANX.Framework.Windows.DX10/Properties/AssemblyInfo.cs index 89ae6b6f..5243a779 100644 --- a/RenderSystems/ANX.Framework.Windows.DX10/Properties/AssemblyInfo.cs +++ b/RenderSystems/ANX.Framework.Windows.DX10/Properties/AssemblyInfo.cs @@ -32,7 +32,7 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.7.8.0")] -[assembly: AssemblyFileVersion("0.7.8.0")] +[assembly: AssemblyVersion("0.7.9.0")] +[assembly: AssemblyFileVersion("0.7.9.0")] [assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")] diff --git a/Samples/StencilBuffer/Game1.cs b/Samples/StencilBuffer/Game1.cs index c6d5818b..a5523fef 100644 --- a/Samples/StencilBuffer/Game1.cs +++ b/Samples/StencilBuffer/Game1.cs @@ -81,7 +81,7 @@ namespace StencilBuffer DepthBufferWriteEnable = true, DepthBufferFunction = CompareFunction.Always, ReferenceStencil = 2, - StencilEnable = false, + StencilEnable = true, StencilPass = StencilOperation.Increment, }; @@ -91,7 +91,7 @@ namespace StencilBuffer DepthBufferWriteEnable = true, DepthBufferFunction = CompareFunction.LessEqual, ReferenceStencil = 1, - StencilEnable = false, + StencilEnable = true, StencilPass = StencilOperation.Keep, };