Exemplo n.º 1
0
        public void SetRasterizerState(H1RasterizerDescription rasterizerDesc)
        {
            RasterizerStateDescription newRasterizerStateDesc = RasterizerStateDescription.Default();

            newRasterizerStateDesc.FillMode = H1RHIDefinitionHelper.ConvertToFillMode(rasterizerDesc.FillMode);
            newRasterizerStateDesc.CullMode = H1RHIDefinitionHelper.ConvertToCullMode(rasterizerDesc.CullMode);
            newRasterizerStateDesc.IsFrontCounterClockwise = rasterizerDesc.FrontCounterClockwise;
            newRasterizerStateDesc.DepthBias                = rasterizerDesc.DepthBias;
            newRasterizerStateDesc.DepthBiasClamp           = rasterizerDesc.DepthBiasClamp;
            newRasterizerStateDesc.SlopeScaledDepthBias     = rasterizerDesc.SlopeScaledDepthBias;
            newRasterizerStateDesc.IsDepthClipEnabled       = rasterizerDesc.DepthClipEnable;
            newRasterizerStateDesc.IsMultisampleEnabled     = rasterizerDesc.MultiSampleEnable;
            newRasterizerStateDesc.IsAntialiasedLineEnabled = rasterizerDesc.AntialiasedLineEnable;
            newRasterizerStateDesc.ForcedSampleCount        = rasterizerDesc.ForcedSampleCount;

            if (rasterizerDesc.ConservativeRasterMode == H1ConservativeRasterizationMode.On)
            {
                newRasterizerStateDesc.ConservativeRaster = ConservativeRasterizationMode.On;
            }
            else
            {
                newRasterizerStateDesc.ConservativeRaster = ConservativeRasterizationMode.Off;
            }

            // assign the newly created rasterizer state desc
            m_GraphicsPipelineStateDesc.RasterizerState = newRasterizerStateDesc;
        }