• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# DepthStencilView类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DepthStencilView的典型用法代码示例。如果您正苦于以下问题:C# DepthStencilView类的具体用法?C# DepthStencilView怎么用?C# DepthStencilView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DepthStencilView类属于命名空间,在下文中一共展示了DepthStencilView类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: D3DApp

        protected D3DApp(IntPtr hInstance)
        {
            AppInst = hInstance;
            MainWindowCaption = "D3D11 Application";
            DriverType = DriverType.Hardware;
            ClientWidth = 800;
            ClientHeight = 600;
            Enable4XMsaa = false;
            Window = null;
            AppPaused = false;
            Minimized = false;
            Maximized = false;
            Resizing = false;
            Msaa4XQuality = 0;
            Device = null;
            ImmediateContext = null;
            SwapChain = null;
            DepthStencilBuffer = null;
            RenderTargetView = null;
            DepthStencilView = null;
            Viewport = new Viewport();
            Timer = new GameTimer();

            GD3DApp = this;
        }
开发者ID:remy22,项目名称:dx11,代码行数:25,代码来源:D3DApp.cs


示例2: DX11CubeDepthStencil

        public DX11CubeDepthStencil(DX11RenderContext context, int size, SampleDescription sd, Format format)
        {
            this.context = context;

            var texBufferDesc = new Texture2DDescription
            {
                ArraySize = 6,
                BindFlags = BindFlags.DepthStencil | BindFlags.ShaderResource,
                CpuAccessFlags = CpuAccessFlags.None,
                Format = DepthFormatsHelper.GetGenericTextureFormat(format),
                Height = size,
                Width = size,
                OptionFlags = ResourceOptionFlags.TextureCube,
                SampleDescription = sd,
                Usage = ResourceUsage.Default,
                MipLevels = 1
            };

            this.Resource = new Texture2D(context.Device, texBufferDesc);

            this.desc = texBufferDesc;

            //Create faces SRV/RTV
            this.SliceDSV = new DX11SliceDepthStencil[6];

            ShaderResourceViewDescription svd = new ShaderResourceViewDescription()
            {
                Dimension = ShaderResourceViewDimension.TextureCube,
                Format = DepthFormatsHelper.GetSRVFormat(format),
                MipLevels = 1,
                MostDetailedMip = 0,
                First2DArrayFace = 0
            };

            DepthStencilViewDescription dsvd = new DepthStencilViewDescription()
            {
                ArraySize= 6,
                Dimension = DepthStencilViewDimension.Texture2DArray,
                FirstArraySlice = 0,
                Format = DepthFormatsHelper.GetDepthFormat(format),
                MipSlice = 0
            };

            this.DSV = new DepthStencilView(context.Device, this.Resource, dsvd);

            if (context.IsFeatureLevel11)
            {
                dsvd.Flags = DepthStencilViewFlags.ReadOnlyDepth;
                if (format == Format.D24_UNorm_S8_UInt) { dsvd.Flags |= DepthStencilViewFlags.ReadOnlyStencil; }

                this.ReadOnlyDSV = new DepthStencilView(context.Device, this.Resource, dsvd);
            }

            this.SRV = new ShaderResourceView(context.Device, this.Resource, svd);

            for (int i = 0; i < 6; i++)
            {
                this.SliceDSV[i] = new DX11SliceDepthStencil(context, this, i, DepthFormatsHelper.GetDepthFormat(format));
            }
        }
开发者ID:arturoc,项目名称:FeralTic,代码行数:60,代码来源:DX11CubeDepthStencil.cs


示例3: DepthStencilTarget

        private DepthStencilTarget( int width, int height, Texture2D texture )
        {
            Width = width;
            Height = height;

            Texture = texture;

            var wrapper = D3D10Wrapper.Instance;
            DepthStencilView = new DepthStencilView( wrapper.Device, texture );
        }
开发者ID:jiawen,项目名称:libcgt.net,代码行数:10,代码来源:DepthStencilTarget.cs


