A 2D tile-based sandbox game.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

builtins.cc 795B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include "builtins.h"
  2. namespace Cygnet {
  3. const GlShader &builtinTextureVertex() {
  4. static GlShader shader(GlShader::Type::VERTEX, R"(
  5. attribute vec4 position;
  6. attribute vec2 texCoord;
  7. varying vec2 v_texCoord;
  8. void main() {
  9. gl_Position = position;
  10. v_texCoord = texCoord;
  11. }
  12. )");
  13. return shader;
  14. }
  15. const GlShader &builtinTextureFragment() {
  16. static GlShader shader(GlShader::Type::FRAGMENT, R"(
  17. precision mediump float;
  18. varying vec2 v_texCoord;
  19. uniform sampler2D tex;
  20. void main() {
  21. gl_FragColor = texture2D(tex, v_texCoord);
  22. }
  23. )");
  24. return shader;
  25. }
  26. const GlShader &builtinWhiteFragment() {
  27. static GlShader shader(GlShader::Type::FRAGMENT, R"(
  28. precision mediump float;
  29. void main() {
  30. gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
  31. }
  32. )");
  33. return shader;
  34. }
  35. }