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; } }
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 stencil test operation</summary> /// <param name="fail">Stencil failure mode of the stencil test operation</param> /// <param name="zFail">Depth failure mode of the stencil test operation</param> /// <param name="zPass">Depth passing mode of the stencil test operation</param> public void Set(StencilOpMode fail, StencilOpMode zFail, StencilOpMode zPass) { this.bits = (uint)((uint)fail | (uint)zFail << 8 | (uint)zPass << 16); }
/// <summary>Sets the stencil test operation (for the back surface)</summary> /// <param name="fail">Stencil failure mode of the stencil test operation</param> /// <param name="zFail">Depth failure mode of the stencil test operation</param> /// <param name="zPass">Depth passing mode of the stencil test operation</param> public void SetStencilOpBack(StencilOpMode fail, StencilOpMode zFail, StencilOpMode zPass) { this.SetStencilOpBack(new StencilOp(fail, zFail, zPass)); }