DonkeyKong64 grind crash
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / scene_font.fs
1 uniform sampler2D uTexGarbage; // unused
2 uniform sampler2D uTexMain; // unused
3 uniform vec3 uCamera;
4 uniform float uTime;
5 uniform float uOpacity;
6 uniform float uColourize;
7
8 #include "common_scene.glsl"
9 #include "motion_vectors_fs.glsl"
10
11 vec3 pal( float t ){
12 vec3 a = vec3(0.30,0.3,0.3);
13 vec3 b = vec3(0.8);
14 vec3 c = vec3(0.28,0.3,0.4);
15 vec3 d = vec3(0.00,0.1,0.1);
16 return a + b*cos( 6.28318*(c*t+d) );
17 }
18
19 void main(){
20 compute_motion_vectors();
21 vec3 vfrag = vec3(0.5,0.5,0.5);
22 vec3 qnorm = aNorm.xyz;
23
24 //vec4 vsamplemain = texture( uTexMain, aUv );
25 //vfrag = vsamplemain.rgb;
26
27 vec4 spread0 = uTime*0.0002*vec4( 17.3,-19.6, 23.2,-47.7 );
28 vec4 spread1 = uTime*0.0002*vec4( -13.3, 12.6,-28.2, 14.7 );
29
30 vec2 p = aCo.xy + vec2(0.3);
31 float a = atan( p.y/p.x );
32 vec4 v0 = step( vec4(0.5), fract(vec4(a) + spread0) );
33 vec4 v1 = step( vec4(0.5), fract(vec4(a) + spread1) );
34
35 float d = ( v0.x+v0.y+v0.z+v0.w +
36 v1.x+v1.y+v1.z+v1.w ) * 0.125;
37
38 float dither = fract(dot(vec2(171.0,231.0),gl_FragCoord.xy)/71.0);
39 float x = d*0.8+length(p)*0.3;
40 x = (floor(x*8.0) + step(dither, fract(x * 8.0))) / 8.0;
41
42 if( x + (uOpacity*2.0-1.0) < 0.5 )
43 discard;
44
45 vfrag = mix( vec3(x), pal( x ), uColourize );
46
47 if( g_light_preview == 1 ){
48 vfrag = vec3(0.5);
49 }
50
51 vfrag = scene_compute_lighting( vfrag, qnorm, aWorldCo );
52 oColour = vec4( vfrag, 1.0 );
53 }