Exemple #1
0
        public override void Update()
        {
            base.Update();
            builder.Clear();

            UpdateFPS();

            SceneViewUI             sceneView = Root.Find <SceneViewUI>();
            ProgressiveRenderEngine engine    = sceneView?.engine;

            if (engine == null)
            {
                builder.Append("Missing Engine");
                AppendGap();
            }
            else if (engine.CurrentState == ProgressiveRenderEngine.State.rendering)
            {
                long   traceCount = engine.CurrentProfile.Scene.TraceCount;
                double rate       = traceCount / engine.Elapsed.TotalSeconds;

                builder.Append($"Rate: {rate:F2}");
                AppendGap();

                builder.Append($"Epoch: {engine.Epoch:N0}");
                AppendGap();
            }
            else
            {
                builder.Append("Engine Awaiting");
                AppendGap();
            }

            label.Text = builder.ToString();
        }
        public override void Update()
        {
            base.Update();

            SceneViewUI sceneView = Root.Find <SceneViewUI>();
            Camera      camera    = sceneView?.Profile.Scene?.camera;

            if (camera == null)
            {
                return;
            }

            if (Mouse.IsButtonPressed(Mouse.Button.Right))
            {
                Int2     mouse  = Mouse.GetPosition().As();
                Float4x4 matrix = camera.LocalToWorld;

                if (!lastEnabled)
                {
                    lastEnabled = true;
                    lastMouse   = mouse;
                }

                Int2 delta = mouse - lastMouse;

                Float2 input = new Int2
                               (
                    KeyDown(Keyboard.Key.D) - KeyDown(Keyboard.Key.A),
                    KeyDown(Keyboard.Key.W) - KeyDown(Keyboard.Key.S)
                               ).Normalized;

                Float3 movement = input.X_Y * (float)Root.application.DeltaTime;
                Float3 change   = camera.LocalToWorld.MultiplyDirection(movement);

                camera.Rotation += delta.YX_ * MouseSensitivity;
                camera.Position += change * MovementSpeed;

                lastMouse = mouse;

                if (matrix != camera.LocalToWorld)
                {
                    sceneView.RequestRedraw();
                }