Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/osl/shaders/node_float_curve.osl
| /* SPDX-License-Identifier: Apache-2.0 | /* SPDX-License-Identifier: Apache-2.0 | ||||
| * Copyright 2011-2022 Blender Foundation */ | * Copyright 2011-2022 Blender Foundation */ | ||||
| #include "node_ramp_util.h" | #include "node_ramp_util.h" | ||||
| #include "stdcycles.h" | #include "stdcycles.h" | ||||
| shader node_float_curve(float ramp[] = {0.0}, | shader node_float_curve(float ramp[] = {0.0}, | ||||
| float min_x = 0.0, | float min_x = 0.0, | ||||
| float max_x = 1.0, | float max_x = 1.0, | ||||
| int extrapolate = 0, | |||||
| float ValueIn = 0.0, | float ValueIn = 0.0, | ||||
| float Factor = 0.0, | float Factor = 0.0, | ||||
| output float ValueOut = 0.0) | output float ValueOut = 0.0) | ||||
| { | { | ||||
| float c = (ValueIn - min_x) / (max_x - min_x); | float c = (ValueIn - min_x) / (max_x - min_x); | ||||
| ValueOut = rgb_ramp_lookup(ramp, c, 1, 1); | ValueOut = rgb_ramp_lookup(ramp, c, 1, extrapolate); | ||||
| ValueOut = mix(ValueIn, ValueOut, Factor); | ValueOut = mix(ValueIn, ValueOut, Factor); | ||||
| } | } | ||||