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;
            }
        }
Beispiel #3
0
 /// <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));
 }
Beispiel #4
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));
 }
Beispiel #5
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));
 }