2022-02-10 19:58:51 +08:00
|
|
|
package igwrap
|
|
|
|
|
|
|
|
import (
|
|
|
|
"edgaru089.ml/go/gl01/internal/util/itype"
|
|
|
|
"github.com/inkyblackness/imgui-go/v4"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Color converts non-premultiplied RGBA color into imgui.Vec4.
|
|
|
|
func Color(r, g, b, a uint8) imgui.Vec4 {
|
|
|
|
return imgui.Vec4{
|
|
|
|
X: float32(r) / 255,
|
|
|
|
Y: float32(g) / 255,
|
|
|
|
Z: float32(b) / 255,
|
|
|
|
W: float32(a) / 255,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-10 21:13:55 +08:00
|
|
|
// PackedColor converts RGBA to imgui.PackedColor.
|
|
|
|
func PackedColor(color itype.Vec4f) imgui.PackedColor {
|
|
|
|
return imgui.PackedColorFromVec4(Vec4(color))
|
|
|
|
}
|
|
|
|
|
2022-02-10 19:58:51 +08:00
|
|
|
// Vec2 converts itype.Vec2f to imgui.Vec2.
|
|
|
|
func Vec2(v itype.Vec2f) imgui.Vec2 {
|
|
|
|
return imgui.Vec2{X: v[0], Y: v[1]}
|
|
|
|
}
|
|
|
|
|
2022-02-10 21:13:55 +08:00
|
|
|
// Vec2f converts imgui.Vec2 to itype.Vec2f.
|
|
|
|
func Vec2f(v imgui.Vec2) itype.Vec2f {
|
|
|
|
return itype.Vec2f{v.X, v.Y}
|
|
|
|
}
|
|
|
|
|
2022-02-10 19:58:51 +08:00
|
|
|
// Vec4 converts itype.Vec4f to imgui.Vec4.
|
|
|
|
func Vec4(v itype.Vec4f) imgui.Vec4 {
|
|
|
|
return imgui.Vec4{X: v[0], Y: v[1], Z: v[2], W: v[3]}
|
|
|
|
}
|