示例4: Initialize

        public void Initialize(DeviceContextHolder holder) {
            const Format format = Format.R16G16B16A16_Float;

            using (var cubeTex = new Texture2D(holder.Device, new Texture2DDescription {
                Width = _cubeMapSize,
                Height = _cubeMapSize,
                MipLevels = 2,
                ArraySize = 6,
                SampleDescription = new SampleDescription(1, 0),
                Format = format,
                Usage = ResourceUsage.Default,
                BindFlags = BindFlags.ShaderResource | BindFlags.RenderTarget,
                CpuAccessFlags = CpuAccessFlags.None,
                OptionFlags = ResourceOptionFlags.GenerateMipMaps | ResourceOptionFlags.TextureCube
            })) {
                _targetView = Enumerable.Range(0, 6).Select(x => new RenderTargetView(holder.Device, cubeTex,
                    new RenderTargetViewDescription {
                        Format = format,
                        Dimension =
                            RenderTargetViewDimension
                        .Texture2DArray,
                        ArraySize = 1,
                        FirstArraySlice = x,
                        MipSlice = 0
                    })).ToArray();

                _view = new ShaderResourceView(holder.Device, cubeTex, new ShaderResourceViewDescription {
                    Format = format,
                    Dimension = ShaderResourceViewDimension.TextureCube,
                    MostDetailedMip = 0,
                    MipLevels = -1
                });
            }

            const Format depthFormat = Format.D32_Float;
            using (var depthTex = new Texture2D(holder.Device, new Texture2DDescription {
                Width = _cubeMapSize,
                Height = _cubeMapSize,
                MipLevels = 1,
                ArraySize = 1,
                SampleDescription = new SampleDescription(1, 0),
                Format = depthFormat,
                Usage = ResourceUsage.Default,
                BindFlags = BindFlags.DepthStencil,
                CpuAccessFlags = CpuAccessFlags.None,
                OptionFlags = ResourceOptionFlags.None
            })) {
                _depthTargetView = new DepthStencilView(holder.Device, depthTex, new DepthStencilViewDescription {
                    Format = depthFormat,
                    Flags = DepthStencilViewFlags.None,
                    Dimension = DepthStencilViewDimension.Texture2D,
                    MipSlice = 0,
                });
            }
        }
开发者ID:gro-ove,项目名称:actools,代码行数:55,代码来源:ReflectionCubemap.cs


示例5: Render

        public void Render( DeviceContext deviceContext, Viewport viewport, RenderTargetView renderTargetView, DepthStencilView depthStencilView )
        {
            deviceContext.ClearRenderTargetView( renderTargetView, Constants.CLEAR_COLOR );
            deviceContext.ClearDepthStencilView( depthStencilView, DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, 1.0f, 0x00 );

            //mTinyTextContext.Print( viewport, "Frame Time: " + FrameTimeString, 10, 10 );
            //mTinyTextContext.Render();

            mStopwatch.Reset();
            mStopwatch.Start();
        }
开发者ID:Rhoana,项目名称:Mojo,代码行数:11,代码来源:NullRenderingStrategy.cs


示例6: CreateDepthStencilViews

 private void CreateDepthStencilViews()
 {
     var depthStencilViewDesc = new DepthStencilViewDescription();
     depthStencilViewDesc.Format = Format.D32_Float;
     depthStencilViewDesc.Dimension = DepthStencilViewDimension.Texture2DArray;
     depthStencilViewDesc.ArraySize = 1;
     depthStencilViewDesc.MipSlice = 0;
     for (int i = 0; i < deferredShadingConfiguration.LayerCount; ++i)
     {
         depthStencilViewDesc.FirstArraySlice = i;
         var depthStencilView = new DepthStencilView(device, texture, depthStencilViewDesc);
         depthStencilViews.Add(depthStencilView);
     }
 }
开发者ID:TheProjecter,项目名称:romantiquex,代码行数:14,代码来源:DepthStencilBufferArrayHolder.cs


示例7: Resize

        public override void Resize(DeviceContextHolder holder, int width, int height) {
            base.Resize(holder, width, height);

            DepthView = new DepthStencilView(holder.Device, Texture, new DepthStencilViewDescription {
                Flags = DepthStencilViewFlags.None,
                Format = Format.D24_UNorm_S8_UInt,
                Dimension = DepthStencilViewDimension.Texture2D,
                MipSlice = 0
            });

            View = new ShaderResourceView(holder.Device, Texture, new ShaderResourceViewDescription {
                Format = Format.R24_UNorm_X8_Typeless,
                Dimension = ShaderResourceViewDimension.Texture2D,
                MipLevels = 1,
                MostDetailedMip = 0
            });
        }
开发者ID:gro-ove,项目名称:actools,代码行数:17,代码来源:TargetResourceDepthTexture.cs


