fragment.fs 685 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #version 430
  2. layout (binding = 0) uniform sampler2D samp;
  3. uniform mat4 projMatrix;
  4. uniform mat4 viewMatrix;
  5. uniform mat4 modelMatrix;
  6. uniform bool useTexture;
  7. uniform bool useColor;
  8. uniform bool useMixColor;
  9. uniform vec4 mixColor;
  10. uniform bool useNormals;
  11. in vec2 tc;
  12. in vec4 outColor;
  13. out vec4 color;
  14. void main(void)
  15. {
  16. if(useTexture)
  17. {
  18. color = texture(samp, tc);
  19. if(useColor)
  20. {
  21. if(useMixColor)
  22. {
  23. color = (color + mixColor) * 0.5;
  24. }
  25. else
  26. {
  27. color = vec4(outColor.xyz, color.w);
  28. }
  29. }
  30. }
  31. else
  32. {
  33. color = outColor;
  34. }
  35. }