rescaling of the timebars
This commit is contained in:
parent
f1ebbab5d3
commit
5d4acbfc43
@ -14,13 +14,13 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
timebarN = 700
|
timebarN = 700
|
||||||
timebarScale = 128
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
colorset = [...]imgui.PackedColor{4289753676, 4283598045, 4285048917, 4283584196, 4289950337, 4284512403, 4291005402, 4287401100, 4285839820, 4291671396}
|
colorset = [...]imgui.PackedColor{4289753676, 4283598045, 4285048917, 4283584196, 4289950337, 4284512403, 4291005402, 4287401100, 4285839820, 4291671396}
|
||||||
timebars [timebarN][]int // height of each bar set
|
timebars [timebarN][]int // height of each bar set
|
||||||
timebari int
|
timebari int
|
||||||
|
timebarScale int = 64
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *Game) renderDebugInfo() {
|
func (g *Game) renderDebugInfo() {
|
||||||
@ -41,11 +41,23 @@ func (g *Game) renderDebugInfo() {
|
|||||||
igwrap.TextBackgroundV(colorset[3], pad, "Lighting")
|
igwrap.TextBackgroundV(colorset[3], pad, "Lighting")
|
||||||
imgui.SameLine()
|
imgui.SameLine()
|
||||||
igwrap.TextBackgroundV(colorset[4], pad, "Postfx")
|
igwrap.TextBackgroundV(colorset[4], pad, "Postfx")
|
||||||
|
imgui.SameLine()
|
||||||
|
igwrap.TextBackground("[Hover]")
|
||||||
|
if imgui.IsItemHoveredV(imgui.HoveredFlagsAllowWhenDisabled) {
|
||||||
|
_, wheely := imgui.CurrentIO().MouseWheel()
|
||||||
|
if math.Abs(float64(wheely)) > 1e-3 {
|
||||||
|
if wheely > 0 {
|
||||||
|
timebarScale = util.Mini(timebarScale*2, 128)
|
||||||
|
} else { // < 0
|
||||||
|
timebarScale = util.Maxi(timebarScale/2, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
isize := asset.WorldTextureAtlas.ImageSize
|
isize := asset.WorldTextureAtlas.ImageSize
|
||||||
igwrap.TextBackground("Texture Atlas Size: (%dx%d)", isize[0], isize[1])
|
igwrap.TextBackground("Texture Atlas Size: (%dx%d)", isize[0], isize[1])
|
||||||
imgui.SameLine()
|
imgui.SameLine()
|
||||||
igwrap.TextBackground("[Hover]")
|
igwrap.TextBackground("[Scroll]")
|
||||||
if imgui.IsItemHoveredV(imgui.HoveredFlagsAllowWhenDisabled) {
|
if imgui.IsItemHoveredV(imgui.HoveredFlagsAllowWhenDisabled) {
|
||||||
_, wheely := imgui.CurrentIO().MouseWheel()
|
_, wheely := imgui.CurrentIO().MouseWheel()
|
||||||
if math.Abs(float64(wheely)) > 1e-3 {
|
if math.Abs(float64(wheely)) > 1e-3 {
|
||||||
@ -79,11 +91,11 @@ func (g *Game) renderDebugInfo() {
|
|||||||
|
|
||||||
// Push the next bar
|
// Push the next bar
|
||||||
timebars[timebari] = []int{
|
timebars[timebari] = []int{
|
||||||
int(io.Diagnostics.Times.RenderPasses.Depthmap.Nanoseconds() * timebarScale / 1024 / 1024),
|
int(io.Diagnostics.Times.RenderPasses.Depthmap.Nanoseconds()),
|
||||||
int(io.Diagnostics.Times.RenderPasses.Geometry.Nanoseconds() * timebarScale / 1024 / 1024),
|
int(io.Diagnostics.Times.RenderPasses.Geometry.Nanoseconds()),
|
||||||
int(io.Diagnostics.Times.RenderPasses.SSAO.Nanoseconds() * timebarScale / 1024 / 1024),
|
int(io.Diagnostics.Times.RenderPasses.SSAO.Nanoseconds()),
|
||||||
int(io.Diagnostics.Times.RenderPasses.Lighting.Nanoseconds() * timebarScale / 1024 / 1024),
|
int(io.Diagnostics.Times.RenderPasses.Lighting.Nanoseconds()),
|
||||||
int(io.Diagnostics.Times.RenderPasses.Postfx.Nanoseconds() * timebarScale / 1024 / 1024),
|
int(io.Diagnostics.Times.RenderPasses.Postfx.Nanoseconds()),
|
||||||
}
|
}
|
||||||
timebari++
|
timebari++
|
||||||
if timebari >= len(timebars) {
|
if timebari >= len(timebars) {
|
||||||
@ -96,6 +108,7 @@ func (g *Game) renderDebugInfo() {
|
|||||||
for i, l := range timebars {
|
for i, l := range timebars {
|
||||||
ex := 0
|
ex := 0
|
||||||
for j, d := range l {
|
for j, d := range l {
|
||||||
|
d = d * timebarScale / 1024 / 1024
|
||||||
dl.AddLine(imgui.Vec2{X: float32(i), Y: float32(size[1] - ex)}, imgui.Vec2{X: float32(i), Y: float32(size[1] - ex - d)}, colorset[j])
|
dl.AddLine(imgui.Vec2{X: float32(i), Y: float32(size[1] - ex)}, imgui.Vec2{X: float32(i), Y: float32(size[1] - ex - d)}, colorset[j])
|
||||||
ex += d
|
ex += d
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user