SHADE_Y3/Assets/Shaders/UI_FS.glsl

50 lines
1.1 KiB
Plaintext
Raw Normal View History

2022-11-18 22:03:21 +08:00
#version 450
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable
#extension GL_EXT_nonuniform_qualifier : require
struct MatPropData
{
vec4 color;
int textureIndex;
float alpha;
vec3 beta;
};
layout(location = 0) in struct
{
vec4 vertPos; // location 0
vec2 uv; // location = 1
vec4 normal; // location = 2
} In;
// material stuff
layout(location = 3) flat in struct
{
int materialIndex;
uint eid;
uint lightLayerIndex;
} In2;
layout (set = 0, binding = 1) uniform sampler2D textures[]; // for textures (global)
2022-12-28 20:47:20 +08:00
layout (std430, set = 2, binding = 0) buffer MaterialProperties // For materials
2022-11-18 22:03:21 +08:00
{
MatPropData data[];
} MatProp;
layout(location = 0) out vec4 position;
layout(location = 1) out uint outEntityID;
layout(location = 2) out uint lightLayerIndices;
layout(location = 3) out vec4 normals;
layout(location = 4) out vec4 albedo;
void main()
{
position = In.vertPos;
normals = In.normal;
2022-11-22 16:18:16 +08:00
albedo = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv);
2022-11-18 22:03:21 +08:00
outEntityID = In2.eid;
lightLayerIndices = In2.lightLayerIndex;
}