mirror of https://github.com/mgba-emu/mgba.git
gba-color cleanups
This commit is contained in:
parent
c30352fde1
commit
30a308d04f
|
@ -3,38 +3,30 @@ uniform sampler2D tex;
|
||||||
uniform vec2 texSize;
|
uniform vec2 texSize;
|
||||||
|
|
||||||
uniform float darken_screen;
|
uniform float darken_screen;
|
||||||
uniform float target_gamma;
|
const float target_gamma = 2.2;
|
||||||
uniform float display_gamma;
|
const float display_gamma = 2.5;
|
||||||
uniform float sat;
|
const float sat = 1.0;
|
||||||
uniform float lum;
|
const float lum = 0.99;
|
||||||
uniform float contrast;
|
const float contrast = 1.0;
|
||||||
uniform float blr;
|
const vec3 bl = vec3(0.0, 0.0, 0.0);
|
||||||
uniform float blg;
|
const vec3 r = vec3(0.84, 0.09, 0.15);
|
||||||
uniform float blb;
|
const vec3 g = vec3(0.18, 0.67, 0.10);
|
||||||
uniform float r;
|
const vec3 b = vec3(0.0, 0.26, 0.73);
|
||||||
uniform float g;
|
|
||||||
uniform float b;
|
|
||||||
uniform float rg;
|
|
||||||
uniform float rb;
|
|
||||||
uniform float gr;
|
|
||||||
uniform float gb;
|
|
||||||
uniform float br;
|
|
||||||
uniform float bg;
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec4 screen = pow(texture2D(tex, texCoord), vec4(target_gamma + darken_screen)).rgba;
|
vec4 screen = pow(texture2D(tex, texCoord), vec4(target_gamma + darken_screen)).rgba;
|
||||||
vec4 avglum = vec4(0.5);
|
vec4 avglum = vec4(0.5);
|
||||||
screen = mix(screen, avglum, (1.0 - contrast));
|
screen = mix(screen, avglum, (1.0 - contrast));
|
||||||
|
|
||||||
mat4 color = mat4(r, rg, rb, 0.0,
|
mat4 color = mat4( r.r, r.g, r.b, 0.0,
|
||||||
gr, g, gb, 0.0,
|
g.r, g.g, g.b, 0.0,
|
||||||
br, bg, b, 0.0,
|
b.r, b.g, b.b, 0.0,
|
||||||
blr, blg, blb, 1.0);
|
bl.r, bl.g, bl.b, 1.0);
|
||||||
|
|
||||||
mat4 adjust = mat4((1.0 - sat) * 0.3086 + sat, (1.0 - sat) * 0.3086, (1.0 - sat) * 0.3086, 1.0,
|
mat4 adjust = mat4( (1.0 - sat) * 0.3086 + sat, (1.0 - sat) * 0.3086, (1.0 - sat) * 0.3086, 1.0,
|
||||||
(1.0 - sat) * 0.6094, (1.0 - sat) * 0.6094 + sat, (1.0 - sat) * 0.6094, 1.0,
|
(1.0 - sat) * 0.6094, (1.0 - sat) * 0.6094 + sat, (1.0 - sat) * 0.6094, 1.0,
|
||||||
(1.0 - sat) * 0.0820, (1.0 - sat) * 0.0820, (1.0 - sat) * 0.0820 + sat, 1.0,
|
(1.0 - sat) * 0.0820, (1.0 - sat) * 0.0820, (1.0 - sat) * 0.0820 + sat, 1.0,
|
||||||
0.0, 0.0, 0.0, 1.0);
|
0.0, 0.0, 0.0, 1.0);
|
||||||
color *= adjust;
|
color *= adjust;
|
||||||
screen = clamp(screen * lum, 0.0, 1.0);
|
screen = clamp(screen * lum, 0.0, 1.0);
|
||||||
screen = color * screen;
|
screen = color * screen;
|
||||||
|
|
|
@ -12,88 +12,3 @@ blend=1
|
||||||
type=float
|
type=float
|
||||||
default=0.5
|
default=0.5
|
||||||
readableName=Darken Screen
|
readableName=Darken Screen
|
||||||
|
|
||||||
[pass.0.uniform.target_gamma]
|
|
||||||
type=float
|
|
||||||
default=2.2
|
|
||||||
readableName=Target Gamma
|
|
||||||
|
|
||||||
[pass.0.uniform.display_gamma]
|
|
||||||
type=float
|
|
||||||
default=2.5
|
|
||||||
readableName=Display Gamma
|
|
||||||
|
|
||||||
[pass.0.uniform.sat]
|
|
||||||
type=float
|
|
||||||
default=1.0
|
|
||||||
readableName=Saturation
|
|
||||||
|
|
||||||
[pass.0.uniform.lum]
|
|
||||||
type=float
|
|
||||||
default=0.99
|
|
||||||
readableName=Luminance
|
|
||||||
|
|
||||||
[pass.0.uniform.contrast]
|
|
||||||
type=float
|
|
||||||
default=1.0
|
|
||||||
readableName=Constrast
|
|
||||||
|
|
||||||
[pass.0.uniform.blr]
|
|
||||||
type=float
|
|
||||||
default=0.0
|
|
||||||
readableName=Black's Red Tint
|
|
||||||
|
|
||||||
[pass.0.uniform.blg]
|
|
||||||
type=float
|
|
||||||
default=0.0
|
|
||||||
readableName=Black's Green Tint
|
|
||||||
|
|
||||||
[pass.0.uniform.blb]
|
|
||||||
type=float
|
|
||||||
default=0.0
|
|
||||||
readableName=Black's Blue Tint
|
|
||||||
|
|
||||||
[pass.0.uniform.r]
|
|
||||||
type=float
|
|
||||||
default=0.84
|
|
||||||
readableName=Red's Intensity
|
|
||||||
|
|
||||||
[pass.0.uniform.g]
|
|
||||||
type=float
|
|
||||||
default=0.67
|
|
||||||
readableName=Green's Intensity
|
|
||||||
|
|
||||||
[pass.0.uniform.b]
|
|
||||||
type=float
|
|
||||||
default=0.73
|
|
||||||
readableName=Blue's Intensity
|
|
||||||
|
|
||||||
[pass.0.uniform.rg]
|
|
||||||
type=float
|
|
||||||
default=0.09
|
|
||||||
readableName=Red's Green Tint
|
|
||||||
|
|
||||||
[pass.0.uniform.rb]
|
|
||||||
type=float
|
|
||||||
default=0.15
|
|
||||||
readableName=Red's Blue Tint
|
|
||||||
|
|
||||||
[pass.0.uniform.gr]
|
|
||||||
type=float
|
|
||||||
default=0.18
|
|
||||||
readableName=Green's Red Tint
|
|
||||||
|
|
||||||
[pass.0.uniform.gb]
|
|
||||||
type=float
|
|
||||||
default=0.10
|
|
||||||
readableName=Green's Blue Tint
|
|
||||||
|
|
||||||
[pass.0.uniform.br]
|
|
||||||
type=float
|
|
||||||
default=0.0
|
|
||||||
readableName=Blue's Red Tint
|
|
||||||
|
|
||||||
[pass.0.uniform.bg]
|
|
||||||
type=float
|
|
||||||
default=0.26
|
|
||||||
readableName=Blue's Green Tint
|
|
Loading…
Reference in New Issue