Blender V4.5
node_texture_decompose.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2005 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
10
12 {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
13 {-1, ""},
14};
16 {SOCK_FLOAT, N_("Red")},
17 {SOCK_FLOAT, N_("Green")},
18 {SOCK_FLOAT, N_("Blue")},
19 {SOCK_FLOAT, N_("Alpha")},
20 {-1, ""},
21};
22
23static void valuefn_r(float *out, TexParams *p, bNode * /*node*/, bNodeStack **in, short thread)
24{
25 tex_input_rgba(out, in[0], p, thread);
26 *out = out[0];
27}
28
29static void valuefn_g(float *out, TexParams *p, bNode * /*node*/, bNodeStack **in, short thread)
30{
31 tex_input_rgba(out, in[0], p, thread);
32 *out = out[1];
33}
34
35static void valuefn_b(float *out, TexParams *p, bNode * /*node*/, bNodeStack **in, short thread)
36{
37 tex_input_rgba(out, in[0], p, thread);
38 *out = out[2];
39}
40
41static void valuefn_a(float *out, TexParams *p, bNode * /*node*/, bNodeStack **in, short thread)
42{
43 tex_input_rgba(out, in[0], p, thread);
44 *out = out[3];
45}
46
47static void exec(void *data,
48 int /*thread*/,
49 bNode *node,
50 bNodeExecData *execdata,
51 bNodeStack **in,
53{
54 TexCallData *tex_call_data = static_cast<TexCallData *>(data);
55 tex_output(node, execdata, in, out[0], &valuefn_r, tex_call_data);
56 tex_output(node, execdata, in, out[1], &valuefn_g, tex_call_data);
57 tex_output(node, execdata, in, out[2], &valuefn_b, tex_call_data);
58 tex_output(node, execdata, in, out[3], &valuefn_a, tex_call_data);
59}
60
62{
63 static blender::bke::bNodeType ntype;
64
65 tex_node_type_base(&ntype, "TextureNodeDecompose", TEX_NODE_DECOMPOSE_LEGACY);
66 ntype.ui_name = "Separate RGBA";
67 ntype.enum_name_legacy = "DECOMPOSE";
70 ntype.exec_fn = exec;
71
73}
#define NODE_CLASS_OP_COLOR
Definition BKE_node.hh:435
#define TEX_NODE_DECOMPOSE_LEGACY
@ SOCK_FLOAT
@ SOCK_RGBA
BMesh const char void * data
#define in
#define out
void node_register_type(bNodeType &ntype)
Definition node.cc:2748
void node_type_socket_templates(bNodeType *ntype, bNodeSocketTemplate *inputs, bNodeSocketTemplate *outputs)
Definition node.cc:5541
static blender::bke::bNodeSocketTemplate outputs[]
static void exec(void *data, int, bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out)
static blender::bke::bNodeSocketTemplate inputs[]
void register_node_type_tex_decompose()
static void exec(void *data, int, bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out)
static void valuefn_a(float *out, TexParams *p, bNode *, bNodeStack **in, short thread)
static void valuefn_g(float *out, TexParams *p, bNode *, bNodeStack **in, short thread)
static void valuefn_b(float *out, TexParams *p, bNode *, bNodeStack **in, short thread)
static void valuefn_r(float *out, TexParams *p, bNode *, bNodeStack **in, short thread)
void tex_output(bNode *node, bNodeExecData *, bNodeStack **in, bNodeStack *out, TexFn texfn, TexCallData *cdata)
void tex_input_rgba(float *out, bNodeStack *in, TexParams *params, short thread)
void tex_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
Compact definition of a node socket.
Definition BKE_node.hh:98
Defines a node type.
Definition BKE_node.hh:226
NodeExecFunction exec_fn
Definition BKE_node.hh:328
const char * enum_name_legacy
Definition BKE_node.hh:235
#define N_(msgid)