Exemplo n.º 1
0
        public RasterizerStateDesc(RasterizerStateTypes type)
        {
            REIGN_D3DFILLMODE fillMode = REIGN_D3DFILLMODE.POINT;
            REIGN_D3DCULL     cullMode = REIGN_D3DCULL.CCW;
            bool multisampleEnable     = false;

            switch (type)
            {
            case RasterizerStateTypes.Solid_CullNone:
                fillMode          = REIGN_D3DFILLMODE.SOLID;
                cullMode          = REIGN_D3DCULL.NONE;
                multisampleEnable = false;
                break;

            case RasterizerStateTypes.Solid_CullCW:
                fillMode          = REIGN_D3DFILLMODE.SOLID;
                cullMode          = REIGN_D3DCULL.CCW;
                multisampleEnable = false;
                break;

            case RasterizerStateTypes.Solid_CullCCW:
                fillMode          = REIGN_D3DFILLMODE.SOLID;
                cullMode          = REIGN_D3DCULL.CW;
                multisampleEnable = false;
                break;

            default:
                Debug.ThrowError("RasterizerStateDesc", "Unsuported RasterizerStateType");
                break;
            }

            com = new RasterizerStateDescCom(fillMode, cullMode, multisampleEnable);
        }
Exemplo n.º 2
0
 public void Dispose()
 {
     if (com != null)
     {
         com.Dispose();
         com = null;
     }
 }
Exemplo n.º 3
0
        public RasterizerStateDesc(RasterizerStateTypes type)
        {
            try
            {
                REIGN_D3D11_FILL_MODE fillMode = REIGN_D3D11_FILL_MODE.SOLID;
                REIGN_D3D11_CULL_NONE cullMode = REIGN_D3D11_CULL_NONE.NONE;
                bool  frontCounterClockwise = false, depthClipEnable = false, scissorEnable = false, multisampleEnable = false, antialiasedLineEnable = false;
                int   depthBias = 0;
                float depthBiasClamp = 0, slopeScaledDepthBias = 0;
                switch (type)
                {
                case RasterizerStateTypes.Solid_CullNone:
                    fillMode = REIGN_D3D11_FILL_MODE.SOLID;
                    cullMode = REIGN_D3D11_CULL_NONE.NONE;
                    frontCounterClockwise = false;
                    depthBias             = 0;
                    depthBiasClamp        = 0.0f;
                    slopeScaledDepthBias  = 0.0f;
                    depthClipEnable       = true;
                    scissorEnable         = false;
                    multisampleEnable     = false;
                    antialiasedLineEnable = false;
                    break;

                case RasterizerStateTypes.Solid_CullCW:
                    fillMode = REIGN_D3D11_FILL_MODE.SOLID;
                    cullMode = REIGN_D3D11_CULL_NONE.BACK;
                    frontCounterClockwise = false;
                    depthBias             = 0;
                    depthBiasClamp        = 0.0f;
                    slopeScaledDepthBias  = 0.0f;
                    depthClipEnable       = true;
                    scissorEnable         = false;
                    multisampleEnable     = false;
                    antialiasedLineEnable = false;
                    break;

                case RasterizerStateTypes.Solid_CullCCW:
                    fillMode = REIGN_D3D11_FILL_MODE.SOLID;
                    cullMode = REIGN_D3D11_CULL_NONE.FRONT;
                    frontCounterClockwise = false;
                    depthBias             = 0;
                    depthBiasClamp        = 0.0f;
                    slopeScaledDepthBias  = 0.0f;
                    depthClipEnable       = true;
                    scissorEnable         = false;
                    multisampleEnable     = false;
                    antialiasedLineEnable = false;
                    break;

                default:
                    Debug.ThrowError("RasterizerStateDesc", "Unsuported type: " + type.ToString());
                    break;
                }

                com = new RasterizerStateDescCom(fillMode, cullMode, frontCounterClockwise, depthBias, depthBiasClamp, slopeScaledDepthBias, depthClipEnable, scissorEnable, multisampleEnable, antialiasedLineEnable);
            }
            catch (Exception e)
            {
                Dispose();
                throw e;
            }
        }