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


C# RenderHelper.PopRenderTarget方法代码示例

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


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

示例1: Draw

        public override void Draw(Microsoft.Xna.Framework.Graphics.Texture2D ImageToProcess, RenderHelper rHelper, Microsoft.Xna.Framework.GameTime gt, PloobsEngine.Engine.GraphicInfo GraphicInfo, IWorld world, bool useFloatBuffer)
        {          
            //ssao
            rHelper.PushRenderTarget(RenderTarget2D);
            rHelper.Textures[0] = rHelper[PrincipalConstants.normalRt];
            SamplerState s0 = rHelper.SetSamplerState(SamplerState.LinearClamp, 0);

            rHelper.Textures[1] = rHelper[PrincipalConstants.DephRT];
            SamplerState s1 = rHelper.SetSamplerState(SamplerState.PointClamp, 1);

            rHelper.Textures[2] = tex;
            SamplerState s2 = rHelper.SetSamplerState(SamplerState.LinearWrap, 2);            

            Effect.CurrentTechnique = Effect.Techniques[0];
            Effect.Parameters["random_size"].SetValue(64);
            Effect.Parameters["g_screen_size"].SetValue(new Vector2(GraphicInfo.BackBufferWidth, GraphicInfo.BackBufferHeight));    
            Effect.Parameters["invertViewProj"].SetValue(Matrix.Invert(world.CameraManager.ActiveCamera.Projection));
            Effect.Parameters["View"].SetValue(world.CameraManager.ActiveCamera.View);
            Effect.Parameters["halfPixel"].SetValue(GraphicInfo.HalfPixel);

            //artist parameters
            Effect.Parameters["g_sample_rad"].SetValue(radius);
            Effect.Parameters["g_intensity"].SetValue(intensity);
            Effect.Parameters["g_scale"].SetValue(scale);
            Effect.Parameters["g_bias"].SetValue(bias);
            
            rHelper.RenderFullScreenQuadVertexPixel(Effect);         

            rHelper.PopRenderTarget();
            rHelper.SetSamplerState(s0, 0);
            rHelper.SetSamplerState(s1, 1);
            rHelper.SetSamplerState(s2, 2);

            //blur
            rHelper.PushRenderTarget(RenderTarget2D2);
            sBlurPost.Draw(RenderTarget2D, rHelper, gt, GraphicInfo, world, useFloatBuffer);
            rHelper.PopRenderTarget();            
            
            rHelper[PrincipalConstants.SSAORT] = RenderTarget2D2;

            //Mix
            Effect.CurrentTechnique = Effect.Techniques[1];
            Effect.Parameters["SSAOCombineIntensityity"].SetValue(SSAOCombineIntensityity);
            rHelper.Textures[0] = RenderTarget2D2;
            SamplerState s = useFloatBuffer == true ? SamplerState.PointClamp : SamplerState.LinearClamp;
            s1 = rHelper.SetSamplerState(s, 1);
            rHelper.Textures[1] = ImageToProcess;                        
            rHelper.RenderFullScreenQuadVertexPixel(Effect);
            rHelper.SetSamplerState(s1, 1);           

        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:51,代码来源:SSAOPost.cs

示例2: DrawScene

        public void DrawScene(GameTime gameTime, IWorld world, IDeferredGBuffer gbuffer, IDeferredLightMap lightmap, RenderHelper render)
        {
            render.PushDepthStencilState(DepthStencilState.None);

            PambientColor.SetValue(ambientColor.ToVector3());
            render.device.Textures[0] = lightmap[DeferredLightMapType.LIGHTMAP];
            SamplerState s0 = render.SetSamplerState(SamplerState.PointClamp, 0);

            render.device.Textures[1] = gbuffer[GBufferTypes.Extra1];
            render.device.Textures[2] = gbuffer[GBufferTypes.COLOR];
            //PEXTRA1.SetValue(gbuffer[GBufferTypes.Extra1]);            
            //PcolorMap.SetValue(gbuffer[GBufferTypes.COLOR]);
            //PlightMap.SetValue(lightmap[DeferredLightMapType.LIGHTMAP]);            

            render.RenderFullScreenQuadVertexPixel(finalCombineEffect);

            render.SetSamplerState(s0, 0);            

            if (saveToTexture)
            {
                render.PopRenderTarget();                
            }
            render.PopDepthStencilState();
            
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:25,代码来源:FinalCombination.cs

示例3: Draw

        /// <summary>
        /// Draws
        /// </summary>
        /// <param name="ImageToProcess">The image to process.</param>
        /// <param name="render">The render.</param>
        /// <param name="gt">The gt.</param>
        /// <param name="GraphicInfo">The graphic info.</param>
        /// <param name="world">The world.</param>
        /// <param name="useFloatingBuffer">if set to <c>true</c> [use floating buffer].</param>
        public override void Draw(Texture2D ImageToProcess, RenderHelper render, GameTime gt, Engine.GraphicInfo GraphicInfo, IWorld world, bool useFloatingBuffer)
        {
            //NOSSO threshold FILTER KKKKK =P
            render.PushRenderTarget(rt);
            render.Clear(Color.FromNonPremultiplied(bloomThreshold, bloomThreshold, bloomThreshold, 255));
            render.RenderTextureComplete(ImageToProcess, Color.White, GraphicInfo.FullScreenRectangle, Matrix.Identity, null, true, SpriteSortMode.Deferred, SamplerState.LinearClamp, subBlend);
            render.PopRenderTarget();

            render.Clear(Color.Black);
            render.RenderTextureComplete(ImageToProcess, Color.White, GraphicInfo.FullScreenRectangle, Matrix.Identity);

            //NOSSO BLUR KKKKK (mais KKKK)
            render.RenderTextureComplete(rt, Color.FromNonPremultiplied(255, 255, 255, brightNess), GraphicInfo.FullScreenRectangle, Matrix.CreateTranslation(2, 2, 0), null, true, SpriteSortMode.Deferred, SamplerState.AnisotropicClamp, additiveBlend);
            render.RenderTextureComplete(rt, Color.FromNonPremultiplied(255, 255, 255, brightNess), GraphicInfo.FullScreenRectangle, Matrix.CreateTranslation(-2, -2, 0), null, true, SpriteSortMode.Deferred, SamplerState.AnisotropicClamp, additiveBlend);
            render.RenderTextureComplete(rt, Color.FromNonPremultiplied(255, 255, 255, brightNess), GraphicInfo.FullScreenRectangle, Matrix.CreateTranslation(2, -2, 0), null, true, SpriteSortMode.Deferred, SamplerState.AnisotropicClamp, additiveBlend);
            render.RenderTextureComplete(rt, Color.FromNonPremultiplied(255, 255, 255, brightNess), GraphicInfo.FullScreenRectangle, Matrix.CreateTranslation(-2, 2, 0), null, true, SpriteSortMode.Deferred, SamplerState.AnisotropicClamp, additiveBlend);                              
            
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:27,代码来源:BloomPostEffect.cs

示例4: ResolveGBuffer

 public void ResolveGBuffer(RenderHelper render)
 {
     render.PopRenderTarget();                
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:4,代码来源:PreGBuffer.cs

示例5: EndForwardPass

 /// <summary>
 /// Ends the forward pass.
 /// Clean Up
 /// </summary>
 /// <returns></returns>
 public Texture2D EndForwardPass(RenderHelper render)
 {
     render.PopRenderTarget();
     return target;
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:10,代码来源:RestoreDepth.cs

示例6: EndDrawingShadowCasters

 internal void EndDrawingShadowCasters(RenderHelper render)
 {
     render.PopRenderTarget();
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:4,代码来源:Light2D.cs

示例7: DrawScene

        public void DrawScene(GameTime gameTime, IWorld world, RenderHelper render, GraphicInfo ginfo, List<IObject> objs)
        {
            Matrix v = world.CameraManager.ActiveCamera.View;
            Matrix p = world.CameraManager.ActiveCamera.Projection;
                    
            render.PushRenderTarget(colorRT, normalRT, depthRT, lightOclusionRT);
            
            render.RenderPreComponents(gameTime, ref v, ref p);
            System.Diagnostics.Debug.Assert(render.PeekBlendState() == BlendState.Opaque);
            System.Diagnostics.Debug.Assert(render.PeekDepthState() == DepthStencilState.Default);
            System.Diagnostics.Debug.Assert(render.PeekRasterizerState() == RasterizerState.CullCounterClockwise);
                        
            render.SetSamplerState(ginfo.SamplerState, 0);

            foreach (IObject item in objs)
            {
                item.Material.Drawn(gameTime,item, world.CameraManager.ActiveCamera, world.Lights, render);
            }

            render.PopRenderTarget();                

            colorRTFINAL = colorRT2;
            render.PushRenderTarget(colorRTFINAL);
            render.Clear(Color.CornflowerBlue);
            effect.Parameters["View"].SetValue(world.CameraManager.ActiveCamera.View);
            effect.Parameters["Projection"].SetValue(world.CameraManager.ActiveCamera.Projection);
            {

                foreach (IObject item in world.Culler.GetNotCulledObjectsList(MaterialType.DEFERRED))
                {                    
                    for (int i = 0; i < item.Modelo.MeshNumber; i++)
                    {
                        BatchInformation[] bi = item.Modelo.GetBatchInformation(i);
                        for (int j = 0; j < bi.Count(); j++)
                        {
                            effect.Parameters["Texture"].SetValue(item.Modelo.getTexture(TextureType.DIFFUSE,i,j));                    
                            effect.Parameters["World"].SetValue(bi[j].ModelLocalTransformation * item.WorldMatrix);
                            render.RenderBatch(bi[j], effect);
                        }
                    }
                }

            }
            render.PopRenderTarget();            

        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:46,代码来源:LightPrePassGBuffer.cs

示例8: PreDrawPhase

        public override void PreDrawPhase(GameTime gt, IWorld world, IObject obj, RenderHelper render, ICamera cam)
        {
            render.ValidateSamplerStates();

            Matrix view = cam.View;
            Matrix projection = cam.Projection;
            //REFRACAO
            Plane refractionClipPlane;
            if (cam.Position.Y > -plane.D)
            {
                refractionClipPlane = CreateReflectionPlane(plane.D, ref plane.Normal, ref view, ref projection, true);
            }
            else
            {
                refractionClipPlane = CreateReflectionPlane(plane.D, ref plane.Normal, ref view, ref projection, false);
            }            
            render.PushRenderTarget(refractionRT);
            render.Clear(Color.Black);
            render.RenderSceneReflectionRefration(world, gt, new List<IObject>() { obj }, ref view, ref projection, true, true,refractionClipPlane);
            refractionMap = render.PopRenderTarget()[0].RenderTarget as Texture2D;            

            //REFLEXAO
            Matrix m = Matrix.CreateReflection(plane);
            Vector3 pos;
            Vector3 target;
            Vector3 up;
            pos = Vector3.Transform(cam.Position, m);
            target = Vector3.Transform(cam.Target, m);
            up = Vector3.Transform(cam.Up, m);
            reflectiveViewMatrix = Matrix.CreateLookAt(pos, target, up);
            Plane reflectionClipPlane = CreateReflectionPlane(plane.D, ref plane.Normal, ref reflectiveViewMatrix, ref projection, false);
            render.PushRenderTarget(reflectionRT);
            render.Clear(Color.Black);
            render.PushRasterizerState(RasterizerState.CullClockwise);
            render.RenderSceneReflectionRefration(world, gt, new List<IObject>() { obj }, ref reflectiveViewMatrix, ref projection, true, true,reflectionClipPlane);
            render.PopRasterizerState();
            reflectionMap = render.PopRenderTarget()[0].RenderTarget as Texture2D;                                   

        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:39,代码来源:DeferredWaterCompleteShader.cs

示例9: Draw

 protected override void Draw(Microsoft.Xna.Framework.GameTime gameTime, RenderHelper render)
 {        
     if (takeScreen)
     {
         render.PushRenderTarget(RenderTarget2D);
         screenManager.GetScreens()[1].iDraw(gameTime, render);
         render.PopRenderTarget();
         takeScreen = false;
         String sabeTo= Path.Combine(pathToScreenShot,screenManager.GetScreens()[1].GetType().Name + ".png");
         RenderTarget2D.SaveAsPng(new FileStream(sabeTo, FileMode.Create), GraphicInfo.BackBufferWidth, GraphicInfo.BackBufferHeight);
     }
     render.RenderTextComplete("Ploobs Automated Visual Tests", new Microsoft.Xna.Framework.Vector2(50, 50), Color.Red, Matrix.Identity);
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:13,代码来源:TestProcessor.cs

示例10: Draw

        public override void Draw(Microsoft.Xna.Framework.Graphics.Texture2D ImageToProcess, RenderHelper rHelper, Microsoft.Xna.Framework.GameTime gt, PloobsEngine.Engine.GraphicInfo GraphicInfo, IWorld world, bool useFloatBuffer)
        {
            rHelper.PushRenderTarget(RenderTarget2D);
            effect.Parameters["blurDepthFalloff"].SetValue(blurDepthFalloff);
            effect.Parameters["weights"].SetValue(kernel);
            effect.Parameters["offsets"].SetValue(offsetsHoriz);
            effect.Parameters["GBufferPixelSize"].SetValue(new Vector2(1f / ImageToProcess.Width, 1f / ImageToProcess.Height));
            effect.Parameters["TempBufferRes"].SetValue(destinySize.Value);
            rHelper.Textures[0] = rHelper[PrincipalConstants.DephRT];
            rHelper.Textures[1] = ImageToProcess;
            SamplerState s0 = rHelper.SetSamplerState(SamplerState.PointClamp, 0);
            SamplerState s1 = rHelper.SetSamplerState(ImageSamplerState, 1);
            rHelper.RenderFullScreenQuadVertexPixel(effect);

            rHelper.PopRenderTarget();
            
            effect.Parameters["offsets"].SetValue(offsetsVert);
            rHelper.Textures[1] = RenderTarget2D;
            rHelper.RenderFullScreenQuadVertexPixel(effect);

            rHelper.SetSamplerState(s0, 0);
            rHelper.SetSamplerState(s1, 1);

        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:24,代码来源:SBlurPost.cs

示例11: Draw

        /// <summary>
        /// Draws the specified game time.
        /// </summary>
        /// <param name="gameTime">The game time.</param>
        /// <param name="world">The world.</param>
        /// <param name="render">The render.</param>
        protected void Draw(GameTime gameTime, IWorld world, RenderHelper render)
        {
            Matrix view = world.CameraManager.ActiveCamera.View;
            Matrix projection = world.CameraManager.ActiveCamera.Projection;

            world.Culler.StartFrame(ref view, ref projection, world.CameraManager.ActiveCamera.BoundingFrustum);
            List<IObject> AllnotCulledObjectsList = world.Culler.GetNotCulledObjectsList(null);
            List<IObject> DeferrednotCulledObjectsList = world.Culler.GetNotCulledObjectsList(MaterialType.DEFERRED);
            List<IObject> ForwardnotCulledObjectsList = world.Culler.GetNotCulledObjectsList(MaterialType.FORWARD);

            if (desc.OrderAllObjectsBeforeDraw != null)
                AllnotCulledObjectsList = desc.OrderAllObjectsBeforeDraw(AllnotCulledObjectsList);

            if (desc.OrderDeferredObjectsBeforeDraw != null)
                DeferrednotCulledObjectsList = desc.OrderDeferredObjectsBeforeDraw(DeferrednotCulledObjectsList);

            if (desc.OrderForwardObjectsBeforeDraw != null)
                ForwardnotCulledObjectsList = desc.OrderForwardObjectsBeforeDraw(ForwardnotCulledObjectsList);

            render.SetSamplerStates(ginfo.SamplerState);
            render.DettachBindedTextures();

            deferredGBuffer.PreDrawScene(gameTime, world, render, ginfo, AllnotCulledObjectsList);

            render.SetSamplerStates(ginfo.SamplerState);
            render.DettachBindedTextures();

            deferredGBuffer.SetGBuffer(render);            
            deferredGBuffer.ClearGBuffer(render);
            deferredGBuffer.DrawScene(gameTime, world, render, ginfo, DeferrednotCulledObjectsList);
            deferredGBuffer.ResolveGBuffer(render);

            render[PrincipalConstants.DephRT] = deferredGBuffer[GBufferTypes.DEPH];
            render[PrincipalConstants.normalRt] = deferredGBuffer[GBufferTypes.NORMAL];

            render.DettachBindedTextures();
            render.ValidateSamplerStates();            

            deferredLightMap.SetLightMap(render);
            deferredLightMap.DrawLights(gameTime, world, deferredGBuffer, render);
            deferredLightMap.ResolveLightMap(render);
            render[PrincipalConstants.lightRt] = deferredLightMap[DeferredLightMapType.LIGHTMAP];

            render.DettachBindedTextures(5);
            render.ValidateSamplerStates();

            render.PushRenderTarget(scenerender);
            render.Clear(desc.BackGroundColor);
            foreach (IObject item in AllnotCulledObjectsList)
            {
                if (item.Material.IsVisible)
                    item.Material.PosDrawnPhase(gameTime, item, world.CameraManager.ActiveCamera, world.Lights, render);
            }

            render.DettachBindedTextures(3);
            render.ValidateSamplerStates();
                        
                if (world.PhysicWorld.isDebugDraw)
                {
                    world.PhysicWorld.iDebugDrawn(render, gameTime, world.CameraManager.ActiveCamera);
                }
                if (world.ParticleManager != null)
                {
                    world.ParticleManager.iDraw(gameTime, world.CameraManager.ActiveCamera.View, world.CameraManager.ActiveCamera.Projection, render);
                    render.ResyncStates();
                    render.SetSamplerStates(ginfo.SamplerState);
                }

                render.DettachBindedTextures(6);
                render.ValidateSamplerStates();            
                
                render.RenderPosWithDepthComponents(gameTime, ref view, ref projection);

                render.DettachBindedTextures(6);
                render.ValidateSamplerStates();

                render[PrincipalConstants.colorRT] = scenerender;
                render[PrincipalConstants.normalRt] = deferredGBuffer[GBufferTypes.NORMAL];
                render[PrincipalConstants.lightRt] = deferredLightMap[DeferredLightMapType.LIGHTMAP];
                render[PrincipalConstants.DephRT] = deferredGBuffer[GBufferTypes.DEPH];
                render[PrincipalConstants.extra1RT] = deferredGBuffer[GBufferTypes.Extra1];
                render[PrincipalConstants.CurrentImage] = render[PrincipalConstants.CombinedImage] = render.PopRenderTargetAsSingleRenderTarget2D();

                for (int i = 0; i < PostEffects.Count; i++)
                {
                    if (PostEffects[i].Enabled)
                    {
                        render.PushRenderTarget(PostEffectTarget);
                        render.Clear(Color.Black);
                        PostEffects[i].Draw(render[PrincipalConstants.CurrentImage], render, gameTime, ginfo, world, true);
                        Texture2D tex = render.PopRenderTarget()[0].RenderTarget as Texture2D;
                        render[PrincipalConstants.CurrentImage] = tex;
                        SwapTargetBuffers();
                    }
//.........这里部分代码省略.........
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:101,代码来源:PreRenderTechnic.cs

示例12: ResolveLightMap

 public void ResolveLightMap(RenderHelper render)
 {            
     render.PopRenderTarget();
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:4,代码来源:PreLightMap.cs

示例13: ExecuteTechnic

        protected override void ExecuteTechnic(Microsoft.Xna.Framework.GameTime gameTime, RenderHelper render, IWorld world)
        {
            ICamera camera = world.CameraManager.ActiveCamera;
            Matrix view = world.CameraManager.ActiveCamera.View;
            Matrix projection = world.CameraManager.ActiveCamera.Projection;

            ComputeFrustumCorners(camera);

            world.Culler.StartFrame(ref view, ref projection, world.CameraManager.ActiveCamera.BoundingFrustum);
            List<IObject> AllnotCulledObjectsList = world.Culler.GetNotCulledObjectsList(null);
            List<IObject> DeferrednotCulledObjectsList = world.Culler.GetNotCulledObjectsList(MaterialType.DEFERRED);
            List<IObject> ForwardnotCulledObjectsList = world.Culler.GetNotCulledObjectsList(MaterialType.FORWARD);

            foreach (IObject item in AllnotCulledObjectsList)
            {
                if (item.Material.IsVisible)
                    item.Material.PreDrawnPhase(gameTime, world, item, world.CameraManager.ActiveCamera, world.Lights, render);
            }
                        
            render.PushRenderTargetBinding(_gBufferBinding);
            render.Clear(Color.Black,ClearOptions.DepthBuffer | ClearOptions.Stencil, 1.0f, 0);           

            render.PushDepthStencilState(DepthStencilState.None);
            render.PushRasterizerState(RasterizerState.CullNone);
            render.RenderFullScreenQuadVertexPixel(_clearGBuffer);
            render.PopDepthStencilState();
            render.PopRasterizerState();
            

            foreach (IObject item in DeferrednotCulledObjectsList)
            {
                if (item.Material.IsVisible)
                    item.Material.Drawn(gameTime, item, world.CameraManager.ActiveCamera, world.Lights, render);
            }

            render.PopRenderTarget();
            render[PrincipalConstants.DephRT] = _depthBuffer;
            render[PrincipalConstants.normalRt] = _normalBuffer; 
            
            //render.PushRenderTargetBinding(_lightAccumBinding);
            render.Clear(new Color(0, 0, 0, 0));

            render.PushDepthStencilState(DepthStencilState.None);            

            //draw using additive blending. 
            //At first I was using BlendState.additive, but it seems to use alpha channel for modulation, 
            //and as we use alpha channel as the specular intensity, we have to create our own blend state here
            render.PushBlendState(_lightAddBlendState);           
 
            RenderLights(camera,world,render,ginfo);
            
            //render[PrincipalConstants.lightRt] = render.PopRenderTarget()[0].RenderTarget as Texture2D;
            
            render.PopDepthStencilState();
            render.PopBlendState();
            return;
            render.PushRenderTarget(_outputTexture);

            render.Clear(Color.Black);
            
            foreach (IObject item in AllnotCulledObjectsList)
            {
                if (item.Material.IsVisible)
                    item.Material.PosDrawnPhase(gameTime, item, world.CameraManager.ActiveCamera, world.Lights, render);
            }

            if (world.PhysicWorld.isDebugDraw)
            {
                //world.PhysicWorld.iDebugDrawn(render, gameTime, world.CameraManager.ActiveCamera);
            }
            if (world.ParticleManager != null)
            {
                //world.ParticleManager.iDraw(gameTime, world.CameraManager.ActiveCamera.View, world.CameraManager.ActiveCamera.Projection, render);
                //render.ResyncStates();
            }

            ForwardPass.Draw(gameTime, world, render, DeferrednotCulledObjectsList, ForwardnotCulledObjectsList);

            render.RenderPosWithDepthComponents(gameTime, ref view, ref projection);

            render[PrincipalConstants.CurrentImage] = render.PopRenderTargetAsSingleRenderTarget2D();

            for (int i = 0; i < PostEffects.Count; i++)
            {
                if (PostEffects[i].Enabled)
                {
                    render.PushRenderTarget(PostEffectTarget);
                    render.Clear(Color.Black);
                    PostEffects[i].Draw(render[PrincipalConstants.CurrentImage], render, gameTime, ginfo, world, true);
                    Texture2D tex = render.PopRenderTarget()[0].RenderTarget as Texture2D;
                    System.Diagnostics.Debug.Assert(tex != null);
                    render[PrincipalConstants.CurrentImage] = tex;
                    SwapTargetBuffers();
                }
            }

            render.Clear(Color.Black);
            render.RenderTextureComplete(render[PrincipalConstants.CurrentImage], Color.White, ginfo.FullScreenRectangle, Matrix.Identity, null, true, SpriteSortMode.Deferred, SamplerState.PointClamp);                     

            render.RenderPosComponents(gameTime, ref view, ref projection);                        
//.........这里部分代码省略.........
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:101,代码来源:LightPrePassRenderTechnic.cs

示例14: Draw


//.........这里部分代码省略.........
                    {
                        world.PhysicWorld.iDebugDrawn(render, gameTime, world.CameraManager.ActiveCamera);
                    }
                    if (world.ParticleManager != null)
                    {
                        world.ParticleManager.iDraw(gameTime, world.CameraManager.ActiveCamera.View, world.CameraManager.ActiveCamera.Projection, render);
                        render.ResyncStates();
                        render.SetSamplerStates(ginfo.SamplerState);
                    }

                    render.DettachBindedTextures(6);
                    render.ValidateSamplerStates();

                    forwardPass.Draw(gameTime, world, render,DeferrednotCulledObjectsList,ForwardnotCulledObjectsList);

                    render.DettachBindedTextures(6);
                    render.ValidateSamplerStates();

                    render.RenderPosWithDepthComponents(gameTime, ref view, ref projection);

                    render.DettachBindedTextures(6);
                    render.ValidateSamplerStates();

                    render[PrincipalConstants.CurrentImage] = restoreDepth.EndForwardPass(render);
                    render[PrincipalConstants.CombinedImage] = render[PrincipalConstants.CurrentImage];

                    for (int i = 0; i < PostEffects.Count; i++)
                    {
                        if (PostEffects[i].Enabled)
                        {
                            render.PushRenderTarget(PostEffectTarget);
                            render.Clear(Color.Black);
                            PostEffects[i].Draw(render[PrincipalConstants.CurrentImage], render, gameTime, ginfo, world, desc.UseFloatingBufferForLightMap);
                            Texture2D tex = render.PopRenderTarget()[0].RenderTarget as Texture2D;
                            render[PrincipalConstants.CurrentImage] = tex;
                            SwapTargetBuffers();                            
                        }
                    }

                    render.SetSamplerStates(ginfo.SamplerState);
                    render.DettachBindedTextures(6);
                                        
                    if (desc.UseFloatingBufferForLightMap)
                    {                        
                        render.Clear(Color.Black);
                        render.RenderTextureComplete(render[PrincipalConstants.CurrentImage], Color.White, ginfo.FullScreenRectangle, Matrix.Identity, null, true, SpriteSortMode.Deferred, SamplerState.PointClamp);                     
                    }
                    else
                    {                        
                        render.Clear(Color.Black);                        
                        render.RenderTextureComplete(render[PrincipalConstants.CurrentImage], Color.White, ginfo.FullScreenRectangle, Matrix.Identity,null,true,SpriteSortMode.Deferred,ginfo.SamplerState);                    
                    }                    
                }
                else if (desc.RestoreDepthOption == RestoreDepthOption.AFTER_POSTEFFECT)
                {                    
                    for (int i = 0; i < PostEffects.Count; i++)
                    {
                        if (PostEffects[i].Enabled)
                        {
                            render.PushRenderTarget(PostEffectTarget);
                            render.Clear(Color.Black);
                            PostEffects[i].Draw(render[PrincipalConstants.CurrentImage], render, gameTime, ginfo, world, desc.UseFloatingBufferForLightMap);
                            Texture2D tex = render.PopRenderTarget()[0].RenderTarget as Texture2D;
                            render[PrincipalConstants.CurrentImage] = tex;
                            SwapTargetBuffers();
                        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:67,代码来源:DeferredRenderTechnic.cs


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