add motion vectors to all shaders
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / common_world.glsl
index 4d9b0d3d6a7211f6cdb38499338264ab252ffc84..a394acb75b73724666528c640a0698b5ac66b882 100644 (file)
@@ -1,3 +1,5 @@
+layout (location = 0) out vec4 oColour;
+
 layout (std140) uniform ub_world_lighting
 {
    vec4 g_light_colours[3];
@@ -9,6 +11,7 @@ layout (std140) uniform ub_world_lighting
    float g_water_fog;
    int g_light_count;
    int g_light_preview;
+   int g_shadow_samples;
 };
 
 uniform sampler2D g_world_depth;
@@ -50,7 +53,7 @@ float world_depth_sample( vec3 pos )
 
 float shadow_sample( vec3 vdir )
 {
-   vec3 sample_pos = aCo + vdir;
+   vec3 sample_pos = aWorldCo + vdir;
    float height_sample = world_depth_sample( sample_pos );
 
    float fdelta = height_sample - sample_pos.y;
@@ -73,6 +76,11 @@ vec3 do_light_shadowing_old( vec3 vfrag )
 
 vec3 do_light_shadowing( vec3 vfrag )
 {
+   if( g_shadow_samples == 0 )
+   {
+      return vfrag;
+   }
+
    float fspread = g_light_colours[0].w;
    vec3  vdir = g_light_directions[0].xyz;
    float flength = g_light_directions[0].w;