segmented render time display

This commit is contained in:
2022-02-22 14:28:35 +08:00
parent e2717aaaa9
commit 3595c32ae5
3 changed files with 63 additions and 3 deletions

View File

@@ -1,6 +1,8 @@
package igwrap
import (
"math"
"edgaru089.ml/go/gl01/internal/util/itype"
"github.com/inkyblackness/imgui-go/v4"
)
@@ -20,6 +22,17 @@ func PackedColor(color itype.Vec4f) imgui.PackedColor {
return imgui.PackedColorFromVec4(Vec4(color))
}
// UnpackedColor unpacks a color to RGBA.
func UnpackedColor(color imgui.PackedColor) itype.Vec4f {
r, g, b, a := color.RGBA()
return itype.Vec4f{
float32(r) / float32(math.MaxUint32),
float32(g) / float32(math.MaxUint32),
float32(b) / float32(math.MaxUint32),
float32(a) / float32(math.MaxUint32),
}
}
// Vec2 converts itype.Vec2f to imgui.Vec2.
func Vec2(v itype.Vec2f) imgui.Vec2 {
return imgui.Vec2{X: v[0], Y: v[1]}