32 .description(
"Amount of influence the node exerts on the output vector")
33 .compositor_domain_priority(1);
37 .description(
"Vector which would be mapped to the curve")
38 .compositor_domain_priority(0);
62 float start_slopes[
CM_TOT];
65 float range_minimums[
CM_TOT];
67 float range_dividers[
CM_TOT];
72 "curves_vector_mixed",
86 std::shared_ptr<const bNodeTree> tree_;
91 : tree_(std::move(tree)), cumap_(cumap)
93 static const mf::Signature
signature = []() {
95 mf::SignatureBuilder builder{
"Curve Vec",
signature};
96 builder.single_input<
float>(
"Fac");
97 builder.single_input<
float3>(
"Vector");
98 builder.single_output<
float3>(
"Vector");
106 const VArray<float> &fac = params.readonly_single_input<
float>(0,
"Fac");
112 if (fac[i] != 1.0f) {
120 static constexpr int8_t id = 0;
138 return get_input_value(
"Vector", NodeItem::Type::Vector3);
152 ntype.
ui_name =
"Vector Curves";
156 ntype.
declare = file_ns::sh_node_curve_vec_declare;
157 ntype.
initfunc = file_ns::node_shader_init_curve_vec;
160 ntype.
gpu_fn = file_ns::gpu_shader_curve_vec;
173 b.is_function_node();
180 .description(
"Amount of influence the node exerts on the output color")
181 .compositor_domain_priority(1);
183 .default_value({1.0f, 1.0f, 1.0f, 1.0f})
184 .description(
"Color input on which correction will be applied")
209 float start_slopes[
CM_TOT];
212 float range_minimums[
CM_TOT];
214 float range_dividers[
CM_TOT];
218 float black_level[4] = {0.0f, 0.0f, 0.0f, 1.0f};
219 float white_level[4] = {1.0f, 1.0f, 1.0f, 1.0f};
228 "curves_combined_only",
243 "curves_combined_rgb",
259 std::shared_ptr<const bNodeTree> tree_;
264 : tree_(std::move(tree)), cumap_(cumap)
266 static const mf::Signature
signature = []() {
268 mf::SignatureBuilder builder{
"Curve RGB",
signature};
269 builder.single_input<
float>(
"Fac");
279 const VArray<float> &fac = params.readonly_single_input<
float>(0,
"Fac");
287 if (fac[i] != 1.0f) {
296 static constexpr int8_t id = 0;
314 return get_input_value(
"Color", NodeItem::Type::Color3);
329 ntype.
ui_description =
"Apply color corrections for each color channel";
332 ntype.
declare = file_ns::sh_node_curve_rgb_declare;
333 ntype.
initfunc = file_ns::node_shader_init_curve_rgb;
336 ntype.
gpu_fn = file_ns::gpu_shader_curve_rgb;
349 b.is_function_node();
356 .compositor_domain_priority(1);
360 .compositor_domain_priority(0);
384 float start_slopes[
CM_TOT];
387 float range_minimums[
CM_TOT];
389 float range_dividers[
CM_TOT];
394 "curves_float_mixed",
408 std::shared_ptr<const bNodeTree> tree_;
413 : tree_(std::move(tree)), cumap_(cumap)
415 static const mf::Signature
signature = []() {
417 mf::SignatureBuilder builder{
"Curve Float",
signature};
418 builder.single_input<
float>(
"Factor");
419 builder.single_input<
float>(
"Value");
420 builder.single_output<
float>(
"Value");
428 const VArray<float> &fac = params.readonly_single_input<
float>(0,
"Factor");
429 const VArray<float> &val_in = params.readonly_single_input<
float>(1,
"Value");
434 if (fac[i] != 1.0f) {
435 val_out[i] = (1.0f - fac[i]) * val_in[i] + fac[i] * val_out[i];
442 static constexpr int8_t id = 0;
460 return get_input_value(
"Value", NodeItem::Type::Float);
475 ntype.
ui_description =
"Map an input float to a curve and outputs a float value";
478 ntype.
declare = file_ns::sh_node_curve_float_declare;
479 ntype.
initfunc = file_ns::node_shader_init_curve_float;
482 ntype.
gpu_fn = file_ns::gpu_shader_curve_float;
#define NODE_CLASS_CONVERTER
#define NODE_CLASS_OP_VECTOR
#define NODE_CLASS_OP_COLOR
#define SH_NODE_CURVE_FLOAT
#define SH_NODE_CURVE_VEC
#define SH_NODE_CURVE_RGB
const Signature & signature() const
void set_signature(const Signature *signature)
void construct_and_set_matching_fn(Args &&...args)
const std::shared_ptr< const bNodeTree > & shared_tree()
int compositor_domain_priority() const
bool is_default_link_socket
CurveFloatFunction(const CurveMapping &cumap, std::shared_ptr< const bNodeTree > tree)
void call(const IndexMask &mask, mf::Params params, mf::Context) const override
void hash_unique(UniqueHashBytes &hash) const override
CurveRGBFunction(const CurveMapping &cumap, std::shared_ptr< const bNodeTree > tree)
void call(const IndexMask &mask, mf::Params params, mf::Context) const override
void hash_unique(UniqueHashBytes &hash) const override
void hash_unique(UniqueHashBytes &hash) const override
void call(const IndexMask &mask, mf::Params params, mf::Context) const override
CurveVecFunction(const CurveMapping &cumap, std::shared_ptr< const bNodeTree > tree)
void node_register_type(bNodeType &ntype)
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
static void sh_node_curve_float_declare(NodeDeclarationBuilder &b)
static void sh_node_curve_float_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_shader_init_curve_float(bNodeTree *, bNode *node)
static int gpu_shader_curve_float(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void sh_node_curve_rgb_build_multi_function(NodeMultiFunctionBuilder &builder)
static int gpu_shader_curve_rgb(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void sh_node_curve_rgb_declare(NodeDeclarationBuilder &b)
static void node_shader_init_curve_rgb(bNodeTree *, bNode *node)
static void node_shader_init_curve_vec(bNodeTree *, bNode *node)
static int gpu_shader_curve_vec(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void sh_node_curve_vec_declare(NodeDeclarationBuilder &b)
static void sh_node_curve_vec_build_multi_function(NodeMultiFunctionBuilder &builder)
CurveMapping * BKE_curvemapping_add(int tot, float minx, float miny, float maxx, float maxy)
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
void BKE_curvemapping_evaluate3F(const CurveMapping *cumap, float vecout[3], const float vecin[3])
void BKE_curvemapping_evaluateRGBF(const CurveMapping *cumap, float vecout[3], const float vecin[3])
void register_node_type_sh_curve_vec()
GPUNodeLink * GPU_color_band(GPUMaterial *mat, int size, float *pixels, float *r_row)
GPUNodeLink * GPU_uniform(const float *num)
void BKE_curvemapping_init(CurveMapping *cumap)
GPUNodeLink * GPU_constant(const float *num)
void node_free_curves(bNode *node)
void register_node_type_sh_curve_float()
void node_copy_curves(bNodeTree *, bNode *dest_node, const bNode *src_node)
void BKE_curvemapping_table_RGBA(const CurveMapping *cumap, float **array, int *size)
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
void BKE_curvemapping_compute_slopes(const CurveMapping *curve_mapping, float start_slopes[4], float end_slopes[4])
void BKE_curvemapping_compute_range_dividers(const CurveMapping *curve_mapping, float dividers[4])
bool BKE_curvemapping_is_map_identity(const CurveMapping *curve_mapping, int index)
void register_node_type_sh_curve_rgb()
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
VecBase< float, 3 > float3
void BKE_curvemapping_get_range_minimums(const CurveMapping *curve_mapping, float minimums[4])
float BKE_curvemapping_evaluateF(const CurveMapping *cumap, int cur, float value)
void common_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
static constexpr int _240
NodeMaterialXFunction materialx_fn
std::string ui_description
NodeGPUExecFunction gpu_fn
NodeMultiFunctionBuildFunction build_multi_function
void(*) initfunc(bNodeTree *ntree, bNode *node)
const char * enum_name_legacy
NodeDeclareFunction declare