fadeBlackFragmentShader.glsl 989 B

1234567891011121314151617181920212223242526272829303132333435
  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /*
  3. * This file is part of the LibreOffice project.
  4. *
  5. * This Source Code Form is subject to the terms of the Mozilla Public
  6. * License, v. 2.0. If a copy of the MPL was not distributed with this
  7. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  8. */
  9. #version 120
  10. uniform sampler2D leavingSlideTexture;
  11. uniform sampler2D enteringSlideTexture;
  12. uniform float time;
  13. varying vec2 v_texturePosition;
  14. void main() {
  15. #ifdef use_white
  16. vec4 color = vec4(1.0, 1.0, 1.0, 1.0);
  17. #else
  18. vec4 color = vec4(0.0, 0.0, 0.0, 1.0);
  19. #endif
  20. vec4 texel;
  21. float amount;
  22. if (time < 0.5) {
  23. texel = texture2D(leavingSlideTexture, v_texturePosition);
  24. amount = time * 2;
  25. } else {
  26. texel = texture2D(enteringSlideTexture, v_texturePosition);
  27. amount = (1.0 - time) * 2;
  28. }
  29. gl_FragColor = mix(texel, color, amount);
  30. }
  31. /* vim:set shiftwidth=4 softtabstop=4 expandtab: */