change shader properties to be vg_msg based
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / scene_depth.fs
1 out vec4 FragColor;
2
3 uniform vec3 uCamera;
4 uniform vec3 uBoard0;
5 uniform vec3 uBoard1;
6
7 #include "light_clearskies_stddef.glsl"
8 #include "common_scene.glsl"
9
10 // Water blending
11 // ==============
12
13 float water_depth( vec3 pos, vec3 halfview )
14 {
15 vec3 pnorm = g_water_plane.xyz;
16 float pdist = g_water_plane.w;
17
18 float d = dot( pnorm, halfview );
19 float t = dot((pnorm*pdist - pos), pnorm) / d;
20
21 // TODO: Make g_water_fog a material param
22 return t * g_water_fog;
23 }
24
25 void main()
26 {
27 vec3 halfview = normalize( uCamera - aWorldCo );
28 float depth = water_depth( aWorldCo, halfview );
29 FragColor = vec4( depth, 0.0, 0.0, 0.0 );
30 }