mirror of https://github.com/mgba-emu/mgba.git
Merge 598b9e237b
into 92e10f31ea
This commit is contained in:
commit
45493beb8f
|
@ -0,0 +1,36 @@
|
||||||
|
varying vec2 texCoord;
|
||||||
|
uniform sampler2D tex;
|
||||||
|
uniform int enable;
|
||||||
|
uniform float reflectionBrightness;
|
||||||
|
uniform vec2 reflectionDistance;
|
||||||
|
uniform float lightBrightness;
|
||||||
|
|
||||||
|
const float speed = 2.0;
|
||||||
|
const float decay = 2.0;
|
||||||
|
const float coeff = 2.5;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
if(enable==1)
|
||||||
|
{
|
||||||
|
float sp = pow(speed, lightBrightness);
|
||||||
|
float dc = pow(decay, -lightBrightness);
|
||||||
|
float s = (sp - dc) / (sp + dc);
|
||||||
|
vec2 radius = (texCoord.st - vec2(0.5, 0.5)) * vec2(coeff * s);
|
||||||
|
radius = pow(abs(radius), vec2(4.0));
|
||||||
|
vec3 bleed = vec3(0.12, 0.14, 0.19);
|
||||||
|
bleed += (dot(radius, radius) + vec3(0.02, 0.03, 0.05)) * vec3(0.14, 0.18, 0.2);
|
||||||
|
|
||||||
|
vec4 color = texture2D(tex, texCoord);
|
||||||
|
color.rgb += pow(bleed, pow(vec3(lightBrightness), vec3(-0.5)));
|
||||||
|
|
||||||
|
vec4 reflection = texture2D(tex, texCoord - reflectionDistance);
|
||||||
|
color.rgb += reflection.rgb * reflectionBrightness;
|
||||||
|
color.a = 1.0;
|
||||||
|
gl_FragColor = color;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vec4 color = texture2D(tex, texCoord);
|
||||||
|
gl_FragColor = color;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
varying vec2 texCoord;
|
||||||
|
uniform sampler2D tex;
|
||||||
|
uniform vec2 texSize;
|
||||||
|
uniform float boundBrightness;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec4 color = texture2D(tex, texCoord);
|
||||||
|
if (int(mod(texCoord.s * texSize.x * 6.0, 6.0)) == 5 ||
|
||||||
|
int(mod(texCoord.t * texSize.y * 6.0, 6.0)) == 5)
|
||||||
|
{
|
||||||
|
color.rgb *= vec3(1.0, 1.0, 1.0) * boundBrightness;
|
||||||
|
}
|
||||||
|
gl_FragColor = color;
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
varying vec2 texCoord;
|
||||||
|
uniform sampler2D tex;
|
||||||
|
uniform vec2 texSize;
|
||||||
|
uniform float brightness;
|
||||||
|
uniform float subPixelDimming;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec4 color = texture2D(tex, texCoord);
|
||||||
|
vec3 subPixels[3];
|
||||||
|
float subPixelDimming = 1.0 - subPixelDimming;
|
||||||
|
subPixels[0] = vec3(1.0, subPixelDimming, subPixelDimming);
|
||||||
|
subPixels[1] = vec3(subPixelDimming, 1.0, subPixelDimming);
|
||||||
|
subPixels[2] = vec3(subPixelDimming, subPixelDimming, 1.0);
|
||||||
|
color.rgb *= brightness;
|
||||||
|
color.rgb *= subPixels[int(mod(texCoord.s * texSize.x * 3.0, 3.0))];
|
||||||
|
gl_FragColor = color;
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
[shader]
|
||||||
|
name=Custom LCD
|
||||||
|
author=endrift, Dominus Iniquitatis, EddyHg80
|
||||||
|
description=Configurable LCD emulation.
|
||||||
|
passes=3
|
||||||
|
|
||||||
|
[pass.0]
|
||||||
|
fragmentShader=customLCD-subPixels.fs
|
||||||
|
blend=1
|
||||||
|
width=-3
|
||||||
|
height=-3
|
||||||
|
|
||||||
|
[pass.0.uniform.brightness]
|
||||||
|
type=float
|
||||||
|
default=1.1
|
||||||
|
readableName=Brightness
|
||||||
|
|
||||||
|
[pass.0.uniform.subPixelDimming]
|
||||||
|
type=float
|
||||||
|
default=0.2
|
||||||
|
readableName=Sub pixel dimming
|
||||||
|
|
||||||
|
[pass.1]
|
||||||
|
fragmentShader=customLCD-pixelBounds.fs
|
||||||
|
blend=1
|
||||||
|
width=-6
|
||||||
|
height=-6
|
||||||
|
|
||||||
|
[pass.1.uniform.boundBrightness]
|
||||||
|
type=float
|
||||||
|
default=0.9
|
||||||
|
readableName=Pixel bound brightness
|
||||||
|
|
||||||
|
[pass.2]
|
||||||
|
fragmentShader=ags001-light.fs
|
||||||
|
blend=1
|
||||||
|
width=-6
|
||||||
|
height=-6
|
||||||
|
|
||||||
|
[pass.2.uniform.enable]
|
||||||
|
type=int
|
||||||
|
default=0
|
||||||
|
readableName=Enable AGS-001's pristine light and reflections
|
||||||
|
|
||||||
|
[pass.2.uniform.lightBrightness]
|
||||||
|
type=float
|
||||||
|
default=0.9
|
||||||
|
readableName=Light brightness
|
||||||
|
|
||||||
|
[pass.2.uniform.reflectionBrightness]
|
||||||
|
type=float
|
||||||
|
default=0.07
|
||||||
|
readableName=Reflection brightness
|
||||||
|
|
||||||
|
[pass.2.uniform.reflectionDistance]
|
||||||
|
type=float2
|
||||||
|
default[0]=0
|
||||||
|
default[1]=0.025
|
||||||
|
readableName=Reflection offset (x|y)
|
Loading…
Reference in New Issue