2021-02-17 04:35:19 +00:00
|
|
|
#version 450
|
2021-12-06 11:38:06 +00:00
|
|
|
|
2022-11-15 02:47:28 +00:00
|
|
|
layout (set = 1, binding = 0) uniform sampler2D Palette;
|
|
|
|
layout (set = 2, binding = 0) uniform sampler2DArray Skin;
|
2021-02-17 04:35:19 +00:00
|
|
|
|
|
|
|
layout (push_constant) uniform PushConstants {
|
|
|
|
layout (offset = 68)
|
2022-11-15 02:47:28 +00:00
|
|
|
uint colors;
|
2021-12-08 15:25:50 +00:00
|
|
|
vec4 base_color;
|
2021-02-17 04:35:19 +00:00
|
|
|
vec4 fog;
|
|
|
|
};
|
|
|
|
|
|
|
|
layout (location = 0) in vec2 st;
|
2021-02-25 04:46:33 +00:00
|
|
|
layout (location = 1) in vec4 position;
|
2021-02-17 04:35:19 +00:00
|
|
|
layout (location = 2) in vec3 normal;
|
|
|
|
|
|
|
|
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-17 04:35:19 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
main (void)
|
|
|
|
{
|
|
|
|
vec4 c;
|
2021-03-22 10:08:16 +00:00
|
|
|
vec4 e;
|
2021-12-17 03:20:32 +00:00
|
|
|
c = texture (Skin, vec3 (st, 0)) * base_color;
|
2022-11-15 04:09:41 +00:00
|
|
|
e = texture (Skin, vec3 (st, 1));
|
|
|
|
vec4 rows = unpackUnorm4x8(colors);
|
|
|
|
vec4 cmap = texture (Skin, vec3 (st, 2));
|
|
|
|
c += texture (Palette, vec2 (cmap.x, rows.x)) * cmap.y;
|
|
|
|
c += texture (Palette, vec2 (cmap.z, rows.y)) * cmap.w;
|
2021-02-17 04:35:19 +00:00
|
|
|
|
|
|
|
frag_color = c;
|
2021-03-22 10:08:16 +00:00
|
|
|
frag_emission = e;
|
2022-05-05 14:46:24 +00:00
|
|
|
frag_normal = vec4(normalize(normal), 1);
|
2021-02-25 04:46:33 +00:00
|
|
|
frag_position = position;
|
2021-02-17 04:35:19 +00:00
|
|
|
}
|