summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/37-gpudrivenrendering/fs_gdr_instanced_indirect_rendering.sc
blob: a6e410406dc39741d694e891302a2654f913a762 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$input v_materialID

/*
 * Copyright 2018 Kostas Anagnostou. All rights reserved.
 * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
 */

#include "../common/common.sh"

uniform vec4 u_color[32];

void main()
{
	vec4 color = u_color[uint(v_materialID)];

	if (color.w < 1.0f)
	{
		//render dithered alpha
		if ( (int(gl_FragCoord.x) % 2) == (int(gl_FragCoord.y) % 2) )
		{
			discard;
		}
	}

	gl_FragColor = vec4(color.xyz, 1.0);
}