public ShadowMapSystem( GraphicsDevice device, IComponentContainer <ShadowMap> shadowMaps, IComponentContainer <CascadedShadowMap> cascadedShadowMaps, ModelSystem modelSystem, IMeterRegistry meterRegistry) { this.Device = device; this.ShadowMaps = shadowMaps; this.CascadedShadowMaps = cascadedShadowMaps; this.ModelSystem = modelSystem; this.MeterRegistry = meterRegistry; this.MeterRegistry.CreateGauge(ShadowMapCounter); this.MeterRegistry.CreateGauge(ShadowMapTotal); this.MeterRegistry.CreateGauge(ShadowMapStep, "step"); this.NullSkybox = new TextureCube(device, 1, false, SurfaceFormat.Color); this.NullSkybox.SetData(CubeMapFace.PositiveX, new Color[] { Color.White }); this.NullSkybox.SetData(CubeMapFace.NegativeX, new Color[] { Color.White }); this.NullSkybox.SetData(CubeMapFace.PositiveY, new Color[] { Color.White }); this.NullSkybox.SetData(CubeMapFace.NegativeY, new Color[] { Color.White }); this.NullSkybox.SetData(CubeMapFace.PositiveZ, new Color[] { Color.White }); this.NullSkybox.SetData(CubeMapFace.NegativeZ, new Color[] { Color.White }); }
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 APipeline(GraphicsDevice device, IMeterRegistry meterRegistry, string name) { this.Device = device; this.MeterRegistry = meterRegistry; this.Stages = new List <IPipelineStage <T> >(); this.StageGauge = $"{name}_stages_render_time"; this.MeterRegistry.CreateGauge(this.StageGauge, "stage", "pass"); }
private void AddParticles(RenderPipeline pipeline, GraphicsDevice device, IMeterRegistry meterRegistry, RenderPipelineSettings settings) { if (settings.EnableParticles) { var particlePipeline = ParticlePipeline.Create(device, meterRegistry).ClearParticleRenderTargets() .RenderTransparentParticles(this.Systems.Get <AveragedParticleSystem>()) .RenderAdditiveParticles(this.Systems.Get <AdditiveParticleSystem>()); pipeline.RenderParticles(particlePipeline); } }
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); } }
public RenderPipeline Build(GraphicsDevice device, IMeterRegistry meterRegistry) { var pipeline = RenderPipeline.Create(device, meterRegistry); pipeline .UpdateSystem(this.Systems.Get <AveragedParticleSystem>()) .UpdateSystem(this.Systems.Get <AdditiveParticleSystem>()) .UpdateSystem(this.Systems.Get <AnimationSystem>()) .UpdateSystem(this.Systems.Get <UVAnimationSystem>()); return(pipeline); }
public RenderPipeline Build(GraphicsDevice device, IMeterRegistry meterRegistry, RenderPipelineSettings settings) { var pipeline = RenderPipeline.Create(device, meterRegistry) .ClearRenderTargetSet() .UpdateSystem(this.Systems.Get <OffsetSystem>()); this.AddDynamicTextures(pipeline); this.AddShadows(pipeline, device, meterRegistry, settings); this.AddModels(pipeline, device, meterRegistry, settings); this.AddParticles(pipeline, device, meterRegistry, settings); this.AddDebug(pipeline, settings); return(pipeline); }
public ShadowMapSystem( GraphicsDevice device, IComponentContainer <ShadowMap> shadowMaps, ModelSystem modelSystem, AveragedParticleSystem particleSystem, IMeterRegistry meterRegistry) { this.Device = device; this.ShadowMaps = shadowMaps; this.ModelSystem = modelSystem; this.ParticleSystem = particleSystem; this.MeterRegistry = meterRegistry; this.MeterRegistry.CreateGauge(ShadowMapCounter); this.MeterRegistry.CreateGauge(ShadowMapTotal); this.MeterRegistry.CreateGauge(ShadowMapStep, "step"); }
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); } }
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 DeferredRenderPipeline( RenderPipelineBuilder renderPipelineBuilder, AnimationPipelineBuilder animationPipelineBuilder, IMeterRegistry meterRegistry, GraphicsDevice device) { this.RenderPipelineBuilder = renderPipelineBuilder; this.AnimationPipelineBuilder = animationPipelineBuilder; this.MeterRegistry = meterRegistry; 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.RootPass = new Pass(PassType.Opaque, 0); this.Recreate(); }
public static ParticlePipeline Create(GraphicsDevice device, IMeterRegistry meterRegistry) => new ParticlePipeline(device, meterRegistry);
private ShadowPipeline(GraphicsDevice device, IMeterRegistry meterRegistry) : base(device, meterRegistry, "shadow_pipeline") { }
public static ModelPipeline Create(GraphicsDevice device, IMeterRegistry meterRegistry) => new ModelPipeline(device, meterRegistry);
private LightingPipeline(GraphicsDevice device, IMeterRegistry meterRegistry) : base(device, meterRegistry, "lighting_pipeline") { }
public static ShadowPipeline Create(GraphicsDevice device, IMeterRegistry meterRegistry) => new ShadowPipeline(device, meterRegistry);
public RenderPipeline(GraphicsDevice device, IMeterRegistry meterRegistry) : base(device, meterRegistry, "render_pipeline") { }
public static LightingPipeline Create(GraphicsDevice device, IMeterRegistry meterRegistry) => new LightingPipeline(device, meterRegistry);
public static RenderPipeline Create(GraphicsDevice device, IMeterRegistry meterRegistry) => new RenderPipeline(device, meterRegistry);
private ModelPipeline(GraphicsDevice device, IMeterRegistry meterRegistry) : base(device, meterRegistry, "model_pipeline") { }
public static ProjectorPipeline Create(GraphicsDevice device, IMeterRegistry meterRegistry) => new ProjectorPipeline(device, meterRegistry);
private ProjectorPipeline(GraphicsDevice device, IMeterRegistry meterRegistry) : base(device, meterRegistry, "projector_pipeline") { }
private ParticlePipeline(GraphicsDevice device, IMeterRegistry meterRegistry) : base(device, meterRegistry, "particle_pipeline") { }