46 lines
981 B
GLSL
46 lines
981 B
GLSL
// #type vertex
|
|
#version 460 core
|
|
|
|
uniform mat4 uProjectionMatrix;
|
|
uniform mat4 uViewMatrix;
|
|
|
|
layout (location = 0) in vec3 aPosition;
|
|
layout (location = 1) in vec2 aUV;
|
|
layout (location = 2) in vec4 aColor;
|
|
layout (location = 3) in int aTextureId;
|
|
layout (location = 4) in mat4 aModel;
|
|
|
|
layout (location = 0) out vec4 oColor;
|
|
layout (location = 1) out vec2 oUV;
|
|
layout (location = 2) flat out int oTextureId;
|
|
|
|
void main()
|
|
{
|
|
oColor = aColor;
|
|
oUV = aUV;
|
|
oTextureId = aTextureId;
|
|
|
|
gl_Position = uProjectionMatrix * uViewMatrix * aModel * vec4(aPosition, 1.0);
|
|
}
|
|
|
|
// #type fragment
|
|
#version 460 core
|
|
|
|
uniform sampler2D uTexture[16];
|
|
|
|
layout (location = 0) in vec4 iColor;
|
|
layout (location = 1) in vec2 iUV;
|
|
layout (location = 2) flat in int iTextureId;
|
|
|
|
layout (location = 0) out vec4 FragColor;
|
|
|
|
void main()
|
|
{
|
|
FragColor = iColor;
|
|
|
|
if (iTextureId >= 0)
|
|
FragColor *= texture(uTexture[iTextureId], iUV);
|
|
|
|
if (FragColor.a == 0.0)
|
|
discard;
|
|
} |