Blender V5.3
node_texture_combine_color.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "BLI_math_color_c.hh"
10#include "node_texture_util.hh"
11#include "node_util.hh"
12
13namespace blender {
14
16 {SOCK_FLOAT, N_("Red"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
17 {SOCK_FLOAT, N_("Green"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
18 {SOCK_FLOAT, N_("Blue"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
19 {SOCK_FLOAT, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
20 {-1, ""},
21};
23 {SOCK_RGBA, N_("Color")},
24 {-1, ""},
25};
26
27static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
28{
29 int i;
30 for (i = 0; i < 4; i++) {
31 out[i] = tex_input_value(in[i], p, thread);
32 }
33 /* Apply color space if required. */
34 switch (node->custom1) {
36 /* Pass */
37 break;
38 }
41 break;
42 }
45 break;
46 }
47 default: {
49 break;
50 }
51 }
52}
53
54static void update(bNodeTree * /*ntree*/, bNode *node)
55{
57}
58
59static void exec(void *data,
60 int /*thread*/,
61 bNode *node,
62 bNodeExecData *execdata,
63 bNodeStack **in,
65{
66 tex_output(node, execdata, in, out[0], &colorfn, static_cast<TexCallData *>(data));
67}
68
70{
71 static bke::bNodeType ntype;
72
73 tex_node_type_base(&ntype, "TextureNodeCombineColor"_ustr, TEX_NODE_COMBINE_COLOR);
74 ntype.ui_name = "Combine Color";
75 ntype.enum_name_legacy = "COMBINE_COLOR";
78 ntype.exec_fn = exec;
79 ntype.updatefunc = update;
80
82}
83
84} // namespace blender
#define NODE_CLASS_OP_COLOR
Definition BKE_node.hh:480
#define TEX_NODE_COMBINE_COLOR
#define BLI_assert_unreachable()
void node_register_type(bNodeType &ntype)
Definition node.cc:2920
void node_type_socket_templates(bNodeType *ntype, bNodeSocketTemplate *inputs, bNodeSocketTemplate *outputs)
Definition node.cc:6134
BMesh Iterators.
static void update(bNodeTree *, bNode *node)
static void exec(void *data, int, bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out)
static void colorfn(float *out, TexParams *p, bNode *, bNodeStack **in, short thread)
@ NODE_COMBSEP_COLOR_HSL
@ NODE_COMBSEP_COLOR_HSV
@ NODE_COMBSEP_COLOR_RGB
void node_combsep_color_label(const ListBaseT< bNodeSocket > *sockets, NodeCombSepColorMode mode)
Definition node_util.cc:184
void hsv_to_rgb_v(const float hsv[3], float r_rgb[3])
Definition math_color.cc:61
BMesh const char void * data
void tex_output(bNode *node, bNodeExecData *, bNodeStack **in, bNodeStack *out, TexFn texfn, TexCallData *cdata)
static bke::bNodeSocketTemplate inputs[]
void tex_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
void register_node_type_tex_combine_color()
void hsl_to_rgb_v(const float hsl[3], float r_rgb[3])
Definition math_color.cc:66
float tex_input_value(bNodeStack *in, TexParams *params, short thread)
static bke::bNodeSocketTemplate outputs[]
@ PROP_FACTOR
Definition RNA_types.hh:308
Compact definition of a node socket.
Definition BKE_node.hh:102
Defines a node type.
Definition BKE_node.hh:265
NodeExecFunction exec_fn
Definition BKE_node.hh:371
void(*) updatefunc(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:312
const char * enum_name_legacy
Definition BKE_node.hh:274
#define N_(msgid)