Axiom.Core.SceneManager.SetShadowVolumeStencilState C# (CSharp) Method

SetShadowVolumeStencilState() protected method

Internal utility method for setting stencil state for rendering shadow volumes.
protected SetShadowVolumeStencilState ( bool secondPass, bool zfail, bool twoSided ) : void
secondPass bool Is this the second pass?
zfail bool Should we be using the zfail method?
twoSided bool Should we use a 2-sided stencil?
return void
		protected virtual void SetShadowVolumeStencilState( bool secondPass, bool zfail, bool twoSided )
		{
			// First pass, do front faces if zpass
			// Second pass, do back faces if zpass
			// Invert if zfail
			// this is to ensure we always increment before decrement
			if ( ( secondPass ^ zfail ) )
			{
				this.targetRenderSystem.CullingMode = twoSided ? CullingMode.None : CullingMode.CounterClockwise;
				this.targetRenderSystem.SetStencilBufferParams(
					CompareFunction.AlwaysPass,
					// always pass stencil check
					0,
					// no ref value (no compare)
					unchecked( (int)0xffffffff ),
					// no mask
					StencilOperation.Keep,
					// stencil test will never fail
					zfail
						? ( twoSided ? StencilOperation.IncrementWrap : StencilOperation.Increment )
						: StencilOperation.Keep,
					// back face depth fail
					zfail
						? StencilOperation.Keep
						: ( twoSided ? StencilOperation.DecrementWrap : StencilOperation.Decrement ),
					// back face pass
					twoSided );
			}
			else
			{
				this.targetRenderSystem.CullingMode = twoSided ? CullingMode.None : CullingMode.Clockwise;
				this.targetRenderSystem.SetStencilBufferParams(
					CompareFunction.AlwaysPass,
					// always pass stencil check
					0,
					// no ref value (no compare)
					unchecked( (int)0xffffffff ),
					// no mask
					StencilOperation.Keep,
					// stencil test will never fail
					zfail
						? ( twoSided ? StencilOperation.DecrementWrap : StencilOperation.Decrement )
						: StencilOperation.Keep,
					// front face depth fail
					zfail
						? StencilOperation.Keep
						: ( twoSided ? StencilOperation.IncrementWrap : StencilOperation.Increment ),
					// front face pass
					twoSided );
			}
		}
SceneManager