Exemple #1
0
        protected override void BeginTransitionOn()
        {
            _scene = _kernel.Get<TestScene>();

            _renderer = _scene.Scene.GetService<Renderer>();

            _fullPlan = _renderer.StartPlan()
                               .Then<GeometryBufferComponent>()
                               .Then<EdgeDetectComponent>()
                               .Then<Ssao>()
                               .Then<LightingComponent>()
                               .Then<RestoreDepthPhase>()
                               .Then<TranslucentComponent>()
                               .Then<ToneMapComponent>()
                               .Then<AntiAliasComponent>()
                               .Show("antialiased");

            _noAaPlan = _renderer.StartPlan()
                               .Then<GeometryBufferComponent>()
                               .Then<EdgeDetectComponent>()
                               .Then<Ssao>()
                               .Then<LightingComponent>()
                               .Then<RestoreDepthPhase>()
                               .Then<TranslucentComponent>()
                               .Then<ToneMapComponent>()
                               .Show("tonemapped");

            base.OnShown();
        }
Exemple #2
0
        public override void End(Renderer renderer)
        {
            base.End(renderer);

            //Restore previous plan
            if (_previousPlan != null)
                _previousPlan.Apply();
            _previousPlan = null;
        }
Exemple #3
0
        public override void OnShown()
        {
            scene = kernel.Get <TestScene>();

            var renderer = scene.Scene.GetService <Renderer>();

            ssaoIntensity = renderer.Data.Get <float>("ssao_intensity");

            fullPlan = renderer.StartPlan()
                       .Then <GeometryBufferComponent>()
                       .Then <EdgeDetectComponent>()
                       .Then <Ssao>()
                       .Then <LightingComponent>()
                       .Then <ToneMapComponent>()
                       .Then <ParticleComponent>();

            ssaoPlan = renderer.StartPlan()
                       .Then <GeometryBufferComponent>()
                       .Then <Ssao>()
                       .Show("ssao");

            lightingPlan = renderer.StartPlan()
                           .Then <GeometryBufferComponent>()
                           .Then <Ssao>()
                           .Then <LightingComponent>()
                           .Then <ParticleComponent>();
            //.Show("lightbuffer");

            edgeDetectPlan = renderer.StartPlan()
                             .Then <GeometryBufferComponent>()
                             .Then <EdgeDetectComponent>()
                             .Show("edges");

            fullPlan.Apply();

            base.OnShown();

            //var game = kernel.Get<TestGame>();
            game.DisplayUI = true;
            //game.IsFixedTimeStep = true;
        }
Exemple #4
0
        public override void Begin(Renderer renderer)
        {
            base.Begin(renderer);

            //Get or create a plan for this renderer
            RenderPlan plan;
            if (!_plans.TryGetValue(renderer, out plan))
            {
                plan = CreatePlan(renderer);
                _plans[renderer] = plan;
            }

            //Cache plan which is already applied
            _previousPlan = renderer.Plan;

            //If a null plan is returned use the default renderer plan
            if (plan == null)
                return;

            //Apply new plan
            plan.Apply();
        }
Exemple #5
0
        protected override void BeginTransitionOn()
        {
            _scene = _kernel.Get<TestScene>();

            var particleEntityDesc = _scene.Scene.Kernel.Get<EntityDescription>();
            particleEntityDesc.AddProperty(new TypedName<Vector3>("position"));
            particleEntityDesc.AddBehaviour<ParticleEmitter>();
            var entity = particleEntityDesc.Create();
            entity.GetProperty(new TypedName<Vector3>("position")).Value = Vector3.Zero;
            NamedBoxCollection initData = new NamedBoxCollection();
            initData.Set(new TypedName<ParticleEmitterDescription>("particlesystem"), _content.Load<ParticleEmitterDescription>("Particles/TestEmitter1"));
            _scene.Scene.Add(entity, initData);

            var renderer = _scene.Scene.GetService<Renderer>();

            _ssaoIntensity = renderer.Data.GetOrCreate(new TypedName<float>("ssao_intensity"));

            _fullPlan = renderer.StartPlan()
                                .Then<GeometryBufferComponent>()
                                .Then<EdgeDetectComponent>()
                                .Then<Ssao>()
                                .Then<LightingComponent>()
                                .Then<DeferredTransparency>()
                                //.Then<RestoreDepthPhase>()
                                //.Then<TranslucentComponent>()
                                .Then<ToneMapComponent>()
                                .Then<AntiAliasComponent>();

            _ssaoPlan = renderer.StartPlan()
                .Then<GeometryBufferComponent>()
                .Then<EdgeDetectComponent>()
                .Then<Ssao>()
                .Show("ssao");

            _lightingPlan = renderer.StartPlan()
                .Then<GeometryBufferComponent>()
                .Then<Ssao>()
                .Then<LightingComponent>()
                .Show("directlighting");

            _edgeDetectPlan = renderer.StartPlan()
                .Then<GeometryBufferComponent>()
                .Then<EdgeDetectComponent>()
                .Show("edges");

            _normalPlan = renderer.StartPlan()
                .Then<GeometryBufferComponent>()
                .Then<LightingComponent>()
                .Then<DeferredTransparency>()
                .Then(new AntiAliasComponent("gbuffer_normals"))
                .Show("antialiased");

            _depthPlan = renderer.StartPlan()
                .Then<GeometryBufferComponent>()
                .Then<LightingComponent>()
                .Then<DeferredTransparency>()
                .Show("gbuffer_depth");

            _diffusePlan = renderer.StartPlan()
                .Then<GeometryBufferComponent>()
                .Then<LightingComponent>()
                .Then<DeferredTransparency>()
                .Show("gbuffer_diffuse");

            _noAaPlan = renderer.StartPlan()
                               .Then<GeometryBufferComponent>()
                               .Then<EdgeDetectComponent>()
                               .Then<Ssao>()
                               .Then<LightingComponent>()
                               .Then<ToneMapComponent>()
                               .Show("tonemapped");

            _fullPlan.Apply();

            base.BeginTransitionOn();

            //var game = kernel.Get<TestGame>();
            _game.DisplayUI = true;
            //game.IsFixedTimeStep = true;
        }