Blender V5.3
node_texture_translate.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
11namespace blender {
12
14 {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
15 {SOCK_VECTOR, N_("Offset"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_TRANSLATION},
16 {-1, ""},
17};
18
20 {SOCK_RGBA, N_("Color")},
21 {-1, ""},
22};
23
24static void colorfn(float *out, TexParams *p, bNode * /*node*/, bNodeStack **in, short thread)
25{
26 float offset[3], new_co[3];
27 TexParams np = *p;
28 np.co = new_co;
29
30 tex_input_vec(offset, in[1], p, thread);
31
32 new_co[0] = p->co[0] + offset[0];
33 new_co[1] = p->co[1] + offset[1];
34 new_co[2] = p->co[2] + offset[2];
35
36 tex_input_rgba(out, in[0], &np, thread);
37}
38static void exec(void *data,
39 int /*thread*/,
40 bNode *node,
41 bNodeExecData *execdata,
42 bNodeStack **in,
44{
45 tex_output(node, execdata, in, out[0], &colorfn, static_cast<TexCallData *>(data));
46}
47
49{
50 static bke::bNodeType ntype;
51
52 tex_node_type_base(&ntype, "TextureNodeTranslate"_ustr, TEX_NODE_TRANSLATE);
53 ntype.ui_name = "Translate";
54 ntype.enum_name_legacy = "TRANSLATE";
57 ntype.exec_fn = exec;
58
60}
61
62} // namespace blender
#define NODE_CLASS_DISTORT
Definition BKE_node.hh:486
#define TEX_NODE_TRANSLATE
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.
void tex_input_vec(float *out, bNodeStack *in, TexParams *params, short thread)
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)
void register_node_type_tex_translate()
static bke::bNodeSocketTemplate outputs[]
@ PROP_TRANSLATION
Definition RNA_types.hh:318
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)