refactor debug info, measure render times

This commit is contained in:
2022-02-21 12:24:05 +08:00
parent 057e8907a9
commit 4a9afb4246
6 changed files with 135 additions and 46 deletions

View File

@@ -9,6 +9,7 @@ import (
"edgaru089.ml/go/gl01/internal/igwrap/backend"
"edgaru089.ml/go/gl01/internal/io"
"edgaru089.ml/go/gl01/internal/render"
"edgaru089.ml/go/gl01/internal/util"
"edgaru089.ml/go/gl01/internal/util/itype"
"edgaru089.ml/go/gl01/internal/world"
"edgaru089.ml/go/gl01/internal/world/worldgen"
@@ -174,7 +175,8 @@ const airAccel = 0.1
// Update updates the game state, not necessarily in the main thread.
func (g *Game) Update(win *glfw.Window, delta time.Duration) {
backend.NewFrame()
imgui.ShowDemoWindow(nil)
clock := util.NewClock()
if !g.paused {
@@ -242,7 +244,12 @@ func (g *Game) Update(win *glfw.Window, delta time.Duration) {
g.player.SetSpeed(itype.Vec3d{})
}
io.Diagnostics.Times.Logic = clock.Restart()
imgui.ShowDemoWindow(nil)
g.imgui()
io.Diagnostics.Times.GUI = clock.Restart()
}
// Render, called with a OpenGL context, renders the game.