Blender V5.3
node_texture_invert.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#include "node_texture_util.hh"
11
12namespace blender {
13
14/* **************** INVERT ******************** */
16 {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
17 {-1, ""},
18};
19
21 {SOCK_RGBA, N_("Color")},
22 {-1, ""},
23};
24
25static void colorfn(float *out, TexParams *p, bNode * /*node*/, bNodeStack **in, short thread)
26{
27 float col[4];
28
29 tex_input_rgba(col, in[0], p, thread);
30
31 col[0] = 1.0f - col[0];
32 col[1] = 1.0f - col[1];
33 col[2] = 1.0f - col[2];
34
35 copy_v3_v3(out, col);
36 out[3] = col[3];
37}
38
39static void exec(void *data,
40 int /*thread*/,
41 bNode *node,
42 bNodeExecData *execdata,
43 bNodeStack **in,
45{
46 tex_output(node, execdata, in, out[0], &colorfn, static_cast<TexCallData *>(data));
47}
48
50{
51 static bke::bNodeType ntype;
52
53 tex_node_type_base(&ntype, "TextureNodeInvert"_ustr, TEX_NODE_INVERT);
54 ntype.ui_name = "Invert Color";
55 ntype.enum_name_legacy = "INVERT";
58 ntype.exec_fn = exec;
59
61}
62
63} // namespace blender
#define NODE_CLASS_OP_COLOR
Definition BKE_node.hh:480
#define TEX_NODE_INVERT
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.
MINLINE void copy_v3_v3(float r[3], const float a[3])
static void exec(void *data, int, bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out)
void tex_input_rgba(float *out, bNodeStack *in, TexParams *params, short thread)
static void colorfn(float *out, TexParams *p, bNode *, bNodeStack **in, short thread)
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)
static bke::bNodeSocketTemplate outputs[]
void register_node_type_tex_invert()
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
const char * enum_name_legacy
Definition BKE_node.hh:274
#define N_(msgid)