X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=shaders%2Fscene_position.h;h=89669553cc90128f814b4fd2b17c630a991ad6ec;hb=791f807111a1f740f745c67db642aa7a8bee56e8;hp=5fed74774106ddcad531ee499cb0340b3bfd3640;hpb=e61356f70eddb79f05d7b9e329e91963ec74f817;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/shaders/scene_position.h b/shaders/scene_position.h index 5fed747..8966955 100644 --- a/shaders/scene_position.h +++ b/shaders/scene_position.h @@ -101,6 +101,9 @@ static struct vg_shader _shader_scene_position = { " 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" @@ -441,35 +444,57 @@ static struct vg_shader _shader_scene_position = { " 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"