GPUShader: Add selection id shader

This is to separate id drawing from standard color drawing.
This commit is contained in:
2018-12-22 21:02:30 +01:00
parent 943852c0dc
commit 9d19ff9076
5 changed files with 64 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
#ifdef UNIFORM_ID
uniform uint id;
#else
flat in vec4 id;
#endif
out vec4 fragColor;
void main()
{
#ifdef UNIFORM_ID
fragColor = vec4(
((id ) & uint(0xFF)) * (1.0f / 255.0f),
((id >> 8) & uint(0xFF)) * (1.0f / 255.0f),
((id >> 16) & uint(0xFF)) * (1.0f / 255.0f),
((id >> 24) ) * (1.0f / 255.0f));
#else
fragColor = id;
#endif
}