Blender V5.0
node_texture_scale.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
11#include "BKE_node.hh"
12
13#include "node_texture_util.hh"
14
16 {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
17 {SOCK_VECTOR, N_("Scale"), 1.0f, 1.0f, 1.0f, 0.0f, -10.0f, 10.0f, PROP_XYZ},
18 {-1, ""},
19};
20
22 {SOCK_RGBA, N_("Color")},
23 {-1, ""},
24};
25
26static void colorfn(float *out, TexParams *p, bNode * /*node*/, bNodeStack **in, short thread)
27{
28 float scale[3], new_co[3];
29 TexParams np = *p;
30
31 np.co = new_co;
32
33 tex_input_vec(scale, in[1], p, thread);
34
35 mul_v3_v3v3(new_co, p->co, scale);
36
37 tex_input_rgba(out, in[0], &np, thread);
38}
39static void exec(void *data,
40 int /*thread*/,
41 bNode *node,
42 bNodeExecData *execdata,
43 bNodeStack **in,
45{
46 tex_output(node, execdata, in, out[0], &colorfn, static_cast<TexCallData *>(data));
47}
48
50{
51 static blender::bke::bNodeType ntype;
52
53 tex_node_type_base(&ntype, "TextureNodeScale", TEX_NODE_SCALE);
54 ntype.ui_name = "Scale";
55 ntype.enum_name_legacy = "SCALE";
58 ntype.exec_fn = exec;
59
61}
#define NODE_CLASS_DISTORT
Definition BKE_node.hh:455
#define TEX_NODE_SCALE
MINLINE void mul_v3_v3v3(float r[3], const float v1[3], const float v2[3])
@ SOCK_VECTOR
@ SOCK_RGBA
@ PROP_XYZ
Definition RNA_types.hh:269
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[]
void register_node_type_tex_scale()
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 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)