/// <summary>
 /// Initializes a new instance of the <see cref="DeferredRenderTechnicInitDescription"/> struct.
 /// </summary>
 /// <param name="DeferredGBuffer">The deferred G buffer.</param>
 /// <param name="DeferredLightMap">The deferred light map.</param>
 /// <param name="BackGroundColor">Color of the back ground.</param>
 /// <param name="LightDebug">if set to <c>true</c> [light debug].</param>
 /// <param name="DefferedDebug">if set to <c>true</c> [deffered debug].</param>
 /// <param name="UseFloatingBufferForLightMap">if set to <c>true</c> [use floating buffer for light map].</param>
 /// <param name="CullPointLight">if set to <c>true</c> [cull point light].</param>
 /// <param name="ExtraForwardPass">if set to <c>true</c> [extra forward pass].</param>
 /// <param name="RenderTargetsNameToDefferedDebug">The render targets name to deffered debug.</param>
 /// <param name="RestoreDepthOption">The restore depth option.</param>
 public PrePassRenderTechnicInitDescription(IDeferredGBuffer DeferredGBuffer, IDeferredLightMap DeferredLightMap,Color BackGroundColor, bool LightDebug, bool DefferedDebug,
     bool CullPointLight, bool ExtraForwardPass, String[] RenderTargetsNameToDefferedDebug, RestoreDepthOption RestoreDepthOption)
 {
     this.DefferedDebug = DefferedDebug;
     this.LightDebug = LightDebug;
     this.CullPointLight = CullPointLight;
     this.ExtraForwardPass = ExtraForwardPass;
     this.DeferredGBuffer = DeferredGBuffer;
     this.DeferredLightMap = DeferredLightMap;
     this.RenderTargetsNameToDefferedDebug = RenderTargetsNameToDefferedDebug;
     this.BackGroundColor = BackGroundColor;
     OrderAllObjectsBeforeDraw = null;
     OrderDeferredObjectsBeforeDraw = null;
     OrderForwardObjectsBeforeDraw = null;
 }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DeferredRenderTechnicInitDescription"/> struct.
 /// </summary>
 /// <param name="DeferredGBuffer">The deferred G buffer.</param>
 /// <param name="DeferredLightMap">The deferred light map.</param>
 /// <param name="BackGroundColor">Color of the back ground.</param>
 /// <param name="LightDebug">if set to <c>true</c> [light debug].</param>
 /// <param name="DefferedDebug">if set to <c>true</c> [deffered debug].</param>
 /// <param name="UseFloatingBufferForLightMap">if set to <c>true</c> [use floating buffer for light map].</param>
 /// <param name="CullPointLight">if set to <c>true</c> [cull point light].</param>
 /// <param name="ExtraForwardPass">if set to <c>true</c> [extra forward pass].</param>
 /// <param name="RenderTargetsNameToDefferedDebug">The render targets name to deffered debug.</param>
 /// <param name="RestoreDepthOption">The restore depth option.</param>
 public PrePassRenderTechnicInitDescription(IDeferredGBuffer DeferredGBuffer, IDeferredLightMap DeferredLightMap, Color BackGroundColor, bool LightDebug, bool DefferedDebug,
                                            bool CullPointLight, bool ExtraForwardPass, String[] RenderTargetsNameToDefferedDebug, RestoreDepthOption RestoreDepthOption)
 {
     this.DefferedDebug    = DefferedDebug;
     this.LightDebug       = LightDebug;
     this.CullPointLight   = CullPointLight;
     this.ExtraForwardPass = ExtraForwardPass;
     this.DeferredGBuffer  = DeferredGBuffer;
     this.DeferredLightMap = DeferredLightMap;
     this.RenderTargetsNameToDefferedDebug = RenderTargetsNameToDefferedDebug;
     this.BackGroundColor           = BackGroundColor;
     OrderAllObjectsBeforeDraw      = null;
     OrderDeferredObjectsBeforeDraw = null;
     OrderForwardObjectsBeforeDraw  = null;
 }
        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();
            
        }
示例#4
0
        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();
        }
        public void DrawScene(GameTime gameTime, IWorld world, IDeferredGBuffer gbuffer, IDeferredLightMap lightmap, RenderHelper render)
        {
            //if (useFloatBuffer)
            //{
            //    render.SetSamplerState(SamplerState.PointClamp, 0);
            //}
            //else
            //{
            //    render.SetSamplerState(ginfo.SamplerState, 0);
            //    render.SetSamplerState(ginfo.SamplerState, 1);
            //    render.SetSamplerState(ginfo.SamplerState, 2);
            //}

            render.Clear(Color.CornflowerBlue);
            effect.Parameters["halfPixel"].SetValue(half);
            effect.Parameters["View"].SetValue(world.CameraManager.ActiveCamera.View);
            effect.Parameters["Projection"].SetValue(world.CameraManager.ActiveCamera.Projection);
            effect.Parameters["light"].SetValue(lightmap[DeferredLightMapType.LIGHTMAP]);
            {
                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);
                        }
                    }
                }
            }

            if (saveToTexture)
            {
                render.PopRenderTarget();
            }
        }