当前位置: 首页>>代码示例>>C#>>正文


C# DeviceContext.ClearRenderTargetView方法代码示例

本文整理汇总了C#中DeviceContext.ClearRenderTargetView方法的典型用法代码示例。如果您正苦于以下问题:C# DeviceContext.ClearRenderTargetView方法的具体用法?C# DeviceContext.ClearRenderTargetView怎么用?C# DeviceContext.ClearRenderTargetView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DeviceContext的用法示例。


在下文中一共展示了DeviceContext.ClearRenderTargetView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ClearRenderTarget

 public override void ClearRenderTarget(DeviceContext context, Color4 color)
 {
     foreach (RenderTargetView view in renderTargetView)
     {
         context.ClearRenderTargetView(view, color);
     }
 }
开发者ID:nickudell,项目名称:PigmentFramework,代码行数:7,代码来源:MultiRenderTexture.cs

示例2: Draw

        public override void Draw(Device device, DeviceContext context, RenderTargetView renderTargetView)
        {
            // We just clear the render target view
            context.ClearRenderTargetView(renderTargetView, Color.CornflowerBlue);

            // Ask the DrawingSurface to call us back
            host.RequestAdditionalFrame();
        }
开发者ID:Nezz,项目名称:SharpDX,代码行数:8,代码来源:SimpleRenderer.cs

示例3: Clear

        /// <summary>
        /// Clears the instance
        /// </summary>
        /// <param name="context"></param>
        public override void Clear(DeviceContext context)
        {
            base.Clear(context);

            if (RenderTargetClearSettings.IsClearRenderTarget)
            {
                context.ClearRenderTargetView(RenderTargetView, RenderTargetClearSettings.ClearColor);
            }
        }
开发者ID:ernstnaezer,项目名称:sandbox,代码行数:13,代码来源:RenderTarget2D.cs

示例4: 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

示例5: ClearRenderTarget

        public void ClearRenderTarget(DeviceContext context, DepthStencilView depthStencilView, float red, float green, float blue, float alpha)
        {
            // Setup the color the buffer to.
            var color = new Color4(red, green, blue, alpha);

            // Clear the back buffer.
            context.ClearRenderTargetView(RenderTargetView, color);

            // Clear the depth buffer.
            context.ClearDepthStencilView(depthStencilView, DepthStencilClearFlags.Depth, 1.0f, 0);
        }
开发者ID:nyx1220,项目名称:sharpdx-examples,代码行数:11,代码来源:RenderTexture.cs

示例6: Clear

        /// <summary>
        /// Clears the instance
        /// </summary>
        /// <param name="context"></param>
        public override void Clear(DeviceContext context)
        {
            base.Clear(context);

            if (!RenderTargetClearSettings.IsClearRenderTarget) return;

            Device11Mutex.Acquire(0, -1);
            {
                context.ClearRenderTargetView(RenderTargetView11, RenderTargetClearSettings.ClearColor);
            }
            Device11Mutex.Release(0);
        }
开发者ID:ernstnaezer,项目名称:sandbox,代码行数:16,代码来源:RenderTargetDirect2D.cs

示例7: Clear

        public void Clear(DeviceContext context, Color4 color, bool depth = false)
        {
            for (int i = 0; i < m_NumRTs; ++i)
            {
                context.ClearRenderTargetView(m_RenderTargets[i].m_RenderTargetView, color);
            }

            if (depth && m_DepthStencil.m_DepthStencilView != null)
            {
                context.ClearDepthStencilView(m_DepthStencil.m_DepthStencilView, DepthStencilClearFlags.Depth, 1.0f, 0);
            }
        }
开发者ID:shoff,项目名称:CSharpRenderer,代码行数:12,代码来源:RenderTargetSet.cs