示例8: ShadowMap

        public ShadowMap(Device device, int width, int height) {
            _width = width;
            _height = height;

            _viewport = new Viewport(0, 0, _width, _height, 0, 1.0f);

            var texDesc = new Texture2DDescription {
                Width = _width,
                Height = _height,
                MipLevels = 1,
                ArraySize = 1,
                Format = Format.R24G8_Typeless,
                SampleDescription = new SampleDescription(1, 0),
                Usage = ResourceUsage.Default,
                BindFlags = BindFlags.DepthStencil | BindFlags.ShaderResource ,
                CpuAccessFlags = CpuAccessFlags.None,
                OptionFlags = ResourceOptionFlags.None
            };

            var depthMap = new Texture2D(device, texDesc);
            depthMap.DebugName = "shadowmap depthmap";
            var dsvDesc = new DepthStencilViewDescription {
                Flags = DepthStencilViewFlags.None,
                Format = Format.D24_UNorm_S8_UInt,
                Dimension = DepthStencilViewDimension.Texture2D,
                MipSlice = 0
            };
            _depthMapDSV = new DepthStencilView(device, depthMap, dsvDesc);

            var srvDesc = new ShaderResourceViewDescription {
                Format = Format.R24_UNorm_X8_Typeless,
                Dimension = ShaderResourceViewDimension.Texture2D,
                MipLevels = texDesc.MipLevels,
                MostDetailedMip = 0

            };

            DepthMapSRV = new ShaderResourceView(device, depthMap, srvDesc);

            Util.ReleaseCom(ref depthMap);

        }
开发者ID:amitprakash07,项目名称:dx11,代码行数:42,代码来源:ShadowMap.cs


示例9: TextureObject

        // Functions
        public TextureObject()
        {
            m_Width = m_Height = 1;
            m_Mips = 1;
            m_Depth = 1;
            m_ArraySize = 1;
            m_IsCube = false;
            m_TexFormat = Format.Unknown;
            m_TextureObject2D = null;
            m_TextureObject3D = null;
            m_RenderTargetView = null;
            m_ShaderResourceView = null;
            m_DepthStencilView = null;
            m_UnorderedAccessView = null;

            m_ArrayRenderTargetViews = null;
            m_ArrayShaderResourceViews = null;
            m_ArrayDepthStencilViews = null;
            m_ArrayUnorderedAccessViews = null;
        }
开发者ID:wzpsgit,项目名称:CSharpRenderer,代码行数:21,代码来源:TextureObject.cs


示例10: RenderToTextureCommand

        public RenderToTextureCommand(int width, int height, SceneManager sceneTree)
            : base(CommandType.Action)
        {
            SceneTree = sceneTree;
            RenderTextureDesc = new Texture2DDescription
            {
                ArraySize = 1,
                BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
                CpuAccessFlags = CpuAccessFlags.None,
                Format = Format.R8G8B8A8_UNorm,
                Width = width,
                Height = height,
                MipLevels = 1,
                OptionFlags = ResourceOptionFlags.None,
                SampleDescription = new SampleDescription(1, 0),
                Usage = ResourceUsage.Default
            };

            texture = new Texture2D(Game.Context.Device, RenderTextureDesc);

            Texture2DDescription depthBufferDesc = new Texture2DDescription
            {
                ArraySize = 1,
                BindFlags = BindFlags.DepthStencil,
                CpuAccessFlags = CpuAccessFlags.None,
                Format = Format.D32_Float,
                Width = width,
                Height = height,
                MipLevels = 1,
                OptionFlags = ResourceOptionFlags.None,
                SampleDescription = new SampleDescription(1, 0),
                Usage = ResourceUsage.Default
            };

            using (Texture2D depthBuffer = new Texture2D(Game.Context.Device, depthBufferDesc))
            {
                DepthStencilView = new DepthStencilView(Game.Context.Device, depthBuffer);
            }

            RenderTargetView = new RenderTargetView(Game.Context.Device, texture);
        }
开发者ID:yong-ja,项目名称:starodyssey,代码行数:41,代码来源:RenderToTextureCommand.cs


