Beispiel #1
0
        public void OnGui()
        {
            if (ImGui.Begin($@"Viewport##{_vpid}", ImGuiWindowFlags.NoBackground | ImGuiWindowFlags.NoNav))
            {
                var p     = ImGui.GetWindowPos();
                var s     = ImGui.GetWindowSize();
                var newvp = new Veldrid.Rectangle((int)p.X, (int)p.Y + 3, (int)s.X, (int)s.Y - 3);
                ResizeViewport(_device, newvp);
                if (InputTracker.GetMouseButtonDown(MouseButton.Right) && MouseInViewport())
                {
                    ImGui.SetWindowFocus();
                }
                _canInteract = ImGui.IsWindowFocused();
                _vpvisible   = true;
            }
            ImGui.End();

            if (ImGui.Begin($@"Profiling##{_vpid}"))
            {
                ImGui.Text($@"Cull time: {_renderScene.OctreeCullTime} ms");
                ImGui.Text($@"Work creation time: {_renderScene.CPUDrawTime} ms");
                ImGui.Text($@"Scene Render CPU time: {_viewPipeline.CPURenderTime} ms");
                ImGui.Text($@"Visible objects: {_renderScene.RenderObjectCount}");
                ImGui.Text($@"Vertex Buffers Size: {Scene.Renderer.GeometryBufferAllocator.TotalVertexFootprint / 1024 / 1024} MB");
                ImGui.Text($@"Index Buffers Size: {Scene.Renderer.GeometryBufferAllocator.TotalIndexFootprint / 1024 / 1024} MB");
                ImGui.Text($@"FLVER Read Caches: {Resource.FlverResource.CacheCount}");
                ImGui.Text($@"FLVER Read Caches Size: {Resource.FlverResource.CacheFootprint / 1024 / 1024} MB");
                //ImGui.Text($@"Selected renderable:  { _viewPipeline._pickingEntity }");
            }
            ImGui.End();
        }
Beispiel #2
0
        public void ResizeViewport(GraphicsDevice device, Veldrid.Rectangle newvp)
        {
            PrevWidth  = Width;
            PrevHeight = Height;
            Width      = newvp.Width;
            Height     = newvp.Height;
            X          = newvp.X;
            Y          = newvp.Y;
            _worldView.UpdateBounds(newvp);
            float depth = device.IsDepthRangeZeroToOne ? 0 : 1;

            _renderViewport = new Veldrid.Viewport(newvp.X, newvp.Y, Width, Height, depth, 1.0f - depth);
        }