示例8: Render

        public void Render(RenderTargetView renderTargetView, DeviceContext context, SurfacePass pass)
        {
            // TODO: generate sky envmap here, with custom params

            pass.Pass(context, @"
            struct PS_IN
            {
                float4 pos : SV_POSITION;
                float2 tex :    TEXCOORD;
            };

            float3 main(PS_IN input) : SV_Target
            {
                float phi = 2 * 3.14159265 * input.tex.x;
                float theta = 3.14159265 * input.tex.y;

                float3 p = float3(sin(theta) * cos(phi), cos(theta), sin(theta) * sin(phi));

                float brightness = 500;

                if (p.y < 0) return lerp(float3(1, 1, 1), float3(0, 0, 0), -p.y) * brightness;

                /* TEMPORARY */

                float sunBrightness = (dot(p, normalize(float3(-0.5f, 0.8f, 0.9f))) > 0.9995f) ? 1 : 0;

                return lerp(float3(1, 1, 1), float3(0.7f, 0.7f, 1), p.y) * brightness + sunBrightness * 50000;
            }
            ", skyEnvMap.Dimensions, skyEnvMap.RTV, null, null);

            context.OutputMerger.SetRenderTargets((RenderTargetView)null);

            context.ClearDepthStencilView(depthStencilView, DepthStencilClearFlags.Depth, 1.0f, 0);
            context.ClearRenderTargetView(renderTargetView, new Color4(0.5f, 0, 1, 1));

            context.Rasterizer.State = rasterizerState;
            context.OutputMerger.DepthStencilState = depthStencilState;
            context.OutputMerger.SetTargets(depthStencilView, renderTargetView);
            context.Rasterizer.SetViewports(new[] { new ViewportF(0, 0, RenderDimensions.Width, RenderDimensions.Height) });
            context.Rasterizer.SetScissorRectangles(new[] { new SharpDX.Rectangle(0, 0, RenderDimensions.Width, RenderDimensions.Height) });

            context.VertexShader.Set(vertexShader);
            context.InputAssembler.InputLayout = inputLayout;
            context.PixelShader.SetShaderResource(0, skyEnvMap.SRV);
            context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;

            {
                DataStream cameraStream;
                context.MapSubresource(cameraBuffer, MapMode.WriteDiscard, MapFlags.None, out cameraStream);
                camera.WriteTo(cameraStream);
                context.UnmapSubresource(cameraBuffer, 0);
                cameraStream.Dispose();
            }

            context.VertexShader.SetConstantBuffer(0, cameraBuffer);
            context.PixelShader.SetConstantBuffer(0, cameraBuffer);

            foreach (Model model in models.Values)
                model.Render(context, camera, materials, proxy);
        }
开发者ID:TomCrypto,项目名称:Insight,代码行数:60,代码来源:Scene.cs

示例9: RenderCubemap

        public static void RenderCubemap(DeviceContext context, TextureObject targetTexture, TextureObject targetDepth, SimpleSceneWrapper sceneWrapper, Vector3 position, float range, bool depthOnly = false, Color4 clearColor = new Color4())
        {
            //using (new GpuProfilePoint(context, "CubemapRendering"))
            {
                // some hardcoded near plane
                Matrix projectionMatrix = Matrix.PerspectiveFovLH((float)Math.PI / 2.0f, 1.0f, 0.05f, range);

                ContextHelper.SetDepthStencilState(context, ContextHelper.DepthConfigurationType.DepthCompare);

                // set the shaders
                context.VertexShader.Set(ShaderManager.GetVertexShader("VertexScene"));
                context.PixelShader.Set(depthOnly ? null : ShaderManager.GetPixelShader("PixelSceneSimple"));

                dynamic cvpb = m_CurrentViewportBuffer;

                for (int i = 0; i < 6; ++i)
                {
                    Vector3 lookAt = new Vector3();
                    Vector3 upVec = new Vector3();

                    switch (i)
                    {
                        case 0:
                            lookAt = new Vector3(1.0f, 0.0f, 0.0f);
                            upVec = new Vector3(0.0f, 1.0f, 0.0f);
                            break;
                        case 1:
                            lookAt = new Vector3(-1.0f, 0.0f, 0.0f);
                            upVec = new Vector3(0.0f, 1.0f, 0.0f);
                            break;
                        case 2:
                            lookAt = new Vector3(0.0f, 1.0f, 0.0f);
                            upVec = new Vector3(0.0f, 0.0f, -1.0f);
                            break;
                        case 3:
                            lookAt = new Vector3(0.0f, -1.0f, 0.0f);
                            upVec = new Vector3(0.0f, 0.0f, 1.0f);
                            break;
                        case 4:
                            lookAt = new Vector3(0.0f, 0.0f, 1.0f);
                            upVec = new Vector3(0.0f, 1.0f, 0.0f);
                            break;
                        case 5:
                            lookAt = new Vector3(0.0f, 0.0f, -1.0f);
                            upVec = new Vector3(0.0f, 1.0f, 0.0f);
                            break;
                    }

                    Matrix viewMatrix = Matrix.LookAtLH(position, position + lookAt, upVec);

                    cvpb.g_ProjMatrix = projectionMatrix;
                    cvpb.g_ViewMatrix = viewMatrix;
                    cvpb.g_ViewProjMatrix = viewMatrix * projectionMatrix;

                    {
                        context.ClearRenderTargetView(targetTexture.m_ArrayRenderTargetViews[i], clearColor);
                        context.ClearDepthStencilView(targetDepth.m_ArrayDepthStencilViews[i], DepthStencilClearFlags.Depth, 1.0f, 0);

                        RenderTargetSet.BindTextureAsRenderTarget(context, targetTexture.m_ArrayRenderTargetViews[i], targetDepth.m_ArrayDepthStencilViews[i], targetTexture.m_Width, targetTexture.m_Height);

                        m_CurrentViewportBuffer.CompileAndBind(context);

                        // render triangles
                        sceneWrapper.Render(context);

                        RenderTargetSet.BindNull(context);
                    }
                }
                ContextHelper.SetDepthStencilState(context, ContextHelper.DepthConfigurationType.NoDepth);
            }
        }
开发者ID:shoff,项目名称:CSharpRenderer,代码行数:71,代码来源:CubemapRenderHelper.cs

示例10: 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 );

            var centerDataSpace = mTileManager.TiledDatasetView.CenterDataSpace;
            var extentDataSpace = mTileManager.TiledDatasetView.ExtentDataSpace;

            var camera = new Camera(
                new Vector3( 0, 0, 0 ),
                new Vector3( 0, 0, 1 ),
                new Vector3( 0, 1, 0 ),
                Matrix.OrthoOffCenterLH(
                    centerDataSpace.X - ( extentDataSpace.X / 2f ),
                    centerDataSpace.X + ( extentDataSpace.X / 2f ),
                    centerDataSpace.Y + ( extentDataSpace.Y / 2f ),
                    centerDataSpace.Y - ( extentDataSpace.Y / 2f ),
                    0.1f,
                    100f ) );

            var datasetExtentDataSpaceX = mTileManager.TiledDatasetDescription.TiledVolumeDescriptions.Get( "SourceMap" ).NumTilesX * Constants.ConstParameters.GetInt( "TILE_SIZE_X" );
            var datasetExtentDataSpaceY = mTileManager.TiledDatasetDescription.TiledVolumeDescriptions.Get( "SourceMap" ).NumTilesY * Constants.ConstParameters.GetInt( "TILE_SIZE_Y" );

            mTileManager.GetTileCache().ToList().ForEach( tileCacheEntry => RenderTileCacheEntry( deviceContext, camera, datasetExtentDataSpaceX, datasetExtentDataSpaceY, tileCacheEntry, viewport ) );

            //mTinyTextContext.Print( viewport, "Frame Time: " + FrameTimeString, 10, 10 );
            //mTinyTextContext.Print( viewport, "Number of Active Cache Entries: " + mTileManager.GetTileCache().Count, 10, 30 );
            //mTinyTextContext.Render();

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

