Blender  V3.3
node_texture_invert.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2005 Blender Foundation. All rights reserved. */
3 
8 #include "NOD_texture.h"
9 #include "node_texture_util.h"
10 
11 /* **************** INVERT ******************** */
13  {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
14  {-1, ""},
15 };
16 
18  {SOCK_RGBA, N_("Color")},
19  {-1, ""},
20 };
21 
22 static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
23 {
24  float col[4];
25 
26  tex_input_rgba(col, in[0], p, thread);
27 
28  col[0] = 1.0f - col[0];
29  col[1] = 1.0f - col[1];
30  col[2] = 1.0f - col[2];
31 
32  copy_v3_v3(out, col);
33  out[3] = col[3];
34 }
35 
36 static void exec(void *data,
37  int UNUSED(thread),
38  bNode *node,
39  bNodeExecData *execdata,
40  bNodeStack **in,
41  bNodeStack **out)
42 {
43  tex_output(node, execdata, in, out[0], &colorfn, data);
44 }
45 
47 {
48  static bNodeType ntype;
49 
52  node_type_exec(&ntype, NULL, NULL, exec);
53 
54  nodeRegisterType(&ntype);
55 }
void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs)
Definition: node.cc:4358
#define TEX_NODE_INVERT
Definition: BKE_node.h:1357
#define NODE_CLASS_OP_COLOR
Definition: BKE_node.h:347
void node_type_exec(struct bNodeType *ntype, NodeInitExecFunction init_exec_fn, NodeFreeExecFunction free_exec_fn, NodeExecFunction exec_fn)
Definition: node.cc:4455
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1357
MINLINE void copy_v3_v3(float r[3], const float a[3])
#define UNUSED(x)
@ SOCK_RGBA
Definition: thread.h:34
OperationNode * node
uint col
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
static bNodeSocketTemplate outputs[]
static bNodeSocketTemplate inputs[]
static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out)
void register_node_type_tex_invert(void)
void tex_input_rgba(float *out, bNodeStack *in, TexParams *params, short thread)
void tex_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass)
void tex_output(bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack *out, TexFn texfn, TexCallData *cdata)
Compact definition of a node socket.
Definition: BKE_node.h:84
Defines a node type.
Definition: BKE_node.h:226
#define N_(msgid)