22 lines
612 B
Plaintext
22 lines
612 B
Plaintext
/* SPDX-License-Identifier: Apache-2.0
|
|
* Copyright 2011-2022 Blender Foundation */
|
|
|
|
#include "node_ramp_util.h"
|
|
#include "stdcycles.h"
|
|
|
|
shader node_float_curve(float ramp[] = {0.0},
|
|
float min_x = 0.0,
|
|
float max_x = 1.0,
|
|
int extrapolate = 1,
|
|
|
|
float ValueIn = 0.0,
|
|
float Factor = 0.0,
|
|
output float ValueOut = 0.0)
|
|
{
|
|
float c = (ValueIn - min_x) / (max_x - min_x);
|
|
|
|
ValueOut = rgb_ramp_lookup(ramp, c, 1, extrapolate);
|
|
|
|
ValueOut = mix(ValueIn, ValueOut, Factor);
|
|
}
|