2018-03-05 02:02:42 +03:00
|
|
|
$input v_materialID
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2018 Kostas Anagnostou. All rights reserved.
|
2022-01-15 22:59:06 +03:00
|
|
|
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
|
2018-03-05 02:02:42 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "../common/common.sh"
|
|
|
|
|
2018-03-11 02:01:22 +03:00
|
|
|
uniform vec4 u_color[32];
|
2018-03-05 02:02:42 +03:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2018-03-11 02:01:22 +03:00
|
|
|
vec4 color = u_color[uint(v_materialID)];
|
2018-03-05 03:11:05 +03:00
|
|
|
|
2018-03-11 02:01:22 +03:00
|
|
|
if (color.w < 1.0f)
|
2018-03-05 02:02:42 +03:00
|
|
|
{
|
|
|
|
//render dithered alpha
|
2018-03-05 03:11:05 +03:00
|
|
|
if ( (int(gl_FragCoord.x) % 2) == (int(gl_FragCoord.y) % 2) )
|
2018-03-11 02:01:22 +03:00
|
|
|
{
|
2018-03-05 02:02:42 +03:00
|
|
|
discard;
|
2018-03-11 02:01:22 +03:00
|
|
|
}
|
2018-03-05 02:02:42 +03:00
|
|
|
}
|
2018-03-05 03:11:05 +03:00
|
|
|
|
2018-03-11 02:01:22 +03:00
|
|
|
gl_FragColor = vec4(color.xyz, 1.0);
|
2018-03-05 02:02:42 +03:00
|
|
|
}
|