45 lines
1.0 KiB
GLSL
45 lines
1.0 KiB
GLSL
// #type vertex
|
|
#version 460 core
|
|
|
|
uniform mat4 uProjectionMatrix;
|
|
uniform mat4 uViewMatrix;
|
|
|
|
layout (location = 0) in vec3 aPos;
|
|
layout (location = 1) in vec3 aNormal;
|
|
layout (location = 2) in vec2 aUV;
|
|
layout (location = 3) in int aTextureId;
|
|
layout (location = 4) in mat4 aModelMatrix;
|
|
|
|
layout (location = 0) out vec2 oUV;
|
|
layout (location = 1) out int oTextureId;
|
|
layout (location = 2) out vec3 oNormal;
|
|
|
|
void main()
|
|
{
|
|
oUV = aUV;
|
|
oTextureId = aTextureId;
|
|
oNormal = aNormal;
|
|
gl_Position = uProjectionMatrix * uViewMatrix * aModelMatrix * vec4(aPos, 1.0);
|
|
}
|
|
|
|
// #type fragment
|
|
#version 460 core
|
|
|
|
uniform sampler2D uTexture[16];
|
|
|
|
layout (location = 0) in vec2 iUV;
|
|
layout (location = 1) flat in int iTextureId;
|
|
layout (location = 2) in vec3 iNormal;
|
|
|
|
layout (location = 0) out vec4 FragColor;
|
|
|
|
void main()
|
|
{
|
|
vec3 lightColor = vec3(iUV, 0);
|
|
FragColor = vec4(lightColor, 1.0);
|
|
if (iTextureId >= 0)
|
|
FragColor *= texture(uTexture[iTextureId], iUV);
|
|
|
|
if (FragColor.a == 0.0)
|
|
discard;
|
|
} |