Пример #1
0
 private DepthStencilOperationDescription ToD3D11StencilOpDesc(StencilBehaviorDescription sbd)
 {
     return(new DepthStencilOperationDescription
     {
         Comparison = D3D11Formats.VdToD3D11Comparison(sbd.Comparison),
         PassOperation = D3D11Formats.VdToD3D11StencilOperation(sbd.Pass),
         FailOperation = D3D11Formats.VdToD3D11StencilOperation(sbd.Fail),
         DepthFailOperation = D3D11Formats.VdToD3D11StencilOperation(sbd.DepthFail)
     });
 }
Пример #2
0
        private DepthStencilState CreateNewDepthStencilState(ref DepthStencilStateDescription description)
        {
            SharpDX.Direct3D11.DepthStencilStateDescription dssDesc = new SharpDX.Direct3D11.DepthStencilStateDescription
            {
                DepthComparison  = D3D11Formats.VdToD3D11Comparison(description.DepthComparison),
                IsDepthEnabled   = description.DepthTestEnabled,
                DepthWriteMask   = description.DepthWriteEnabled ? DepthWriteMask.All : DepthWriteMask.Zero,
                IsStencilEnabled = description.StencilTestEnabled,
                FrontFace        = ToD3D11StencilOpDesc(description.StencilFront),
                BackFace         = ToD3D11StencilOpDesc(description.StencilBack),
                StencilReadMask  = description.StencilReadMask,
                StencilWriteMask = description.StencilWriteMask
            };

            return(new DepthStencilState(_device, dssDesc));
        }
        public D3D11Sampler(Device device, ref SamplerDescription description)
        {
            Comparison comparision = description.ComparisonKind == null ? Comparison.Never : D3D11Formats.VdToD3D11Comparison(description.ComparisonKind.Value);
            SamplerStateDescription samplerStateDesc = new SamplerStateDescription
            {
                AddressU           = D3D11Formats.VdToD3D11AddressMode(description.AddressModeU),
                AddressV           = D3D11Formats.VdToD3D11AddressMode(description.AddressModeV),
                AddressW           = D3D11Formats.VdToD3D11AddressMode(description.AddressModeW),
                Filter             = D3D11Formats.ToD3D11Filter(description.Filter, description.ComparisonKind.HasValue),
                MinimumLod         = description.MinimumLod,
                MaximumLod         = description.MaximumLod,
                MaximumAnisotropy  = (int)description.MaximumAnisotropy,
                ComparisonFunction = comparision,
                MipLodBias         = description.LodBias,
                BorderColor        = ToRawColor4(description.BorderColor)
            };

            DeviceSampler = new SamplerState(device, samplerStateDesc);
        }