2021-02-19 02:14:54 +00:00
|
|
|
#version 450
|
|
|
|
|
2022-05-24 15:17:57 +00:00
|
|
|
layout (set = 2, binding = 0) uniform sampler2DArray Texture;
|
2021-02-19 02:14:54 +00:00
|
|
|
|
|
|
|
layout (push_constant) uniform PushConstants {
|
|
|
|
vec4 fog;
|
|
|
|
float time;
|
2022-05-21 08:48:45 +00:00
|
|
|
float alpha;
|
2021-02-19 02:14:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
layout (location = 0) in vec4 tl_st;
|
|
|
|
layout (location = 1) in vec3 direction;
|
|
|
|
layout (location = 2) in vec3 normal;
|
2021-02-25 04:46:33 +00:00
|
|
|
layout (location = 3) in vec4 position;
|
2022-05-26 23:12:21 +00:00
|
|
|
layout (location = 4) in vec4 color;
|
2021-02-19 02:14:54 +00:00
|
|
|
|
|
|
|
layout (location = 0) out vec4 frag_color;
|
2021-03-22 10:08:16 +00:00
|
|
|
layout (location = 1) out vec4 frag_emission;
|
|
|
|
layout (location = 2) out vec4 frag_normal;
|
|
|
|
layout (location = 3) out vec4 frag_position;
|
2021-02-19 02:14:54 +00:00
|
|
|
|
|
|
|
vec4
|
|
|
|
fogBlend (vec4 color)
|
|
|
|
{
|
|
|
|
float az = fog.a * gl_FragCoord.z / gl_FragCoord.w;
|
|
|
|
vec3 fog_color = fog.rgb;
|
|
|
|
float fog_factor = exp (-az * az);
|
|
|
|
|
|
|
|
return vec4 (mix (fog_color.rgb, color.rgb, fog_factor), color.a);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
main (void)
|
|
|
|
{
|
2021-03-22 10:08:16 +00:00
|
|
|
vec4 c = vec4 (0);
|
|
|
|
vec4 e;
|
2021-12-06 11:38:06 +00:00
|
|
|
vec3 t_st = vec3 (tl_st.xy, 0);
|
2021-12-08 12:11:36 +00:00
|
|
|
vec3 e_st = vec3 (tl_st.xy, 1);
|
|
|
|
vec2 l_st = vec2 (tl_st.zw);
|
2021-02-19 02:14:54 +00:00
|
|
|
|
2022-05-26 23:12:21 +00:00
|
|
|
c = texture (Texture, t_st) * color;
|
2021-12-17 03:20:32 +00:00
|
|
|
e = texture (Texture, e_st);
|
2021-02-19 02:14:54 +00:00
|
|
|
frag_color = c;//fogBlend (c);
|
2021-03-22 10:08:16 +00:00
|
|
|
frag_emission = e;
|
2021-02-19 02:14:54 +00:00
|
|
|
frag_normal = vec4 (normal, 0);
|
2021-02-25 04:46:33 +00:00
|
|
|
frag_position = position;
|
2021-02-19 02:14:54 +00:00
|
|
|
}
|