Ejemplo n.º 1
0
        public DepthStencilStateDesc(DepthStencilStateTypes type)
        {
            try
            {
                bool enable = false;
                REIGN_D3D11_DEPTH_WRITE_MASK mask = REIGN_D3D11_DEPTH_WRITE_MASK.ZERO;
                REIGN_D3D11_COMPARISON_FUNC  func = REIGN_D3D11_COMPARISON_FUNC.ALWAYS;
                switch (type)
                {
                case DepthStencilStateTypes.None:
                    enable = false;
                    mask   = REIGN_D3D11_DEPTH_WRITE_MASK.ZERO;
                    func   = REIGN_D3D11_COMPARISON_FUNC.ALWAYS;
                    break;

                case DepthStencilStateTypes.ReadWrite_Less:
                    enable = true;
                    mask   = REIGN_D3D11_DEPTH_WRITE_MASK.ALL;
                    func   = REIGN_D3D11_COMPARISON_FUNC.LESS;
                    break;

                default:
                    Debug.ThrowError("DepthStencilStateDesc", "Unsuported DepthStencilStateType");
                    break;
                }

                com = new DepthStencilStateDescCom(enable, mask, func);
            }
            catch (Exception e)
            {
                Dispose();
                throw e;
            }
        }
Ejemplo n.º 2
0
        public static IDepthStencilStateDesc New(VideoTypes videoType, DepthStencilStateTypes type)
        {
            IDepthStencilStateDesc api = null;

            #if WIN32
            if (videoType == VideoTypes.D3D9) api = new D3D9.DepthStencilStateDesc(type);
            #endif

            #if WIN32 || WINRT || WP8
            if (videoType == VideoTypes.D3D11) api = new D3D11.DepthStencilStateDesc(type);
            #endif

            #if WIN32 || OSX || LINUX || iOS || ANDROID || NaCl
            if (videoType == VideoTypes.OpenGL) api = new OpenGL.DepthStencilStateDesc(type);
            #endif

            #if XNA
            if (videoType == VideoTypes.XNA) api = new XNA.DepthStencilStateDesc(type);
            #endif

            #if VITA
            if (videoType == VideoTypes.Vita) api = new Vita.DepthStencilStateDesc(type);
            #endif

            if (api == null) Debug.ThrowError("DepthStencilStateDescAPI", "Unsuported InputType: " + videoType);
            return api;
        }
Ejemplo n.º 3
0
        public DepthStencilStateDesc(DepthStencilStateTypes type)
        {
            switch (type)
            {
                case DepthStencilStateTypes.None:
                    depthReadEnable = false;
                    depthWriteEnable = false;
                    depthFunc = GL.ALWAYS;

                    stencilEnable = false;
                    stencilFunc = GL.NEVER;
                    stencilFailOp = GL.KEEP;
                    stencilDepthFailOp = GL.KEEP;
                    stencilPassOp = GL.KEEP;
                    break;

                case DepthStencilStateTypes.ReadWrite_Less:
                    depthReadEnable = true;
                    depthWriteEnable = true;
                    depthFunc = GL.LESS;

                    stencilEnable = false;
                    stencilFunc = GL.NEVER;
                    stencilFailOp = GL.KEEP;
                    stencilDepthFailOp = GL.KEEP;
                    stencilPassOp = GL.KEEP;
                    break;

                default:
                    Debug.ThrowError("DepthStencilStateDesc", "Unsuported DepthStencilStateType");
                    break;
            }
        }
Ejemplo n.º 4
0
        public DepthStencilStateDesc(DepthStencilStateTypes type)
        {
            switch (type)
            {
                case DepthStencilStateTypes.None:
                    depthReadEnable = false;
                    depthWriteEnable = false;
                    depthFunc = X.CompareFunction.Less;

                    stencilEnable = false;
                    stencilFunc = X.CompareFunction.Never;
                    stencilFailOp = X.StencilOperation.Keep;
                    stencilDepthFailOp = X.StencilOperation.Keep;
                    stencilPassOp = X.StencilOperation.Keep;
                    break;

                case DepthStencilStateTypes.ReadWrite_Less:
                    depthReadEnable = true;
                    depthWriteEnable = true;
                    depthFunc = X.CompareFunction.Less;

                    stencilEnable = false;
                    stencilFunc = X.CompareFunction.Never;
                    stencilFailOp = X.StencilOperation.Keep;
                    stencilDepthFailOp = X.StencilOperation.Keep;
                    stencilPassOp = X.StencilOperation.Keep;
                    break;

                default:
                    Debug.ThrowError("DepthStencilStateDesc", "Unsuported DepthStencilStateType");
                    break;
            }
        }
