public static LightingPipeline RenderSunlights(this LightingPipeline pipeline, SunlightSystem sunlightSystem)
        {
            var stage = new SunlightStage(pipeline.Device, sunlightSystem);

            pipeline.Add(stage);
            return(pipeline);
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        public static LightingPipeline RenderPointLights(
            this LightingPipeline pipeline,
            PointLightSystem pointLightSystem)
        {
            var stage = new PointLightStage(pipeline.Device, pointLightSystem);

            pipeline.Add(stage);
            return(pipeline);
        }
        public static LightingPipeline RenderDirectionalLights(
            this LightingPipeline pipeline,
            DirectionalLightSystem directionalLightSystem)
        {
            var stage = new DirectionalLightStage(pipeline.Device, directionalLightSystem);

            pipeline.Add(stage);
            return(pipeline);
        }
Esempio n. 5
0
        public static ModelPipeline RenderLights(
            this ModelPipeline pipeline,
            LightingPipeline lightingPipeline)
        {
            var stage = new RenderLightsStage(lightingPipeline);

            pipeline.Add(stage);
            return(pipeline);
        }
        public static LightingPipeline RenderShadowCastingLights(
            this LightingPipeline pipeline,
            ShadowCastingLightSystem shadowCastingLightSystem)
        {
            var stage = new ShadowCastingLightStage(pipeline.Device, shadowCastingLightSystem);

            pipeline.Add(stage);
            return(pipeline);
        }
        public static LightingPipeline RenderAmbientLight(
            this LightingPipeline pipeline,
            AmbientLightSystem ambientLightSystem,
            bool enableSSAO)
        {
            var stage = new AmbientLightStage(pipeline.Device, ambientLightSystem, enableSSAO);

            pipeline.Add(stage);
            return(pipeline);
        }
Esempio n. 8
0
        private void AddModels(RenderPipeline pipeline, GraphicsDevice device, IMeterRegistry meterRegistry, RenderPipelineSettings settings)
        {
            if (settings.EnableModels)
            {
                pipeline.UpdateSystem(this.Systems.Get <BoundsSystem>());

                var modelPipeline = ModelPipeline.Create(device, meterRegistry)
                                    .ClearModelRenderTargets()
                                    .RenderGeometry(this.Systems.Get <GeometrySystem>())
                                    .RenderModelBatch();

                if (settings.EnableProjectors)
                {
                    var projectorPipeline = ProjectorPipeline.Create(device, meterRegistry);
                    var projectorSystem   = this.Systems.Get <ProjectorSystem>();
                    projectorSystem.Technique = settings.ProjectorTechnique;
                    projectorPipeline.RenderProjectors(projectorSystem);

                    modelPipeline.RenderProjectors(projectorPipeline);
                }

                if (EnableLights(settings))
                {
                    var ls = settings.LightSettings;
                    var lightingPipeline = LightingPipeline.Create(device, meterRegistry)
                                           .ClearLightTargets()
                                           .EnableIf(ls.EnableAmbientLights, x => x.RenderAmbientLight(this.Systems.Get <AmbientLightSystem>(), ls.EnableSSAO))
                                           .EnableIf(ls.EnableDirectionalLights, x => x.RenderDirectionalLights(this.Systems.Get <DirectionalLightSystem>()))
                                           .EnableIf(ls.EnablePointLights, x => x.RenderPointLights(this.Systems.Get <PointLightSystem>()))
                                           .EnableIf(ls.EnableShadowCastingLights, x => x.RenderShadowCastingLights(this.Systems.Get <ShadowCastingLightSystem>()))
                                           .EnableIf(ls.EnableSunLights, x => x.RenderSunlights(this.Systems.Get <SunlightSystem>()));

                    modelPipeline.RenderLights(lightingPipeline);
                }

                var combineEffect = this.EffectFactory.Construct <CombineEffect>();
                var fxaaEffect    = this.EffectFactory.Construct <FxaaEffect>();
                modelPipeline
                .CombineDiffuseWithLighting(combineEffect)
                .AntiAlias(fxaaEffect, settings.ModelSettings.FxaaFactor);

                pipeline.RenderModels(this.Systems.Get <ModelSystem>(), modelPipeline);
            }
        }
Esempio n. 9
0
        public void AddAll(RenderPipeline pipeline)
        {
            var shadowPipeline    = ShadowPipeline.Create(this.Device, this.MeterRegistry);
            var lightingPipeline  = LightingPipeline.Create(this.Device, this.MeterRegistry);
            var modelPipeline     = ModelPipeline.Create(this.Device, this.MeterRegistry);
            var particlePipeline  = ParticlePipeline.Create(this.Device, this.MeterRegistry);
            var projectorPipeline = ProjectorPipeline.Create(this.Device, this.MeterRegistry);


            shadowPipeline
            .RenderShadowMaps(this.ShadowMapSystem);

            lightingPipeline
            .ClearLightTargets()
            .RenderAmbientLight(this.AmbientLightSystem, true)
            .RenderDirectionalLights(this.DirectionalLightSystem)
            .RenderPointLights(this.PointLightSystem)
            .RenderShadowCastingLights(this.ShadowCastingLightSystem)
            .RenderSunlights(this.SunlightSystem);

            projectorPipeline
            .RenderProjectors(this.ProjectorSystem);
            this.ProjectorSystem.Technique = Effects.Techniques.ProjectorEffectTechniques.Projector;

            modelPipeline
            .ClearModelRenderTargets()
            .RenderModelBatch()
            .RenderProjectors(projectorPipeline)
            .RenderLights(lightingPipeline)
            .CombineDiffuseWithLighting(this.CombineEffect)
            .AntiAlias(this.FxaaEffect, 4);

            particlePipeline
            .ClearParticleRenderTargets()
            .RenderTransparentParticles(this.TransparentParticleSystem)
            .RenderAdditiveParticles(this.AdditiveParticleSystem);

            pipeline
            .ClearRenderTargetSet()
            .RenderShadows(shadowPipeline)
            .RenderModels(this.ModelSystem, modelPipeline)
            .RenderParticles(particlePipeline);
        }
Esempio n. 10
0
 public static LightingPipeline ClearLightTargets(this LightingPipeline pipeline)
 {
     pipeline.Add(new ClearStage());
     return(pipeline);
 }
Esempio n. 11
0
 public RenderLightsStage(LightingPipeline lightingPipeline)
 {
     this.LightingPipeline = lightingPipeline;
     this.Input            = new LightingPipelineInput();
 }