コード例 #1
0
ファイル: Demo.cs プロジェクト: sachgits/Myre
        public override void Update(GameTime gameTime)
        {
            var keyboard = Keyboard.GetState();

            if (keyboard.IsKeyDown(Keys.D1))
            {
                ssaoPlan.Apply();
            }
            else if (keyboard.IsKeyDown(Keys.D3))
            {
                edgeDetectPlan.Apply();
            }
            else if (keyboard.IsKeyDown(Keys.D4))
            {
                lightingPlan.Apply();
            }
            else
            {
                fullPlan.Apply();
            }

            if (keyboard.IsKeyDown(Keys.D2))
            {
                ssaoIntensity.Value = 0;
            }
            else
            {
                ssaoIntensity.Value = 20;
            }

            scene.Update(gameTime);
            base.Update(gameTime);
        }
コード例 #2
0
ファイル: Demo.cs プロジェクト: sachgits/Myre
        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;
        }
コード例 #3
0
ファイル: Demo.cs プロジェクト: martindevans/Myre
        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;
        }