- float shadow_sample = texture(shadow_map, shadow_coord);
- return mix(1.0, shadow_sample, shadow_darkness);
+ int type = shadows[index].type;
+ vec3 shadow_coord;
+ if(type==1)
+ {
+ shadow_coord = (shd_world_matrix[shadows[index].matrix_index]*world_pos).xyz;
+ shadow_coord.z -= shadows[index].bias;
+ }
+ else
+ return 1.0;
+
+ if(shadow_coord.x<0 || shadow_coord.x>1 || shadow_coord.y<0 || shadow_coord.y>1)
+ return 1.0;
+
+ vec4 region = shadows[index].region;
+ float shadow_sample = texture(shadow_map, vec3(shadow_coord.xy*region.zw+region.xy, shadow_coord.z));
+ return mix(1.0, shadow_sample, shadows[index].darkness);