checkin
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / scene_standard_alphatest.h
index c2c479ac1b933c3f64f0ce02433a17433778c2cc..46c1976a7933631ca933439b49578fc4ee4e78cf 100644 (file)
@@ -102,6 +102,9 @@ static struct vg_shader _shader_scene_standard_alphatest = {
 "   int g_light_preview;\n"
 "   int g_shadow_samples;\n"
 "\n"
+"   int g_debug_indices;\n"
+"   int g_debug_complexity;\n"
+"\n"
 "   // g_time ?\n"
 "\n"
 "   //vec4 g_point_light_positions[32];\n"
@@ -442,35 +445,57 @@ static struct vg_shader _shader_scene_standard_alphatest = {
 "   vec4 light_dir_1    = texelFetch( uLightsArray, light_indices.y*3+2 );\n"
 "   vec4 light_dir_2    = texelFetch( uLightsArray, light_indices.z*3+2 );\n"
 "\n"
-"   //return vec3(fract(distance(light_co_0.xyz,aWorldCo)),\n"
-"   //            fract(distance(light_co_1.xyz,aWorldCo)),\n"
-"   //            fract(distance(light_co_2.xyz,aWorldCo)));\n"
-"\n"
-"  // return vec3(fract(light_indices.x * 0.125), fract(light_indices.y*0.125),\n"
-"  //             fract(light_indices.z * 0.125 ));\n"
-"\n"
-"   total_light += newlight_compute_spot\n"
-"                  ( \n"
-"                     wnormal, halfview,\n"
-"                     light_colour_0.rgb,\n"
-"                     light_co_0.xyz,\n"
-"                     light_dir_0\n"
-"                  ) * board_shadow;\n"
-"\n"
-"   total_light += newlight_compute_spot\n"
-"                  ( \n"
-"                     wnormal, halfview,\n"
-"                     light_colour_1.rgb,\n"
-"                     light_co_1.xyz,\n"
-"                     light_dir_1\n"
-"                  ) * board_shadow;\n"
-"   total_light += newlight_compute_spot\n"
-"                  ( \n"
-"                     wnormal, halfview,\n"
-"                     light_colour_2.rgb,\n"
-"                     light_co_2.xyz,\n"
-"                     light_dir_2\n"
-"                  ) * board_shadow;\n"
+"   if( g_debug_indices == 1 )\n"
+"   {\n"
+"      float rings = min( fract(distance(light_co_0.xyz,aWorldCo)),\n"
+"                      min( fract(distance(light_co_1.xyz,aWorldCo)),\n"
+"                           fract(distance(light_co_2.xyz,aWorldCo)) ) \n"
+"                        );\n"
+"               \n"
+"      return vec3(fract(light_indices.x * 0.125), fract(light_indices.y*0.125),\n"
+"                  fract(light_indices.z * 0.125 )) + (rings-0.5) * 0.25;\n"
+"   }\n"
+"\n"
+"   if( g_debug_complexity == 1 )\n"
+"   {\n"
+"      return vec3(1.0,0.0,0.0) * ( light_indices.w/3.0 );\n"
+"   }\n"
+"\n"
+"   if( light_indices.w >= 1 )\n"
+"   {\n"
+"      total_light += newlight_compute_spot\n"
+"                     ( \n"
+"                        wnormal, halfview,\n"
+"                        light_colour_0.rgb,\n"
+"                        light_co_0.xyz,\n"
+"                        light_dir_0\n"
+"                     ) * board_shadow \n"
+"                       * step( world.day_phase, light_colour_0.w );\n"
+"\n"
+"      if( light_indices.w >= 2 )\n"
+"      {\n"
+"         total_light += newlight_compute_spot\n"
+"                        ( \n"
+"                           wnormal, halfview,\n"
+"                           light_colour_1.rgb,\n"
+"                           light_co_1.xyz,\n"
+"                           light_dir_1\n"
+"                        ) * board_shadow\n"
+"                          * step( world.day_phase, light_colour_1.w );\n"
+"\n"
+"         if( light_indices.w >= 3 )\n"
+"         {\n"
+"            total_light += newlight_compute_spot\n"
+"                           ( \n"
+"                              wnormal, halfview,\n"
+"                              light_colour_2.rgb,\n"
+"                              light_co_2.xyz,\n"
+"                              light_dir_2\n"
+"                           ) * board_shadow\n"
+"                             * step( world.day_phase, light_colour_2.w );\n"
+"         }\n"
+"      }\n"
+"   }\n"
 "\n"
 "   vec3 fog_colour = scene_sky( -halfview, world );\n"
 "   \n"