GammaCorrectionShader.js 695 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /** @module GammaCorrectionShader */
  2. /**
  3. * Gamma Correction Shader
  4. *
  5. * References:
  6. * - {@link http://en.wikipedia.org/wiki/gamma_correction}.
  7. *
  8. * @constant
  9. * @type {Object}
  10. */
  11. const GammaCorrectionShader = {
  12. name: 'GammaCorrectionShader',
  13. uniforms: {
  14. 'tDiffuse': { value: null }
  15. },
  16. vertexShader: /* glsl */`
  17. varying vec2 vUv;
  18. void main() {
  19. vUv = uv;
  20. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  21. }`,
  22. fragmentShader: /* glsl */`
  23. uniform sampler2D tDiffuse;
  24. varying vec2 vUv;
  25. void main() {
  26. vec4 tex = texture2D( tDiffuse, vUv );
  27. gl_FragColor = sRGBTransferOETF( tex );
  28. }`
  29. };
  30. export { GammaCorrectionShader };
粤ICP备19079148号