Blender V5.3
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
10
11#include "BKE_node.hh"
12
13#include "node_texture_util.hh"
14
15namespace blender {
16
18 {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
19 {SOCK_VECTOR, N_("Scale"), 1.0f, 1.0f, 1.0f, 0.0f, -10.0f, 10.0f, PROP_XYZ},
20 {-1, ""},
21};
22
24 {SOCK_RGBA, N_("Color")},
25 {-1, ""},
26};
27
28static void colorfn(float *out, TexParams *p, bNode * /*node*/, bNodeStack **in, short thread)
29{
30 float scale[3], new_co[3];
31 TexParams np = *p;
32
33 np.co = new_co;
34
36
37 mul_v3_v3v3(new_co, p->co, scale);
38
39 tex_input_rgba(out, in[0], &np, thread);
40}
41static void exec(void *data,
42 int /*thread*/,
43 bNode *node,
44 bNodeExecData *execdata,
45 bNodeStack **in,
47{
48 tex_output(node, execdata, in, out[0], &colorfn, static_cast<TexCallData *>(data));
49}
50
52{
53 static bke::bNodeType ntype;
54
55 tex_node_type_base(&ntype, "TextureNodeScale"_ustr, TEX_NODE_SCALE);
56 ntype.ui_name = "Scale";
57 ntype.enum_name_legacy = "SCALE";
60 ntype.exec_fn = exec;
61
63}
64
65} // namespace blender
#define NODE_CLASS_DISTORT
Definition BKE_node.hh:486
#define TEX_NODE_SCALE
float3x3 scale(float3x3 mat, float2 scale)
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_scale()
static bke::bNodeSocketTemplate outputs[]
MINLINE void mul_v3_v3v3(float r[3], const float v1[3], const float v2[3])
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)