SHADE_Y3/TempShaderFolder/TestCubeFs.glsl

46 lines
988 B
Plaintext
Raw Normal View History

2022-09-19 00:00:07 +08:00
#version 450
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable
2022-09-27 19:18:45 +08:00
#extension GL_EXT_nonuniform_qualifier : require
2022-09-19 00:00:07 +08:00
2022-09-28 20:33:29 +08:00
struct MatPropData
{
vec4 color;
int textureIndex;
float alpha;
vec3 beta;
};
2022-09-19 00:00:07 +08:00
layout(location = 0) in struct
{
vec4 vertColor;
2022-09-27 19:18:45 +08:00
vec2 uv;
2022-09-19 00:00:07 +08:00
} In;
// material stuff
layout(location = 2) flat in struct
2022-09-19 00:00:07 +08:00
{
int materialIndex;
uint eid;
} In2;
2022-09-19 00:00:07 +08:00
2022-09-28 20:33:29 +08:00
//layout (set = 0, binding = )
2022-09-19 00:00:07 +08:00
2022-09-28 20:33:29 +08:00
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;
2022-09-19 00:00:07 +08:00
void main()
{
outColor = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv) +
MatProp.data[In2.materialIndex].color / MatProp.data[In2.materialIndex].alpha;
2022-09-19 00:00:07 +08:00
outEntityID = In2.eid;
//outColor = vec4 (1.0f);
2022-09-19 00:00:07 +08:00
}