public static ShadowPipeline RenderShadowMaps(this ShadowPipeline pipeline, ShadowMapSystem shadowMapSystem)
        {
            var stage = new RenderShadowMapsStage(shadowMapSystem);

            pipeline.Add(stage);
            return(pipeline);
        }
示例#2
0
        public static RenderPipeline RenderShadows(this RenderPipeline pipeline, ShadowPipeline shadowPipeline)
        {
            var stage = new RenderShadowsStage(shadowPipeline);

            pipeline.Add(stage);
            return(pipeline);
        }
示例#3
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();
        }
示例#4
0
 protected override RenderPipeline CreatePipeline()
 {
     if (pipeline != null)
     {
         pipeline.ReleaseShader();
     }
     pipeline = new ShadowPipeline(computeShader, mat);
     return(pipeline);
 }
示例#5
0
        private void AddShadows(RenderPipeline pipeline, GraphicsDevice device, IMeterRegistry meterRegistry, RenderPipelineSettings settings)
        {
            if (settings.EnableShadows)
            {
                var shadowPipeline = ShadowPipeline.Create(device, meterRegistry)
                                     .RenderShadowMaps(this.Systems.Get <ShadowMapSystem>());

                pipeline
                .UpdateSystem(this.Systems.Get <CascadedShadowMapSystem>())
                .RenderShadows(shadowPipeline);
            }
        }
示例#6
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);
        }
示例#7
0
 public RenderShadowsStage(ShadowPipeline shadowPipeline)
 {
     this.ShadowPipeline = shadowPipeline;
     this.Input          = new ShadowPipelineInput();
 }