protected override void AfterLoadContent(IContentManager manager, PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory) { base.AfterLoadContent(manager, ginfo, factory); this.ginfo = ginfo; pointLightEffect = factory.GetEffect("PrePass/plight"); _clearGBuffer = factory.GetEffect("PrePass/ClearGBuffer"); _lighting = factory.GetEffect("PrePass/LightingLpp"); sphereModel = new SimpleModel(factory, "Model/Dsphere"); ForwardPass = new ForwardPass(ForwardPassDescription.Default()); _width = ginfo.BackBufferWidth; _height = ginfo.BackBufferHeight; _cwDepthState = new DepthStencilState(); _cwDepthState.DepthBufferWriteEnable = false; _cwDepthState.DepthBufferFunction = CompareFunction.LessEqual; _ccwDepthState = new DepthStencilState(); _ccwDepthState.DepthBufferWriteEnable = false; _ccwDepthState.DepthBufferFunction = CompareFunction.GreaterEqual; _directionalDepthState = new DepthStencilState(); ; _directionalDepthState.DepthBufferWriteEnable = false; _directionalDepthState.DepthBufferFunction = CompareFunction.Greater; _depthStateDrawLights = new DepthStencilState(); //we draw our volumes with front-face culling, so we have to use GreaterEqual here _depthStateDrawLights.DepthBufferFunction = CompareFunction.GreaterEqual; //with our z-buffer reconstructed we only need to read it _depthStateDrawLights.DepthBufferWriteEnable = false; _depthStateReconstructZ = new DepthStencilState { DepthBufferEnable = true, DepthBufferWriteEnable = true, DepthBufferFunction = CompareFunction.Always }; _lightAddBlendState = new BlendState() { AlphaSourceBlend = Blend.One, ColorSourceBlend = Blend.One, AlphaDestinationBlend = Blend.One, ColorDestinationBlend = Blend.One, }; CreateGBuffer(factory); }
/// <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="DeferredFinalCombination">The deferred final combination.</param> /// <param name="ForwardPass">The forward pass.</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 DeferredRenderTechnicInitDescription(IDeferredGBuffer DeferredGBuffer, IDeferredLightMap DeferredLightMap, IDeferredFinalCombination DeferredFinalCombination, ForwardPass ForwardPass, Color BackGroundColor, bool LightDebug, bool DefferedDebug, bool UseFloatingBufferForLightMap, bool CullPointLight, bool ExtraForwardPass, String[] RenderTargetsNameToDefferedDebug, RestoreDepthOption RestoreDepthOption) { this.DefferedDebug = DefferedDebug; this.UseFloatingBufferForLightMap = UseFloatingBufferForLightMap; this.LightDebug = LightDebug; this.CullPointLight = CullPointLight; this.ExtraForwardPass = ExtraForwardPass; this.DeferredGBuffer = DeferredGBuffer; this.DeferredLightMap = DeferredLightMap; this.DeferredFinalCombination = DeferredFinalCombination; this.RestoreDepthOption = RestoreDepthOption; this.ForwardPass = ForwardPass; this.RenderTargetsNameToDefferedDebug = RenderTargetsNameToDefferedDebug; this.BackGroundColor = BackGroundColor; OrderAllObjectsBeforeDraw = null; OrderDeferredObjectsBeforeDraw = null; OrderForwardObjectsBeforeDraw = null; }