示例11: SetDefaultColorTargets

        /// <summary>
        /// Sets the default render-targets
        /// </summary>
        public void SetDefaultColorTargets(DepthStencilView dsv)
        {
            this.targetWidth = this.colorBuffer.Description.Width;
            this.targetHeight = this.colorBuffer.Description.Height;

            this.device.ImmediateContext.OutputMerger.SetTargets(dsv, this.colorBufferView);
            this.device.ImmediateContext.Rasterizer.SetViewport(0, 0, this.colorBuffer.Description.Width, this.colorBuffer.Description.Height, 0.0f, 1.0f);

            this.device.ImmediateContext.ClearRenderTargetView(this.colorBufferView, this.ClearColor);
            this.device.ImmediateContext.ClearDepthStencilView(this.depthStencilBufferView, DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, 1.0f, 0);
        }
开发者ID:johnsonlu,项目名称:helix-toolkit,代码行数:14,代码来源:DPFCanvas.cs


示例12: CreateAndBindTargets

        /// <summary>
        /// 
        /// </summary>
        private void CreateAndBindTargets()
        {
            this.surfaceD3D.SetRenderTargetDX11(null);

            int width = System.Math.Max((int)this.ActualWidth, 100);
            int height = System.Math.Max((int)this.ActualHeight, 100);

            Disposer.RemoveAndDispose(ref this.colorBufferView);
            Disposer.RemoveAndDispose(ref this.depthStencilBufferView);
            Disposer.RemoveAndDispose(ref this.colorBuffer);
            Disposer.RemoveAndDispose(ref this.depthStencilBuffer);
            #if MSAA
            Disposer.RemoveAndDispose(ref this.renderTargetNMS);

            // check 8,4,2,1
            int sampleCount = 8;
            int sampleQuality = 0;

            if (this.IsMSAAEnabled)
            {
                do
                {
                    sampleQuality = this.device.CheckMultisampleQualityLevels(Format.B8G8R8A8_UNorm, sampleCount) - 1;
                    if (sampleQuality > 0)
                    {
                        break;
                    }
                    else
                    {
                        sampleCount /= 2;
                    }

                    if (sampleCount == 1)
                    {
                        sampleQuality = 0;
                        break;
                    }
                }
                while (true);
            }
            else
            {
                sampleCount = 1;
                sampleQuality = 0;
            }

            var sampleDesc = new SampleDescription(sampleCount, sampleQuality);
            var optionFlags = ResourceOptionFlags.None;
            #else
            var sampleDesc = new SampleDescription(1, 0);
            var optionFlags = ResourceOptionFlags.Shared;
            #endif

            var colordesc = new Texture2DDescription
            {
                BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
                Format = Format.B8G8R8A8_UNorm,
                Width = width,
                Height = height,
                MipLevels = 1,
                SampleDescription = sampleDesc,
                Usage = ResourceUsage.Default,
                OptionFlags = optionFlags,
                CpuAccessFlags = CpuAccessFlags.None,
                ArraySize = 1
            };

            var depthdesc = new Texture2DDescription
            {
                BindFlags = BindFlags.DepthStencil,
                //Format = Format.D24_UNorm_S8_UInt,
                Format = Format.D32_Float_S8X24_UInt,
                Width = width,
                Height = height,
                MipLevels = 1,
                SampleDescription = sampleDesc,
                Usage = ResourceUsage.Default,
                OptionFlags = ResourceOptionFlags.None,
                CpuAccessFlags = CpuAccessFlags.None,
                ArraySize = 1,
            };

            this.colorBuffer = new Texture2D(this.device, colordesc);
            this.depthStencilBuffer = new Texture2D(this.device, depthdesc);

            this.colorBufferView = new RenderTargetView(this.device, this.colorBuffer);
            this.depthStencilBufferView = new DepthStencilView(this.device, this.depthStencilBuffer);

            #if MSAA
            var colordescNMS = new Texture2DDescription
            {
                BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
                Format = Format.B8G8R8A8_UNorm,
                Width = width,
                Height = height,
                MipLevels = 1,
                SampleDescription = new SampleDescription(1, 0),
//.........这里部分代码省略.........
开发者ID:johnsonlu,项目名称:helix-toolkit,代码行数:101,代码来源:DPFCanvas.cs


示例13: OnResize

        public virtual void OnResize()
        {
            Debug.Assert(ImmediateContext != null);
            Debug.Assert(Device != null);
            Debug.Assert(SwapChain != null);

            Util.ReleaseCom(ref RenderTargetView);
            Util.ReleaseCom(ref DepthStencilView);
            Util.ReleaseCom(ref DepthStencilBuffer);

            SwapChain.ResizeBuffers(1, ClientWidth, ClientHeight, Format.R8G8B8A8_UNorm, SwapChainFlags.None);
            using (var resource = SlimDX.Direct3D11.Resource.FromSwapChain<Texture2D>(SwapChain, 0)) {
                RenderTargetView = new RenderTargetView(Device, resource);
                RenderTargetView.Resource.DebugName = "main render target";
            }

            var depthStencilDesc = new Texture2DDescription {
                Width = ClientWidth,
                Height = ClientHeight,
                MipLevels = 1,
                ArraySize = 1,
                Format = Format.D24_UNorm_S8_UInt,
                SampleDescription = (Enable4XMsaa && Device.FeatureLevel >= FeatureLevel.Level_10_1) ? new SampleDescription(4, Msaa4XQuality - 1) : new SampleDescription(1, 0),
                Usage = ResourceUsage.Default,
                BindFlags = BindFlags.DepthStencil,
                CpuAccessFlags = CpuAccessFlags.None,
                OptionFlags = ResourceOptionFlags.None
            };
            DepthStencilBuffer = new Texture2D(Device, depthStencilDesc) { DebugName = "DepthStencilBuffer" };
            DepthStencilView = new DepthStencilView(Device, DepthStencilBuffer);

            ImmediateContext.OutputMerger.SetTargets(DepthStencilView, RenderTargetView);

            Viewport = new Viewport(0, 0, ClientWidth, ClientHeight, 0.0f, 1.0f);

            ImmediateContext.Rasterizer.SetViewports(Viewport);
        }
开发者ID:remy22,项目名称:dx11,代码行数:37,代码来源:D3DApp.cs


示例14: InitializeBuffers

 public void InitializeBuffers()
 {
     Helper.Dispose(ReadOnlyDepth, litBuffer, litTarget);
     DepthStencilViewDescription dsvDesc = Renderer.BackBufferDepth.Description;
     dsvDesc.Flags = DepthStencilViewFlags.ReadOnlyDepth;
     ReadOnlyDepth = new DepthStencilView(Renderer.Device, Renderer.OutputDepth, dsvDesc);
     Texture2DDescription litBufferDesc = Renderer.OutputTexture.Description;
     //TODO: This format
     litBufferDesc.Format = SlimDX.DXGI.Format.R11G11B10_Float;
     using (Texture2D tex = new Texture2D(Renderer.Device, litBufferDesc))
     {
         litTarget = new RenderTargetView(Renderer.Device, tex);
         litBuffer = new ShaderResourceView(Renderer.Device, tex, new ShaderResourceViewDescription()
         {
             Dimension = tex.Description.SampleDescription.Count > 1 ? ShaderResourceViewDimension.Texture2DMultisampled : ShaderResourceViewDimension.Texture2D,
             Format = tex.Description.Format,
             ArraySize = 1,
             MipLevels = 1,
             FirstArraySlice = 0,
             MostDetailedMip = 0
         });
     }
     GBuffer.Initialize();
 }
开发者ID:RomanHodulak,项目名称:DeferredLightingD3D11,代码行数:24,代码来源:DeferredQuadLighting.cs


示例15: InitializeDepthStencil

        private void InitializeDepthStencil(uint nWidth, uint nHeight)
        {
            // Create depth stencil texture
            Texture2DDescription descDepth = new Texture2DDescription()
                                                 {
                                                     Width = nWidth,
                                                     Height = nHeight,
                                                     MipLevels = 1,
                                                     ArraySize = 1,
                                                     Format = Format.D16_UNORM,
                                                     SampleDescription = new SampleDescription()
                                                                             {
                                                                                 Count = 1,
                                                                                 Quality = 0
                                                                             },
                                                     BindFlags = BindFlag.DepthStencil,
                                                 };
            depthStencil = device.CreateTexture2D(descDepth);

            // Create the depth stencil view
            DepthStencilViewDescription depthStencilViewDesc = new DepthStencilViewDescription()
                                                                   {
                                                                       Format = descDepth.Format,
                                                                       ViewDimension =
                                                                           DepthStencilViewDimension.
                                                                           Texture2D
                                                                   };
            depthStencilView = device.CreateDepthStencilView(depthStencil, depthStencilViewDesc);
        }
开发者ID:Prashant-Jonny,项目名称:phever,代码行数:29,代码来源:Window1.xaml.cs


示例16: CreateTargets

        private void CreateTargets()
        {
            using (Texture2D backBuffer = GetBackBuffer())
            {
                RenderTargetView = new RenderTargetView(device, backBuffer);
            }

            Texture2DDescription depthBufferDesc = new Texture2DDescription
                                                       {
                                                           ArraySize = 1,
                                                           BindFlags = BindFlags.DepthStencil,
                                                           CpuAccessFlags = CpuAccessFlags.None,
                                                           Format = Format.D32_Float,
                                                           Width = Settings.ScreenWidth,
                                                           Height = Settings.ScreenHeight,
                                                           MipLevels = 1,
                                                           OptionFlags = ResourceOptionFlags.None,
                                                           SampleDescription = Settings.SampleDescription,
                                                           Usage = ResourceUsage.Default
                                                       };

            using (Texture2D depthBuffer = new Texture2D(device, depthBufferDesc))
            {
                DepthStencilView = new DepthStencilView(device, depthBuffer);
            }
        }
开发者ID:yong-ja,项目名称:starodyssey,代码行数:26,代码来源:DeviceContext11.cs


示例17: InitD3D

        void InitD3D()
        {
            D3DDevice = new Device(DriverType.Hardware, DeviceCreationFlags.Debug | DeviceCreationFlags.BgraSupport, FeatureLevel.Level_10_0);

            Texture2DDescription colordesc = new Texture2DDescription();
            colordesc.BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource;
            colordesc.Format = Format.B8G8R8A8_UNorm;
            colordesc.Width = WindowWidth;
            colordesc.Height = WindowHeight;
            colordesc.MipLevels = 1;
            colordesc.SampleDescription = new SampleDescription(1, 0);
            colordesc.Usage = ResourceUsage.Default;
            colordesc.OptionFlags = ResourceOptionFlags.Shared;
            colordesc.CpuAccessFlags = CpuAccessFlags.None;
            colordesc.ArraySize = 1;

            Texture2DDescription depthdesc = new Texture2DDescription();
            depthdesc.BindFlags = BindFlags.DepthStencil;
            depthdesc.Format = Format.D32_Float_S8X24_UInt;
            depthdesc.Width = WindowWidth;
            depthdesc.Height = WindowHeight;
            depthdesc.MipLevels = 1;
            depthdesc.SampleDescription = new SampleDescription(1, 0);
            depthdesc.Usage = ResourceUsage.Default;
            depthdesc.OptionFlags = ResourceOptionFlags.None;
            depthdesc.CpuAccessFlags = CpuAccessFlags.None;
            depthdesc.ArraySize = 1;

            SharedTexture = new Texture2D(D3DDevice, colordesc);
            DepthTexture = new Texture2D(D3DDevice, depthdesc);
            SampleRenderView = new RenderTargetView(D3DDevice, SharedTexture);
            SampleDepthView = new DepthStencilView(D3DDevice, DepthTexture);
            SampleEffect = Effect.FromFile(D3DDevice, "MiniTri.fx", "fx_4_0");
            EffectTechnique technique = SampleEffect.GetTechniqueByIndex(0); ;
            EffectPass pass = technique.GetPassByIndex(0);
            SampleLayout = new InputLayout(D3DDevice, pass.Description.Signature, new[] {
                new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0),
                new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 16, 0) 
            });

            SampleStream = new DataStream(3 * 32, true, true);
            SampleStream.WriteRange(new[] {
                new Vector4(0.0f, 0.5f, 0.5f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f),
                new Vector4(0.5f, -0.5f, 0.5f, 1.0f), new Vector4(0.0f, 1.0f, 0.0f, 1.0f),
                new Vector4(-0.5f, -0.5f, 0.5f, 1.0f), new Vector4(0.0f, 0.0f, 1.0f, 1.0f)
            });
            SampleStream.Position = 0;

            SampleVertices = new Buffer(D3DDevice, SampleStream, new BufferDescription()
            {
                BindFlags = BindFlags.VertexBuffer,
                CpuAccessFlags = CpuAccessFlags.None,
                OptionFlags = ResourceOptionFlags.None,
                SizeInBytes = 3 * 32,
                Usage = ResourceUsage.Default
            });

            D3DDevice.Flush();
        }
