SHADE_Y3/Assets/Shaders/TestCube_FS.glsl

49 lines
1.1 KiB
GLSL

#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 vertColor;
vec2 uv;
} In;
// material stuff
layout(location = 2) flat in struct
{
int materialIndex;
uint eid;
uint lightLayerIndex;
} In2;
//layout (set = 0, binding = )
layout (set = 0, binding = 1) uniform sampler2D textures[]; // for textures (global)
layout (set = 3, binding = 0) buffer MaterialProperties // For materials
{
MatPropData data[];
} MatProp;
layout(location = 0) out vec4 outColor;
layout(location = 1) out uint outEntityID;
layout(location = 2) out uint lightLayerIndices;
void main()
{
outColor = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv) +
MatProp.data[In2.materialIndex].color / MatProp.data[In2.materialIndex].alpha;
outEntityID = In2.eid;
lightLayerIndices = In2.lightLayerIndex;
//outColor = vec4 (1.0f);
}