/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
 *
 * SPDX-License-Identifier: Apache-2.0 */

#include "stdcycles.h"

shader node_brightness(color ColorIn = 0.8,
                       float Bright = 0.0,
                       float Contrast = 0.0,
                       output color ColorOut = 0.8)
{
  float a = 1.0 + Contrast;
  float b = Bright - Contrast * 0.5;

  ColorOut[0] = max(a * ColorIn[0] + b, 0.0);
  ColorOut[1] = max(a * ColorIn[1] + b, 0.0);
  ColorOut[2] = max(a * ColorIn[2] + b, 0.0);
}
