Blender  V3.3
node_texture_compose.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 
12  {SOCK_FLOAT, N_("Red"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_UNSIGNED},
13  {SOCK_FLOAT, N_("Green"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_UNSIGNED},
14  {SOCK_FLOAT, N_("Blue"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_UNSIGNED},
15  {SOCK_FLOAT, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_UNSIGNED},
16  {-1, ""},
17 };
19  {SOCK_RGBA, N_("Color")},
20  {-1, ""},
21 };
22 
23 static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
24 {
25  int i;
26  for (i = 0; i < 4; i++) {
27  out[i] = tex_input_value(in[i], p, thread);
28  }
29 }
30 
31 static void exec(void *data,
32  int UNUSED(thread),
33  bNode *node,
34  bNodeExecData *execdata,
35  bNodeStack **in,
36  bNodeStack **out)
37 {
38  tex_output(node, execdata, in, out[0], &colorfn, data);
39 }
40 
42 {
43  static bNodeType ntype;
44 
47  node_type_exec(&ntype, NULL, NULL, exec);
48 
49  nodeRegisterType(&ntype);
50 }
void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs)
Definition: node.cc:4358
#define TEX_NODE_COMPOSE_LEGACY
Definition: BKE_node.h:1365
#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
#define UNUSED(x)
@ SOCK_FLOAT
@ SOCK_RGBA
@ PROP_UNSIGNED
Definition: RNA_types.h:142
Definition: thread.h:34
OperationNode * node
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
void register_node_type_tex_compose(void)
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)
float tex_input_value(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)