开发者ID:zhandb,项目名称:slimdx,代码行数:59,代码来源:Scene.cs


示例18: CreateRenderTargets

        private void CreateRenderTargets()
        {
            Texture2D backBuffer = Texture2D.FromSwapChain<Texture2D>(SwapChain, 0);
            sceneView = new RenderTargetView(Device, backBuffer);

            Texture2DDescription depthBufferDesc = new Texture2DDescription
            {
                ArraySize = 1,
                BindFlags = BindFlags.DepthStencil | BindFlags.ShaderResource,
                CpuAccessFlags = CpuAccessFlags.None,
                Format = Format.R32_Typeless,
                Width = WindowWidth,
                Height = WindowHeight,
                MipLevels = 1,
                OptionFlags = ResourceOptionFlags.None,
                SampleDescription = new SampleDescription(1, 0),
                Usage = ResourceUsage.Default
            };
            Texture2D depthBuffer = new Texture2D(Device, depthBufferDesc);

            DepthStencilViewDescription depthStencilDesc = new DepthStencilViewDescription
            {
                ArraySize = 0,
                Format = Format.D32_Float,
                Dimension = DepthStencilViewDimension.Texture2D,
                MipSlice = 0,
                Flags = 0,
                FirstArraySlice = 0
            };
            depthView = new DepthStencilView(Device, depthBuffer, depthStencilDesc);
            ShaderResourceViewDescription depthResViewDesc = new ShaderResourceViewDescription
            {
                ArraySize = 0,
                Format = Format.R32_Float,
                Dimension = ShaderResourceViewDimension.Texture2D,
                MipLevels = 1,
                Flags = 0,
                FirstArraySlice = 0
            };
            depthResView = new ShaderResourceView(Device, depthBuffer, depthResViewDesc);

            Texture2DDescription densityBufferDesc = new Texture2DDescription
            {
                ArraySize = 1,
                BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
                CpuAccessFlags = CpuAccessFlags.None,
                Format = Format.R8G8B8A8_UNorm,
                Width = WindowWidth,
                Height = WindowHeight,
                MipLevels = 1,
                OptionFlags = ResourceOptionFlags.None,
                SampleDescription = new SampleDescription(1, 0),
                Usage = ResourceUsage.Default
            };
            Texture2D densityBuffer = new Texture2D(Device, densityBufferDesc);

            RenderTargetViewDescription densityViewDesc = new RenderTargetViewDescription
            {
                ArraySize = 0,
                Format = Format.R8G8B8A8_UNorm,
                Dimension = RenderTargetViewDimension.Texture2D,
                MipSlice = 0,
                FirstArraySlice = 0
            };
            densityView = new RenderTargetView(Device, densityBuffer, densityViewDesc);
            ShaderResourceViewDescription densityResViewDesc = new ShaderResourceViewDescription
            {
                ArraySize = 0,
                Format = Format.R8G8B8A8_UNorm,
                Dimension = ShaderResourceViewDimension.Texture2D,
                MipLevels = 1,
                Flags = 0,
                FirstArraySlice = 0
            };
            densityResView = new ShaderResourceView(Device, densityBuffer, densityResViewDesc);
        }
开发者ID:dkushner,项目名称:AblativeDX,代码行数:76,代码来源:PhysXFluid.cs


示例19: SetDepthStencilTarget

 public void SetDepthStencilTarget(string name)
 {
     DepthStencilView target = null;
     m_DSVList.TryGetValue(name, out target);
     m_CurrDepthStencil = target;
 }
开发者ID:aik6980,项目名称:GameFramework,代码行数:6,代码来源:Device3dD3d11.cs


示例20: InitializeBuffers

 public void InitializeBuffers()
 {
     Helper.Dispose(ReadOnlyDepth);
     DepthStencilViewDescription dsvDesc = Renderer.BackBufferDepth.Description;
     dsvDesc.Flags = DepthStencilViewFlags.ReadOnlyDepth;
     ReadOnlyDepth = new DepthStencilView(Renderer.Device, Renderer.OutputDepth, dsvDesc);
     GBuffer.Initialize();
 }
开发者ID:RomanHodulak,项目名称:DeferredLightingD3D11,代码行数:8,代码来源:DeferredLighting.cs



注:本文中的DepthStencilView类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Deque类代码示例发布时间:2022-05-24
下一篇:
C# DepthMetaData类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap