chaos pt 1
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / scene_water_fast.h
index 318a37a6c9ac5153c2557c45cc36be25bcb4b1e5..1be092605d74466907f80ae2c3494b8d25679c06 100644 (file)
@@ -216,19 +216,15 @@ static struct vg_shader _shader_scene_water_fast = {
 "   return world_depth_sample( pos ) - ref_depth;\n"
 "}\n"
 "\n"
-"float shadow_sample( vec3 vdir )\n"
-"{\n"
-"   vec3 sample_pos = aWorldCo + vdir;\n"
-"   float height_sample = world_depth_sample( sample_pos );\n"
+"float shadow_sample( vec3 co ){\n"
+"   float height_sample = world_depth_sample( co );\n"
 "\n"
-"   float fdelta = height_sample - sample_pos.y;\n"
+"   float fdelta = height_sample - co.y;\n"
 "   return clamp( fdelta, 0.2, 0.4 )-0.2;\n"
 "}\n"
 "\n"
-"float newlight_compute_sun_shadow( vec3 dir )\n"
-"{\n"
-"   if( g_shadow_samples == 0 )\n"
-"   {\n"
+"float newlight_compute_sun_shadow( vec3 co, vec3 dir ){\n"
+"   if( g_shadow_samples == 0 ){\n"
 "      return 1.0;\n"
 "   }\n"
 "\n"
@@ -236,15 +232,15 @@ static struct vg_shader _shader_scene_water_fast = {
 "   float flength = g_shadow_length;\n"
 "\n"
 "   float famt = 0.0;\n"
-"   famt += shadow_sample((dir+vec3(-0.56,0.55, 0.30)*fspread)*flength*0.1);\n"
-"   famt += shadow_sample((dir+vec3( 0.80,0.68, 0.34)*fspread)*flength*0.2);\n"
-"   famt += shadow_sample((dir+vec3( 0.78,0.07,-0.06)*fspread)*flength*0.3);\n"
-"   famt += shadow_sample((dir+vec3(-0.59,0.07,-0.42)*fspread)*flength*0.4);\n"
+"   famt += shadow_sample(co+(dir+vec3(-0.56,0.55, 0.30)*fspread)*flength*0.1);\n"
+"   famt += shadow_sample(co+(dir+vec3( 0.80,0.68, 0.34)*fspread)*flength*0.2);\n"
+"   famt += shadow_sample(co+(dir+vec3( 0.78,0.07,-0.06)*fspread)*flength*0.3);\n"
+"   famt += shadow_sample(co+(dir+vec3(-0.59,0.07,-0.42)*fspread)*flength*0.4);\n"
 "\n"
-"   //famt+=shadow_sample((dir+vec3(-0.790,-0.933,-0.875)*fspread)*flength*0.5);\n"
-"   //famt+=shadow_sample((dir+vec3( 0.807,-0.690, 0.472)*fspread)*flength*0.6);\n"
-"   //famt+=shadow_sample((dir+vec3( 0.522,-0.379, 0.350)*fspread)*flength*0.7);\n"
-"   //famt+=shadow_sample((dir+vec3( 0.483, 0.201, 0.306)*fspread)*flength*0.8);\n"
+"   //famt+=shadow_sample(co+(dir+vec3(-0.790,-0.933,-0.875)*fspread)*flength*0.5);\n"
+"   //famt+=shadow_sample(co+(dir+vec3( 0.807,-0.690, 0.472)*fspread)*flength*0.6);\n"
+"   //famt+=shadow_sample(co+(dir+vec3( 0.522,-0.379, 0.350)*fspread)*flength*0.7);\n"
+"   //famt+=shadow_sample(co+(dir+vec3( 0.483, 0.201, 0.306)*fspread)*flength*0.8);\n"
 "\n"
 "   return 1.0 - famt;\n"
 "}\n"
@@ -332,8 +328,8 @@ static struct vg_shader _shader_scene_water_fast = {
 "   float fdist = length(halfview);\n"
 "   halfview /= fdist;\n"
 "\n"
-"   float world_shadow = newlight_compute_sun_shadow( g_sun_dir.xyz \n"
-"                                    * (1.0/(max(g_sun_dir.y,0.0)+0.2)) );\n"
+"   float world_shadow = newlight_compute_sun_shadow( \n"
+"               co, g_sun_dir.xyz * (1.0/(max(g_sun_dir.y,0.0)+0.2)) );\n"
 "\n"
 "   vec3 total_light = clearskies_lighting( \n"
 "                           normal, min( light_mask, world_shadow ), halfview );\n"