semisoft.frag 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* MegaZeux
  2. *
  3. * Copyright (C) 2017 GreaseMonkey
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. #version 110
  20. uniform sampler2D baseMap;
  21. varying vec2 vTexcoord;
  22. #define XS 1024.0
  23. #define YS 512.0
  24. #define AX 0.5/XS
  25. #define AY 0.5/YS
  26. void main(void)
  27. {
  28. vec2 tcbase = (floor(vTexcoord*vec2(XS, YS) + 0.5) + 0.5)/vec2(XS, YS);
  29. vec2 tcdiff = vTexcoord-tcbase;
  30. vec2 sdiff = sign(tcdiff);
  31. vec2 adiff = pow(abs(tcdiff)*vec2(XS, YS), vec2(3.0));
  32. gl_FragColor = texture2D(baseMap, tcbase + sdiff*adiff/vec2(XS, YS));
  33. }