Blender V5.0
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
9#include "BLI_math_vector.h"
10#include "node_texture_util.hh"
11
12/* **************** INVERT ******************** */
14 {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
15 {-1, ""},
16};
17
19 {SOCK_RGBA, N_("Color")},
20 {-1, ""},
21};
22
23static void colorfn(float *out, TexParams *p, bNode * /*node*/, bNodeStack **in, short thread)
24{
25 float col[4];
26
27 tex_input_rgba(col, in[0], p, thread);
28
29 col[0] = 1.0f - col[0];
30 col[1] = 1.0f - col[1];
31 col[2] = 1.0f - col[2];
32
34 out[3] = col[3];
35}
36
37static void exec(void *data,
38 int /*thread*/,
39 bNode *node,
40 bNodeExecData *execdata,
41 bNodeStack **in,
43{
44 tex_output(node, execdata, in, out[0], &colorfn, static_cast<TexCallData *>(data));
45}
46
48{
49 static blender::bke::bNodeType ntype;
50
51 tex_node_type_base(&ntype, "TextureNodeInvert", TEX_NODE_INVERT);
52 ntype.ui_name = "Invert Color";
53 ntype.enum_name_legacy = "INVERT";
56 ntype.exec_fn = exec;
57
59}
#define NODE_CLASS_OP_COLOR
Definition BKE_node.hh:449
#define TEX_NODE_INVERT
MINLINE void copy_v3_v3(float r[3], const float a[3])
@ SOCK_RGBA
BMesh const char void * data
uint col
#define in
#define out
void node_register_type(bNodeType &ntype)
Definition node.cc:2416
void node_type_socket_templates(bNodeType *ntype, bNodeSocketTemplate *inputs, bNodeSocketTemplate *outputs)
Definition node.cc:5352
static blender::bke::bNodeSocketTemplate outputs[]
static void colorfn(float *out, TexParams *p, bNode *, bNodeStack **in, short thread)
static void exec(void *data, int, bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out)
static blender::bke::bNodeSocketTemplate inputs[]
static void colorfn(float *out, TexParams *p, bNode *, bNodeStack **in, short thread)
static void exec(void *data, int, bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out)
void register_node_type_tex_invert()
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:99
Defines a node type.
Definition BKE_node.hh:238
NodeExecFunction exec_fn
Definition BKE_node.hh:340
const char * enum_name_legacy
Definition BKE_node.hh:247
#define N_(msgid)