Blender V5.0
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
12 {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
13 {SOCK_VECTOR, N_("Offset"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_TRANSLATION},
14 {-1, ""},
15};
16
18 {SOCK_RGBA, N_("Color")},
19 {-1, ""},
20};
21
22static void colorfn(float *out, TexParams *p, bNode * /*node*/, bNodeStack **in, short thread)
23{
24 float offset[3], new_co[3];
25 TexParams np = *p;
26 np.co = new_co;
27
28 tex_input_vec(offset, in[1], p, thread);
29
30 new_co[0] = p->co[0] + offset[0];
31 new_co[1] = p->co[1] + offset[1];
32 new_co[2] = p->co[2] + offset[2];
33
34 tex_input_rgba(out, in[0], &np, thread);
35}
36static void exec(void *data,
37 int /*thread*/,
38 bNode *node,
39 bNodeExecData *execdata,
40 bNodeStack **in,
42{
43 tex_output(node, execdata, in, out[0], &colorfn, static_cast<TexCallData *>(data));
44}
45
47{
48 static blender::bke::bNodeType ntype;
49
50 tex_node_type_base(&ntype, "TextureNodeTranslate", TEX_NODE_TRANSLATE);
51 ntype.ui_name = "Translate";
52 ntype.enum_name_legacy = "TRANSLATE";
55 ntype.exec_fn = exec;
56
58}
#define NODE_CLASS_DISTORT
Definition BKE_node.hh:455
#define TEX_NODE_TRANSLATE
@ SOCK_VECTOR
@ SOCK_RGBA
@ PROP_TRANSLATION
Definition RNA_types.hh:261
BMesh const char void * data
#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_translate()
void tex_output(bNode *node, bNodeExecData *, bNodeStack **in, bNodeStack *out, TexFn texfn, TexCallData *cdata)
void tex_input_vec(float *out, bNodeStack *in, TexParams *params, short thread)
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)
const float * co
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)