Ejemplo n.º 5
0
        public DepthStencilStateDesc(DepthStencilStateTypes type)
        {
            switch (type)
            {
            case DepthStencilStateTypes.None:
                depthReadEnable  = false;
                depthWriteEnable = false;
                depthFunc        = X.CompareFunction.Less;

                stencilEnable      = false;
                stencilFunc        = X.CompareFunction.Never;
                stencilFailOp      = X.StencilOperation.Keep;
                stencilDepthFailOp = X.StencilOperation.Keep;
                stencilPassOp      = X.StencilOperation.Keep;
                break;

            case DepthStencilStateTypes.ReadWrite_Less:
                depthReadEnable  = true;
                depthWriteEnable = true;
                depthFunc        = X.CompareFunction.Less;

                stencilEnable      = false;
                stencilFunc        = X.CompareFunction.Never;
                stencilFailOp      = X.StencilOperation.Keep;
                stencilDepthFailOp = X.StencilOperation.Keep;
                stencilPassOp      = X.StencilOperation.Keep;
                break;

            default:
                Debug.ThrowError("DepthStencilStateDesc", "Unsuported DepthStencilStateType");
                break;
            }
        }
Ejemplo n.º 6
0
        public DepthStencilStateDesc(DepthStencilStateTypes type)
        {
            switch (type)
            {
            case DepthStencilStateTypes.None:
                depthReadEnable  = false;
                depthWriteEnable = false;
                depthFunc        = GL.ALWAYS;

                stencilEnable      = false;
                stencilFunc        = GL.NEVER;
                stencilFailOp      = GL.KEEP;
                stencilDepthFailOp = GL.KEEP;
                stencilPassOp      = GL.KEEP;
                break;

            case DepthStencilStateTypes.ReadWrite_Less:
                depthReadEnable  = true;
                depthWriteEnable = true;
                depthFunc        = GL.LESS;

                stencilEnable      = false;
                stencilFunc        = GL.NEVER;
                stencilFailOp      = GL.KEEP;
                stencilDepthFailOp = GL.KEEP;
                stencilPassOp      = GL.KEEP;
                break;

            default:
                Debug.ThrowError("DepthStencilStateDesc", "Unsuported DepthStencilStateType");
                break;
            }
        }
Ejemplo n.º 7
0
        public static IDepthStencilStateDesc New(VideoTypes videoType, DepthStencilStateTypes type)
        {
            IDepthStencilStateDesc api = null;

                        #if WIN32
            if (videoType == VideoTypes.D3D9)
            {
                api = new D3D9.DepthStencilStateDesc(type);
            }
                        #endif

                        #if WIN32 || WINRT || WP8
            if (videoType == VideoTypes.D3D11)
            {
                api = new D3D11.DepthStencilStateDesc(type);
            }
                        #endif

                        #if WIN32 || OSX || LINUX || iOS || ANDROID || NaCl
            if (videoType == VideoTypes.OpenGL)
            {
                api = new OpenGL.DepthStencilStateDesc(type);
            }
                        #endif

                        #if XNA
            if (videoType == VideoTypes.XNA)
            {
                api = new XNA.DepthStencilStateDesc(type);
            }
                        #endif

                        #if VITA
            if (videoType == VideoTypes.Vita)
            {
                api = new Vita.DepthStencilStateDesc(type);
            }
                        #endif

            if (api == null)
            {
                Debug.ThrowError("DepthStencilStateDescAPI", "Unsuported InputType: " + videoType);
            }
            return(api);
        }
