mirror of
https://github.com/JetSetIlly/Gopher2600.git
synced 2024-05-10 09:24:07 -04:00
added TV saturation control
This commit is contained in:
parent
841547cfc0
commit
38690397c2
|
@ -95,6 +95,7 @@ const (
|
|||
Directory = '\uf07c'
|
||||
TVBrightness = '\uf185'
|
||||
TVContrast = '\uf042'
|
||||
TVSaturation = '\uf0e9'
|
||||
TVHue = '\uf043'
|
||||
)
|
||||
|
||||
|
|
|
@ -196,6 +196,7 @@ type tvColorShader struct {
|
|||
shader
|
||||
brightness int32
|
||||
contrast int32
|
||||
saturation int32
|
||||
hue int32
|
||||
}
|
||||
|
||||
|
@ -204,6 +205,7 @@ func newTVColorShader() shaderProgram {
|
|||
sh.createProgram(string(shaders.YFlipVertexShader), string(shaders.TVColorShader))
|
||||
sh.brightness = gl.GetUniformLocation(sh.handle, gl.Str("Brightness"+"\x00"))
|
||||
sh.contrast = gl.GetUniformLocation(sh.handle, gl.Str("Contrast"+"\x00"))
|
||||
sh.saturation = gl.GetUniformLocation(sh.handle, gl.Str("Saturation"+"\x00"))
|
||||
sh.hue = gl.GetUniformLocation(sh.handle, gl.Str("Hue"+"\x00"))
|
||||
return sh
|
||||
}
|
||||
|
@ -212,6 +214,7 @@ func (sh *tvColorShader) setAttributesArgs(env shaderEnvironment, prefs crtSeqPr
|
|||
sh.shader.setAttributes(env)
|
||||
gl.Uniform1f(sh.contrast, float32(prefs.Contrast))
|
||||
gl.Uniform1f(sh.brightness, float32(prefs.Brightness))
|
||||
gl.Uniform1f(sh.saturation, float32(prefs.Saturation))
|
||||
gl.Uniform1f(sh.hue, float32(prefs.Hue))
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,13 @@ void main()
|
|||
}
|
||||
adjust *= contrast;
|
||||
|
||||
// saturation
|
||||
adjust *= mat3(
|
||||
vec3(1, 0, 0),
|
||||
vec3(0, Saturation, 0),
|
||||
vec3(0, 0, Saturation)
|
||||
);
|
||||
|
||||
// hue
|
||||
float hue = 2 * PI * Hue;
|
||||
adjust *= mat3(
|
||||
|
|
|
@ -29,6 +29,8 @@ func (win *winPrefs) drawTV() {
|
|||
imgui.Spacing()
|
||||
win.drawContrast()
|
||||
imgui.Spacing()
|
||||
win.drawSaturation()
|
||||
imgui.Spacing()
|
||||
win.drawHue()
|
||||
}
|
||||
|
||||
|
@ -60,6 +62,20 @@ func (win *winPrefs) drawContrast() {
|
|||
}
|
||||
}
|
||||
|
||||
func (win *winPrefs) drawSaturation() {
|
||||
imgui.Text(fmt.Sprintf("%c Saturation", fonts.TVSaturation))
|
||||
|
||||
f := float32(win.img.crtPrefs.Saturation.Get().(float64))
|
||||
|
||||
minv := float32(0.1)
|
||||
maxv := float32(1.90)
|
||||
label := fmt.Sprintf("%.0f", 100*(f-minv)/(maxv-minv))
|
||||
|
||||
if imgui.SliderFloatV("##saturation", &f, minv, maxv, label, imgui.SliderFlagsNone) {
|
||||
win.img.crtPrefs.Saturation.Set(f)
|
||||
}
|
||||
}
|
||||
|
||||
func (win *winPrefs) drawHue() {
|
||||
imgui.Text(fmt.Sprintf("%c Hue", fonts.TVHue))
|
||||
|
||||
|
|
Loading…
Reference in a new issue