import msp_interface;
import shadow;
-layout(set=0) uniform EnvMap
-{
- mat3 env_world_matrix;
-};
-
layout(set=1) uniform sampler2D normal_map;
-layout(set=0) uniform samplerCube environment_map;
-layout(set=0) uniform samplerCube irradiance_map;
layout(constant_id=auto) const bool use_instancing = false;
layout(constant_id=auto) const bool use_normal_map = false;
return IncomingLight(rel_pos/d, light_sources[index].color*attenuation);
}
-virtual vec3 get_environment_sample(vec3 direction, float roughness)
-{
- float lod = (2-roughness)*roughness*(textureQueryLevels(environment_map)-1);
- return textureLod(environment_map, env_world_matrix*direction, lod).rgb;
-}
-
-virtual vec3 get_reflection(vec3 normal, vec3 look)
-{
- vec3 reflect_dir = reflect(look, normal);
- return get_environment_sample(reflect_dir, 0.0);
-}
-
-virtual vec3 get_irradiance_sample(vec3 normal)
-{
- return texture(irradiance_map, env_world_matrix*normal).rgb;
-}
-
vec3 apply_fog(vec3 color)
{
float fog_value = exp(fog_coord*fog_density);
--- /dev/null
+layout(set=0) uniform EnvMap
+{
+ mat3 env_world_matrix;
+};
+
+layout(set=0) uniform samplerCube environment_map;
+layout(set=0) uniform samplerCube irradiance_map;
+
+#pragma MSP stage(fragment)
+virtual vec3 get_environment_sample(vec3 direction, float roughness)
+{
+ float lod = (2-roughness)*roughness*(textureQueryLevels(environment_map)-1);
+ return textureLod(environment_map, env_world_matrix*direction, lod).rgb;
+}
+
+virtual vec3 get_reflection(vec3 normal, vec3 look)
+{
+ vec3 reflect_dir = reflect(look, normal);
+ return get_environment_sample(reflect_dir, 0.0);
+}
+
+virtual vec3 get_irradiance_sample(vec3 normal)
+{
+ return texture(irradiance_map, env_world_matrix*normal).rgb;
+}
+