Ejemplo n.º 8
0
        public DepthStencilStateDesc(DepthStencilStateTypes type)
        {
            REIGN_D3DZBUFFERTYPE depthReadEnable = REIGN_D3DZBUFFERTYPE._FALSE;
            bool               depthWriteEnable = false;
            REIGN_D3DCMPFUNC   depthFunc = REIGN_D3DCMPFUNC.ALWAYS;
            bool               stencilEnable = false;
            REIGN_D3DCMPFUNC   stencilFunc = REIGN_D3DCMPFUNC.ALWAYS;
            REIGN_D3DSTENCILOP stencilFailOp = REIGN_D3DSTENCILOP.DECR, stencilDepthFailOp = REIGN_D3DSTENCILOP.DECR, stencilPassOp = REIGN_D3DSTENCILOP.DECR;

            switch (type)
            {
            case DepthStencilStateTypes.None:
                depthReadEnable  = REIGN_D3DZBUFFERTYPE._FALSE;
                depthWriteEnable = false;
                depthFunc        = REIGN_D3DCMPFUNC.LESS;

                stencilEnable      = false;
                stencilFunc        = REIGN_D3DCMPFUNC.NEVER;
                stencilFailOp      = REIGN_D3DSTENCILOP.KEEP;
                stencilDepthFailOp = REIGN_D3DSTENCILOP.KEEP;
                stencilPassOp      = REIGN_D3DSTENCILOP.KEEP;
                break;

            case DepthStencilStateTypes.ReadWrite_Less:
                depthReadEnable  = REIGN_D3DZBUFFERTYPE._TRUE;
                depthWriteEnable = true;
                depthFunc        = REIGN_D3DCMPFUNC.LESS;

                stencilEnable      = false;
                stencilFunc        = REIGN_D3DCMPFUNC.NEVER;
                stencilFailOp      = REIGN_D3DSTENCILOP.KEEP;
                stencilDepthFailOp = REIGN_D3DSTENCILOP.KEEP;
                stencilPassOp      = REIGN_D3DSTENCILOP.KEEP;
                break;

            default:
                Debug.ThrowError("DepthStencilStateDesc", "Unsuported DepthStencilStateType");
                break;
            }

            com = new DepthStencilStateDescCom(depthReadEnable, depthWriteEnable, depthFunc, stencilEnable, stencilFunc, stencilFailOp, stencilDepthFailOp, stencilPassOp);
        }
Ejemplo n.º 9
0
        public DepthStencilStateDesc(DepthStencilStateTypes type)
        {
            REIGN_D3DZBUFFERTYPE depthReadEnable = REIGN_D3DZBUFFERTYPE._FALSE;
            bool depthWriteEnable = false;
            REIGN_D3DCMPFUNC depthFunc = REIGN_D3DCMPFUNC.ALWAYS;
            bool stencilEnable = false;
            REIGN_D3DCMPFUNC stencilFunc = REIGN_D3DCMPFUNC.ALWAYS;
            REIGN_D3DSTENCILOP stencilFailOp = REIGN_D3DSTENCILOP.DECR, stencilDepthFailOp = REIGN_D3DSTENCILOP.DECR, stencilPassOp = REIGN_D3DSTENCILOP.DECR;

            switch (type)
            {
                case DepthStencilStateTypes.None:
                    depthReadEnable = REIGN_D3DZBUFFERTYPE._FALSE;
                    depthWriteEnable = false;
                    depthFunc = REIGN_D3DCMPFUNC.LESS;

                    stencilEnable = false;
                    stencilFunc = REIGN_D3DCMPFUNC.NEVER;
                    stencilFailOp = REIGN_D3DSTENCILOP.KEEP;
                    stencilDepthFailOp = REIGN_D3DSTENCILOP.KEEP;
                    stencilPassOp = REIGN_D3DSTENCILOP.KEEP;
                    break;

                case DepthStencilStateTypes.ReadWrite_Less:
                    depthReadEnable = REIGN_D3DZBUFFERTYPE._TRUE;
                    depthWriteEnable = true;
                    depthFunc = REIGN_D3DCMPFUNC.LESS;

                    stencilEnable = false;
                    stencilFunc = REIGN_D3DCMPFUNC.NEVER;
                    stencilFailOp = REIGN_D3DSTENCILOP.KEEP;
                    stencilDepthFailOp = REIGN_D3DSTENCILOP.KEEP;
                    stencilPassOp = REIGN_D3DSTENCILOP.KEEP;
                    break;

                default:
                    Debug.ThrowError("DepthStencilStateDesc", "Unsuported DepthStencilStateType");
                    break;
            }

            com = new DepthStencilStateDescCom(depthReadEnable, depthWriteEnable, depthFunc, stencilEnable, stencilFunc, stencilFailOp, stencilDepthFailOp, stencilPassOp);
        }
Ejemplo n.º 10
0
 public static DepthStencilStateDesc New(DepthStencilStateTypes type)
 {
     return new DepthStencilStateDesc(type);
 }
Ejemplo n.º 11
0
 public static DepthStencilStateDesc New(DepthStencilStateTypes type)
 {
     return(new DepthStencilStateDesc(type));
 }