2023-03-13 11:41:23 +08:00
|
|
|
#version 460 core
|
2023-03-16 09:34:42 +08:00
|
|
|
#extension GL_EXT_nonuniform_qualifier : require
|
2023-03-13 11:41:23 +08:00
|
|
|
|
|
|
|
layout (location = 0) out vec4 fragColor;
|
|
|
|
|
2023-03-16 09:34:42 +08:00
|
|
|
layout (set = 0, binding = 1) uniform sampler2D textures[]; // for textures (global)
|
|
|
|
|
2023-03-13 11:41:23 +08:00
|
|
|
// between shader stages
|
|
|
|
layout(location = 0) in struct
|
|
|
|
{
|
|
|
|
vec2 uv; // location = 0
|
|
|
|
} In;
|
|
|
|
|
2023-03-16 09:34:42 +08:00
|
|
|
// material stuff
|
|
|
|
layout(location = 1) flat in struct
|
|
|
|
{
|
|
|
|
uint textureIndex;
|
|
|
|
} InFlat;
|
|
|
|
|
|
|
|
|
2023-03-13 11:41:23 +08:00
|
|
|
void main ()
|
|
|
|
{
|
2023-03-16 09:34:42 +08:00
|
|
|
fragColor = vec4 (texture(textures [nonuniformEXT(InFlat.textureIndex)], In.uv));
|
|
|
|
if (fragColor.a < 0.01f)
|
|
|
|
discard;
|
2023-03-13 11:41:23 +08:00
|
|
|
}
|