mat4 shd_eye_matrix;
};
-const bool use_reflection = false;
const bool use_environment_map = false;
uniform samplerCube environment;
uniform EnvMap
return texture(normal_map, texcoord.xy).xyz*2.0-1.0;
}
+vec4 get_environment_sample(vec3 direction)
+{
+ return texture(environment, direction);
+}
+
vec3 normal;
vec4 diffuse_sample;
vec3 reflect_dir = reflect(incident_dir, normal);
if(use_normal_map)
reflect_dir = eye_tbn_matrix*reflect_dir;
- vec3 result = vec3(0.0);
-
- if(use_environment_map)
- result += texture(environment, env_eye_matrix*reflect_dir).rgb*reflectivity;
- if(use_sky && use_specular)
- {
- float reflect_altitude = clamp(dot(reflect_dir, eye_sky_dir)-horizon_limit, -1.0, 0.0);
- float sky_specular_intensity = pow((1.0-reflect_altitude*reflect_altitude), material.shininess/2.0);
- result += sky_specular_intensity*sky_color.rgb;
- }
-
- return result;
+ return get_environment_sample(env_eye_matrix*reflect_dir).rgb;
}
vec4 singlepass_color()
else
final_color = singlepass_color();
- if(use_reflection)
+ if(use_environment_map)
final_color += vec4(singlepass_reflection(), 0.0);
if(use_fog)
{