vec4 g_sunset_ambient;
vec4 g_sun_colour;
vec4 g_sun_dir;
+ vec4 g_board_0;
+ vec4 g_board_1;
float g_water_fog;
float g_time;
+ float g_realtime;
float g_shadow_length;
float g_shadow_spread;
float world_water_depth( vec3 pos )
{
- vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw;
float ref_depth = g_water_plane.y*g_water_plane.w;
- return texture( g_world_depth, depth_coord ).g - ref_depth;
+ return world_depth_sample( pos ) - ref_depth;
}
float shadow_sample( vec3 vdir )
float falloff = max( 0.0, 1.0-(dist2*light_co.w) );
- if( light_dir.w < 0.999999 )
- {
+ if( light_dir.w < 0.999999 ){
float spot_theta = max( 0.0, dot( light_delta, -light_dir.xyz ) );
falloff *= max( 0.0, (spot_theta - light_dir.w) / (1.0-light_dir.w) );
}
- return light_colour.rgb * attenuation * falloff;
+ return light_colour.rgb * attenuation * falloff
+ * step( g_day_phase, light_colour.w );
}
vec3 scene_calculate_packed_light_patch( uint packed_index,
vec3 l = vec3(0.0);
- if( light_count >= 1u )
- {
+ if( light_count >= 1u ){
int index_0 = int( ((packed_index >> 2u) & 0x3ffu) * 3u );
int index_1 = int( ((packed_index >> 12u) & 0x3ffu) * 3u );
int index_2 = int( ((packed_index >> 22u) & 0x3ffu) * 3u );
l += scene_calculate_light( index_0, halfview, co, normal );
- if( light_count >= 2u )
- {
+ if( light_count >= 2u ){
l += scene_calculate_light( index_1, halfview, co, normal );
- if( light_count >= 3u )
- {
+ if( light_count >= 3u ){
l += scene_calculate_light( index_2, halfview, co, normal );
}
}