コード例 #1
0
        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;
            }
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
ファイル: StencilFunc.cs プロジェクト: OpenPSS/PssIL
 /// <summary>Sets a value to the structure representing the stencil test function</summary>
 /// <param name="mode">Stencil test function mode</param>
 /// <param name="reference">Reference value (0-255) of the stencil test function</param>
 /// <param name="readMask">Read mask (0-255) of the stencil test function</param>
 /// <param name="writeMask">Write mask (0-255) of the stencil test function</param>
 public void Set(StencilFuncMode mode, int reference, int readMask, int writeMask)
 {
     this.bits = (uint)((int)mode | (int)((byte)reference) << 8 | (int)((byte)readMask) << 16 | (int)((byte)writeMask) << 24);
 }
コード例 #4
0
 /// <summary>Sets the stencil test function (for the back surface)</summary>
 /// <param name="mode">Stencil test function mode</param>
 /// <param name="reference">Reference value (0-255) of the stencil test function</param>
 /// <param name="readMask">Read mask (0-255) of the stencil test function</param>
 /// <param name="writeMask">Write mask (0-255) of the stencil test function</param>
 public void SetStencilFuncBack(StencilFuncMode mode, int reference, int readMask, int writeMask)
 {
     this.SetStencilFuncBack(new StencilFunc(mode, reference, readMask, writeMask));
 }