Spot started

This commit is contained in:
Confideo-IOM
2026-08-04 22:40:48 +01:00
parent f51b435a9d
commit 6d7d7571b5
48 changed files with 1086 additions and 1222 deletions
@@ -321,12 +321,12 @@ float SampleShadow(vec4 frag_clip_space, sampler2DArray sampler_shadow_map, uint
vec3 CalculateDirectionalShadow(vec4 world_pos, uint shadow_idx, vec3 normal, vec3 light_dir, vec3 viewer_pos)
{
float shadow = 0;
float shadow = 1;
//measure the distance of the fragment from the light
float frag_distance = abs(length(viewer_pos - world_pos.xyz));
uint shadow_trans_idx = 5;
uint shadow_trans_idx = 6;
uint ignore_shadow = 0;
//Work out which shadowmap is appropriate for this distance
for(uint i = 0; i < 6; i++)
@@ -340,7 +340,7 @@ vec3 CalculateDirectionalShadow(vec4 world_pos, uint shadow_idx, vec3 normal, ve
break;
}
}
if(ignore_shadow == 1)
{
vec4 translated_pixel = shadows[shadow_idx].light_space_proj[shadow_trans_idx] *
@@ -348,21 +348,29 @@ vec3 CalculateDirectionalShadow(vec4 world_pos, uint shadow_idx, vec3 normal, ve
world_pos;
uvec2 shadow_handle = textures[shadows[shadow_idx].shadow_texture_id];
shadow = 1.0 - SampleShadow(translated_pixel, sampler2DArray(shadow_handle), shadow_trans_idx, normal, light_dir);
}
return vec3(shadow);
//return 1.0 - shadow;
if(shadow_trans_idx == 0)
{
return vec3(1,0,0) * shadow;
}
if(shadow_trans_idx == 1)
{
return vec3(0,1,0) * shadow;
return vec3(1,1,0) * shadow;
}
if(shadow_trans_idx == 2)
{
return vec3(0,0,1) * shadow;
return vec3(0.5,0.5,1) * shadow;
}
if(shadow_trans_idx == 3)
{
return vec3(1,0,1) * shadow;
}
if(shadow_trans_idx == 4)
{
return vec3(1,1,1) * shadow;
}
return vec3(0,1,1) * shadow;
}