public RenderSystem(GraphicsDevice device, ContentManager content, IScene scene) { this.Device = device; this.ClearEffect = content.Load <Effect>("Clear"); this.CombineEffect = content.Load <Effect>("Combine"); this.PostProcessEffect = content.Load <Effect>("PostProcess");; this.Scene = scene; this.Quad = new Quad(); var width = device.PresentationParameters.BackBufferWidth; var height = device.PresentationParameters.BackBufferHeight; // Do not enable AA as we use FXAA during post processing const int aaSamples = 0; this.ColorTarget = new RenderTarget2D(device, width, height, false, SurfaceFormat.Color, DepthFormat.Depth24, aaSamples, RenderTargetUsage.DiscardContents); this.NormalTarget = new RenderTarget2D(device, width, height, false, SurfaceFormat.Color, DepthFormat.None, aaSamples, RenderTargetUsage.DiscardContents); this.DepthTarget = new RenderTarget2D(device, width, height, false, SurfaceFormat.Single, DepthFormat.None, aaSamples, RenderTargetUsage.DiscardContents); this.LightTarget = new RenderTarget2D(device, width, height, false, SurfaceFormat.Color, DepthFormat.None, aaSamples, RenderTargetUsage.DiscardContents); this.CombineTarget = new RenderTarget2D(device, width, height, false, SurfaceFormat.Color, DepthFormat.None, aaSamples, RenderTargetUsage.DiscardContents); this.DirectionalLightSystem = new DirectionalLightSystem(device, content.Load <Effect>("DirectionalLight")); this.PointLightSystem = new PointLightSystem(device, content.Load <Effect>("PointLight"), content.Load <Model>("Sphere")); this.ShadowCastingLightSystem = new ShadowCastingLightSystem(device, content.Load <Effect>("ShadowMap"), content.Load <Effect>("ShadowCastingLight")); this.SunlightSystem = new SunlightSystem(device, content.Load <Effect>("ShadowMap"), content.Load <Effect>("Sunlight")); }
public DeferredRenderPipeline( GraphicsDevice device, ShadowMapSystem shadowMapSystem, ModelSystem modelSystem, AveragedParticleSystem particleSystem, AdditiveParticleSystem additiveParticleSystem, ProjectorSystem projectorSystem, EffectFactory effectFactory, AmbientLightSystem ambientLightSystem, DirectionalLightSystem directionalLightSystem, PointLightSystem pointLightSystem, CascadedShadowMapSystem cascadedShadowMapSystem, ShadowCastingLightSystem shadowCastingLightSystem, SunlightSystem sunlightSystem, BoundarySystem boundarySystem, DynamicTextureSystem dynamicTextureSystem, IconSystem iconSystem, CutsceneSystem cutsceneSystem, IMeterRegistry meterRegistry) { this.ShadowMapSystem = shadowMapSystem; this.ModelSystem = modelSystem; this.TransparentParticleSystem = particleSystem; this.AdditiveParticleSystem = additiveParticleSystem; this.ProjectorSystem = projectorSystem; this.CombineEffect = effectFactory.Construct <CombineEffect>(); this.FxaaEffect = effectFactory.Construct <FxaaEffect>(); this.AmbientLightSystem = ambientLightSystem; this.DirectionalLightSystem = directionalLightSystem; this.PointLightSystem = pointLightSystem; this.CascadedShadowMapSystem = cascadedShadowMapSystem; this.ShadowCastingLightSystem = shadowCastingLightSystem; this.SunlightSystem = sunlightSystem; this.BoundarySystem = boundarySystem; this.DynamicTextureSystem = dynamicTextureSystem; this.CutsceneSystem = cutsceneSystem; this.IconSystem = iconSystem; var width = device.PresentationParameters.BackBufferWidth; var height = device.PresentationParameters.BackBufferHeight; this.GBuffer = new GBuffer(device, width, height); this.Input = new RenderPipelineInput(); this.Settings = new RenderPipelineSettings(); this.ShadowPipeline = ShadowPipeline.Create(device, meterRegistry); this.LightingPipeline = LightingPipeline.Create(device, meterRegistry); this.ModelPipeline = ModelPipeline.Create(device, meterRegistry); this.ParticlePipeline = ParticlePipeline.Create(device, meterRegistry); this.ProjectorPipeline = ProjectorPipeline.Create(device, meterRegistry); this.Pipeline = RenderPipeline.Create(device, meterRegistry); this.RootPass = new Pass(PassType.Opaque, 0); this.Recreate(); }
public static LightingPipeline RenderShadowCastingLights( this LightingPipeline pipeline, ShadowCastingLightSystem shadowCastingLightSystem) { var stage = new ShadowCastingLightStage(pipeline.Device, shadowCastingLightSystem); pipeline.Add(stage); return(pipeline); }
public PipelineBuilder(GraphicsDevice device, ShadowMapSystem shadowMapSystem, ModelSystem modelSystem, AveragedParticleSystem transparentParticleSystem, AdditiveParticleSystem additiveParticleSystem, ProjectorSystem projectorSystem, EffectFactory effectFactory, AmbientLightSystem ambientLightSystem, DirectionalLightSystem directionalLightSystem, PointLightSystem pointLightSystem, CascadedShadowMapSystem cascadedShadowMapSystem, ShadowCastingLightSystem shadowCastingLightSystem, SunlightSystem sunlightSystem, IconSystem iconSystem) { this.Device = device; this.ShadowMapSystem = shadowMapSystem; this.ModelSystem = modelSystem; this.TransparentParticleSystem = transparentParticleSystem; this.AdditiveParticleSystem = additiveParticleSystem; this.ProjectorSystem = projectorSystem; this.CombineEffect = effectFactory.Construct <CombineEffect>(); this.FxaaEffect = effectFactory.Construct <FxaaEffect>(); this.AmbientLightSystem = ambientLightSystem; this.DirectionalLightSystem = directionalLightSystem; this.PointLightSystem = pointLightSystem; this.CascadedShadowMapSystem = cascadedShadowMapSystem; this.ShadowCastingLightSystem = shadowCastingLightSystem; this.SunlightSystem = sunlightSystem; this.IconSystem = iconSystem; this.MeterRegistry = new NullMeterRegistry(); }
public ShadowCastingLightStage(GraphicsDevice device, ShadowCastingLightSystem shadowCastingLightSystem) { this.Device = device; this.ShadowCastingLightSystem = shadowCastingLightSystem; }