summaryrefslogtreecommitdiff
path: root/gfx/gl/shaders/material.fs
blob: 37f2e27dee33314d86945a7755f0db48234484b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#version 330 core
#extension GL_ARB_shading_language_420pack : enable

layout(binding = 0) uniform sampler2D textureAlbedo;

include(`materialInterface.glsl')
include(`materialOut.glsl')
include(`materialCommon.glsl')

void
main()
{
	vec4 textureColour = getTextureColour(Material, TexCoords);
	float opaque = step(0.5, mix(textureColour.a, 1, Colour.a));
	gPosition = ivec4(FragPos, opaque);
	gNormal = vec4(Normal, opaque);
	gl_FragDepth = mix(1.0, gl_FragCoord.z, opaque);
	gAlbedoSpec = mix(textureColour, vec4(Colour.rgb, 1), Colour.a);
}