add motion vectors to all shaders
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / std_alphatest.fs
1 uniform sampler2D uTexGarbage;
2 uniform sampler2D uTexMain;
3 uniform vec3 uCamera;
4 uniform vec4 uPlane;
5
6 in vec4 aColour;
7 in vec2 aUv;
8 in vec3 aNorm;
9 in vec3 aCo;
10 in vec3 aWorldCo;
11
12 #include "common_world.glsl"
13 #include "motion_vectors_fs.glsl"
14
15 void main()
16 {
17 compute_motion_vectors();
18
19 vec3 vfrag = vec3(0.5,0.5,0.5);
20 vec4 vsamplemain = texture( uTexMain, aUv );
21 vec3 qnorm = normalize(aNorm);
22
23 if( vsamplemain.a < 0.15 )
24 discard;
25
26 vfrag = vsamplemain.rgb;
27
28 if( g_light_preview == 1 )
29 {
30 vfrag = vec3(0.5);
31 }
32
33 // Lighting
34 vec3 halfview = uCamera - aWorldCo;
35 float fdist = length( halfview );
36 halfview /= fdist;
37
38 vfrag = do_light_diffuse( vfrag, qnorm );
39 vfrag = do_light_spec( vfrag, qnorm, halfview, 0.1 );
40 vfrag = do_light_shadowing( vfrag );
41 vfrag = apply_fog( vfrag, fdist );
42
43 oColour = vec4(vfrag, 1.0);
44 }