Пример #1
0
        public D3DSamplerState(
            Device device,
            SamplerAddressMode addressU,
            SamplerAddressMode addressV,
            SamplerAddressMode addressW,
            SamplerFilter filter,
            int maxAnisotropy,
            RgbaFloat borderColor,
            DepthComparison comparison,
            int minimumLod,
            int maximumLod,
            int lodBias)
        {
            SamplerStateDescription ssd = new SamplerStateDescription();

            ssd.AddressU           = D3DFormats.VeldridToD3DSamplerAddressMode(addressU);
            ssd.AddressV           = D3DFormats.VeldridToD3DSamplerAddressMode(addressV);
            ssd.AddressW           = D3DFormats.VeldridToD3DSamplerAddressMode(addressW);
            ssd.Filter             = D3DFormats.VeldridToD3DSamplerFilter(filter);
            ssd.MaximumAnisotropy  = maxAnisotropy;
            ssd.BorderColor        = new RawColor4(borderColor.R, borderColor.G, borderColor.B, borderColor.A);
            ssd.ComparisonFunction = D3DFormats.VeldridToD3DDepthComparison(comparison);
            ssd.MinimumLod         = minimumLod;
            ssd.MaximumLod         = maximumLod;
            ssd.MipLodBias         = lodBias;
            _d3dSamplerState       = new SharpDX.Direct3D11.SamplerState(device, ssd);
        }
        public D3DDepthStencilState(Device device, bool isDepthEnabled, DepthComparison comparison, bool isDepthWriteEnabled)
        {
            _device             = device;
            IsDepthEnabled      = isDepthEnabled;
            IsDepthWriteEnabled = isDepthWriteEnabled;
            DepthComparison     = comparison;

            DepthStencilStateDescription desc = DepthStencilStateDescription.Default();

            desc.DepthComparison = D3DFormats.VeldridToD3DDepthComparison(comparison);
            desc.IsDepthEnabled  = isDepthEnabled;
            desc.DepthWriteMask  = isDepthWriteEnabled ? DepthWriteMask.All : DepthWriteMask.Zero;

            _deviceState = new SharpDX.Direct3D11.DepthStencilState(device, desc);
        }