public DepthStencilStateDesc(DepthStencilStateTypes type) { switch (type) { case DepthStencilStateTypes.None: depthReadEnable = false; depthWriteEnable = false; depthFunc = DepthFuncMode.Less; stencilEnable = false; stencilFunc = StencilFuncMode.Never; stencilFailOp = StencilOpMode.Keep; stencilDepthFailOp = StencilOpMode.Keep; stencilPassOp = StencilOpMode.Keep; break; case DepthStencilStateTypes.ReadWrite_Less: depthReadEnable = true; depthWriteEnable = true; depthFunc = DepthFuncMode.Less; stencilEnable = false; stencilFunc = StencilFuncMode.Never; stencilFailOp = StencilOpMode.Keep; stencilDepthFailOp = StencilOpMode.Keep; stencilPassOp = StencilOpMode.Keep; break; default: Debug.ThrowError("DepthStencilStateDesc", "Unsuported DepthStencilStateType"); break; } }
/// <summary>Sets a value to the structure representing the depth test function</summary> /// <param name="mode">Depth test function mode</param> /// <param name="writeMask">Depth test function write mask</param> public void Set(DepthFuncMode mode, bool writeMask) { bits = ((uint)mode | (uint)(writeMask ? 256 : 0)); }
/// <summary>Creates the structure representing the depth test function</summary> /// <param name="mode">Depth test function mode</param> /// <param name="writeMask">Depth test function write mask</param> public DepthFunc(DepthFuncMode mode, bool writeMask) { this.bits = ((uint)mode | (uint)(writeMask ? 256 : 0)); }
/// <summary>Sets the depth test function</summary> /// <param name="mode">Depth test function mode</param> /// <param name="writeMask">Depth test function write mask</param> public void SetDepthFunc(DepthFuncMode mode, bool writeMask) { this.SetDepthFunc(new DepthFunc(mode, writeMask)); }