示例11: SetRenderTarget

        public void SetRenderTarget(DeviceContext context, DepthStencilView depthStencilView)
        {
            // Bind the render target view and depth stencil buffer to the output pipeline.
            context.OutputMerger.SetTargets(depthStencilView, texRenderTargetView);

            // Setup the color the buffer to.
            var color = new Color4(0.0f, 0.0f, 1.0f, 1.0f);

            // Clear the render to texture buffer.
            context.ClearRenderTargetView(texRenderTargetView, color);

            // Clear the depth buffer.
            context.ClearDepthStencilView(depthStencilView, DepthStencilClearFlags.Depth, 1.0f, 0);
        }
开发者ID:sinushawa,项目名称:ROD,代码行数:14,代码来源:RenderTexture.cs

示例12: ClearRenderTarget

 public void ClearRenderTarget(DeviceContext context, DepthStencilView depthStencilView, float red, float green, float blue, float alpha)
 {
     context.ClearRenderTargetView(_renderTargetView, new Color4(red, green, blue, alpha));
     context.ClearDepthStencilView(depthStencilView, DepthStencilClearFlags.Depth, 1.0f, 0);
 }
开发者ID:ndech,项目名称:PlaneSimulator,代码行数:5,代码来源:RenderTexture.cs

示例13: ClearRenderTarget

 public override void ClearRenderTarget(DeviceContext context, Color4 color)
 {
     context.ClearRenderTargetView(renderTargetView, color);
 }
开发者ID:nickudell,项目名称:PigmentFramework,代码行数:4,代码来源:RenderTexture.cs

示例14: Clear

 /****************************************************************************************************
  * 
  ****************************************************************************************************/
 public void Clear(DeviceContext context, Color4 color4)
 {
     context.ClearRenderTargetView(RenderTargetView, color4);
 }
开发者ID:JoltSoftwareDevelopment,项目名称:Jolt.MashRoom,代码行数:7,代码来源:RenderTarget.cs

示例15: Compose

        /// <summary>
        /// Composes an aperture.
        /// </summary>
        /// <param name="context">The device context.</param>
        /// <param name="output">The output render target.</param>
        /// <param name="profile">The optical profile to use.</param>
        /// <param name="pass">A SurfacePass instance to use.</param>
        /// <param name="time">The elapsed time.</param>
        /// <param name="dt">The time since last call.</param>
        public void Compose(DeviceContext context, GraphicsResource output, OpticalProfile profile, SurfacePass pass, double time, double dt)
        {
            context.ClearRenderTargetView(output.RTV, Color4.White);
            context.OutputMerger.SetBlendState(blendState);

            foreach (ApertureLayer layer in layers)
                layer.ApplyLayer(context, output, profile, pass, time, dt);

            context.OutputMerger.SetBlendState(null);
        }
开发者ID:TomCrypto,项目名称:Insight,代码行数:19,代码来源:ApertureComposer.cs


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