public static ModelPipeline RenderGeometry(this ModelPipeline pipeline, GeometrySystem geometrySystem)
        {
            var stage = new RenderGeometryStage(pipeline.Device, geometrySystem);

            pipeline.Add(stage);
            return(pipeline);
        }
Beispiel #2
0
        public RenderModelsStage(ModelSystem modelSystem, ModelPipeline modelPipeline)
        {
            this.ModelSystem   = modelSystem;
            this.ModelPipeline = modelPipeline;

            this.Input = new ModelPipelineInput();
        }
        public static ModelPipeline AntiAlias(this ModelPipeline pipeline, FxaaEffect effect, float strength)
        {
            var stage = new AntiAliasStage(pipeline.Device, effect, strength);

            pipeline.Add(stage);
            return(pipeline);
        }
Beispiel #4
0
        public static ModelPipeline RenderProjectors(this ModelPipeline pipeline, ProjectorPipeline projectorPipeline)
        {
            var stage = new RenderProjectorsStage(projectorPipeline);

            pipeline.Add(stage);

            return(pipeline);
        }
Beispiel #5
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();
        }
Beispiel #6
0
        public static ModelPipeline RenderLights(
            this ModelPipeline pipeline,
            LightingPipeline lightingPipeline)
        {
            var stage = new RenderLightsStage(lightingPipeline);

            pipeline.Add(stage);
            return(pipeline);
        }
Beispiel #7
0
        public static RenderPipeline RenderModels(
            this RenderPipeline pipeline,
            ModelSystem modelSystem,
            ModelPipeline modelPipeline)
        {
            var stage = new RenderModelsStage(modelSystem, modelPipeline);

            pipeline.Add(stage);
            return(pipeline);
        }
        public void MultiEntitiesInitPipelines()
        {
            EntitySpider spider = new DefaultEntitySpider();

            spider.Identity  = (Guid.NewGuid().ToString("N"));
            spider.ThreadNum = 1;
            spider.AddPipeline(new MySqlEntityPipeline("Database='mysql';Data Source=localhost;User ID=root;Password=;Port=3306;SslMode=None;"));
            spider.AddPipeline(new MySqlFileEntityPipeline());
            spider.AddPipeline(new ConsoleEntityPipeline());
            spider.AddPipeline(new JsonFileEntityPipeline());

            spider.AddStartUrl("http://baidu.com");
            spider.Monitor = new LogMonitor();
            spider.AddEntityType <Entity13>();
            spider.AddEntityType <Entity12>();

            spider.Run("running-test");

            var entityPipelines = spider.Pipelines.ToList();

            Assert.Equal(4, entityPipelines.Count);

            var pipeline1 = (MySqlEntityPipeline)entityPipelines[0];

            Assert.Equal("Database='mysql';Data Source=localhost;User ID=root;Password=;Port=3306;SslMode=None;", pipeline1.ConnectString);

            Assert.Equal("MySqlFileEntityPipeline", entityPipelines[1].GetType().Name);
            Assert.Equal("ConsoleEntityPipeline", entityPipelines[2].GetType().Name);
            Assert.Equal("JsonFileEntityPipeline", entityPipelines[3].GetType().Name);

            var pipelines = spider.Pipelines.ToList();

            Assert.Equal(4, pipelines.Count);
            ModelPipeline pipeline = (ModelPipeline)pipelines[0];

            //entityPipelines = pipeline.GetEntityPipelines();
            //Assert.Equal(4, entityPipelines.Count);
            //pipeline1 = (MySqlEntityPipeline)entityPipelines[0];
            //Assert.Equal("test", pipeline1.GetSchema().Database);
            //Assert.Equal("table13", pipeline1.GetSchema().Name);

            using (MySqlConnection conn = new MySqlConnection("Database='mysql';Data Source=localhost;User ID=root;Password=;Port=3306;SslMode=None;"))
            {
                conn.Execute($"DROP table test.table12");
                conn.Execute($"DROP table test.table13");
            }
        }
Beispiel #9
0
        /// <summary>
        /// Create a spider
        /// </summary>
        /// <param name="identify"></param>
        /// <param name="site"></param>
        /// <param name="pageModelPipeline"></param>
        /// <param name="pageModels"></param>
        public OoSpider(string identify, Site site, IPageModelPipeline pageModelPipeline, params Type[] pageModels)
            : this(identify, ModelPageProcessor.Create(site, pageModels))
        {
            // Check ΪʲôҪ���һ��modelpipeline
            _modelPipeline = new ModelPipeline();

            AddPipeline(_modelPipeline);

            foreach (Type pageModel in pageModels)
            {
                if (pageModelPipeline != null)
                {
                    _modelPipeline.Put(pageModel, pageModelPipeline);
                }
                _pageModelTypes.Add(pageModel);
            }
        }
Beispiel #10
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);
            }
        }
Beispiel #11
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);
        }
Beispiel #12
0
        private void RunModelPipeline(MappingContext context, ModelProcessorSchema modelProcessorSchema)
        {
            var modelPipeline = new ModelPipeline();

            foreach (ProcessorSchema schema in modelProcessorSchema.Processors)
            {
                if (_processorFactory.TryGetProcessor(schema.Type, out IModelProcessor contextProcessor))
                {
                    modelPipeline.Add(contextProcessor, schema);
                }
            }

            var modelContext = new ModelContext(context, context.Input);

            modelPipeline.Run(modelContext);

            if (!modelContext.Faulted)
            {
                context.Input = modelContext.Context;
            }
        }
 public static ModelPipeline ClearModelRenderTargets(this ModelPipeline pipeline)
 {
     pipeline.Add(new ClearStage());
     return(pipeline);
 }