Code cleanup, additional specialization constant as parameter for one lighting path

This commit is contained in:
saschawillems 2017-01-01 15:41:23 +01:00
parent 668ad24830
commit 00b5ea453f
3 changed files with 40 additions and 43 deletions

View file

@ -17,6 +17,8 @@ layout (location = 0) out vec4 outFragColor;
// We use this constant to control the flow of the shader depending on the
// lighting model selected at pipeline creation time
layout (constant_id = 0) const int LIGHTING_MODEL = 0;
// Parameter for the toon shading part of the shader
layout (constant_id = 1) const float PARAM_TOON_DESATURATION = 0.0f;
void main()
{
@ -50,6 +52,8 @@ void main()
color = inColor * 0.4;
else
color = inColor * 0.2;
// Desaturate a bit
color = vec3(mix(color, vec3(dot(vec3(0.2126,0.7152,0.0722), color)), PARAM_TOON_DESATURATION));
outFragColor.rgb = color;
break;
}