2
0
mirror of https://github.com/holub/mame synced 2025-04-19 15:11:37 +03:00

Modified crt-geom-deluxe to track the power-law fall-off for longer (up to 1024 frames). Ensured that the intensity falls to zero afterward.

Note that this is currently only compiled for GLSL.
This commit is contained in:
cgwg 2019-05-12 22:53:37 +02:00 committed by Ryan Holtz
parent 02e7569aa4
commit 1a9560f064
13 changed files with 14 additions and 4 deletions

View File

@ -17,7 +17,10 @@ void main()
vec3 cscrn = pow(screen.rgb, vec3_splat(u_gamma.x));
vec3 cphos = pow(phosphor.rgb, vec3_splat(u_gamma.x));
cphos *= vec3_splat( u_phosphor_amplitude.x / pow(255.0*phosphor.a,u_phosphor_power.x) );
// encode the upper 2 bits of the time elapsed in the lower 2 bits of b
float t = 255.0*phosphor.a + fract(phosphor.b*255.0/4.0)*1024.0;
cphos *= vec3_splat( u_phosphor_amplitude.x * pow(t,-u_phosphor_power.x) );
vec3 col = pow(cscrn + cphos, vec3_splat(1.0/u_gamma.x));

View File

@ -17,8 +17,15 @@ void main()
vec3 lum = vec3(0.299,0.587,0.114);
float bscrn = dot(pow(screen.rgb,vec3_splat(u_gamma.x)),lum);
float bphos = dot(pow(phosphor.rgb,vec3_splat(u_gamma.x)),lum);
//bscrn /= pow(1.0,u_phosphor_power.x);
bphos /= pow(1.0+255.0*phosphor.a,u_phosphor_power.x);
gl_FragColor = ( bscrn > bphos ? vec4(screen.rgb,1.0/255.0) : vec4(phosphor.rgb,phosphor.a+1.0/255.0) );
// encode the upper 2 bits of the time elapsed in the lower 2 bits of b
float t = 1.0 + 255.0*phosphor.a + fract(phosphor.b*255.0/4.0)*1024.0;
bphos = ( t > 1023.0 ? 0.0 : bphos*pow(t,-u_phosphor_power.x) );
gl_FragColor = ( bscrn >= bphos ?
vec4(screen.rg,floor(screen.b*255.0/4.0)*4.0/255.0,1.0/255.0)
: vec4(phosphor.rg,
(floor(phosphor.b*255.0/4.0)*4.0 + floor(t/256.0))/255.0,
fract(t/256.0)*256.0/255.0 ) );
}