Home Reference Source

src/effects/GammaCorrectionEffect.js

  1. import { Uniform } from "three";
  2. import { BlendFunction } from "../enums/BlendFunction.js";
  3. import { Effect } from "./Effect.js";
  4.  
  5. import fragmentShader from "./glsl/gamma-correction.frag";
  6.  
  7. /**
  8. * A gamma correction effect.
  9. *
  10. * @deprecated Set WebGLRenderer.outputEncoding to sRGBEncoding instead.
  11. */
  12.  
  13. export class GammaCorrectionEffect extends Effect {
  14.  
  15. /**
  16. * Constructs a new gamma correction effect.
  17. *
  18. * @param {Object} [options] - The options.
  19. * @param {BlendFunction} [options.blendFunction=BlendFunction.SRC] - The blend function of this effect.
  20. * @param {Number} [options.gamma=2.0] - The gamma factor.
  21. */
  22.  
  23. constructor({ blendFunction = BlendFunction.SRC, gamma = 2.0 } = {}) {
  24.  
  25. super("GammaCorrectionEffect", fragmentShader, {
  26. blendFunction,
  27. uniforms: new Map([
  28. ["gamma", new Uniform(gamma)]
  29. ])
  30. });
  31.  
  32. }
  33.  
  34. }