Blender V4.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
9#include "BLI_math_vector.h"
10#include "node_texture_util.hh"
11#include <cmath>
12
14 {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
15 {SOCK_VECTOR, N_("Scale"), 1.0f, 1.0f, 1.0f, 0.0f, -10.0f, 10.0f, PROP_XYZ},
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 scale[3], new_co[3], new_dxt[3], new_dyt[3];
27 TexParams np = *p;
28
29 np.co = new_co;
30 np.dxt = new_dxt;
31 np.dyt = new_dyt;
32
33 tex_input_vec(scale, in[1], p, thread);
34
35 mul_v3_v3v3(new_co, p->co, scale);
36 if (p->osatex) {
37 mul_v3_v3v3(new_dxt, p->dxt, scale);
38 mul_v3_v3v3(new_dyt, p->dyt, scale);
39 }
40
41 tex_input_rgba(out, in[0], &np, thread);
42}
43static void exec(void *data,
44 int /*thread*/,
45 bNode *node,
46 bNodeExecData *execdata,
47 bNodeStack **in,
48 bNodeStack **out)
49{
50 tex_output(node, execdata, in, out[0], &colorfn, static_cast<TexCallData *>(data));
51}
52
54{
55 static blender::bke::bNodeType ntype;
56
57 tex_node_type_base(&ntype, TEX_NODE_SCALE, "Scale", NODE_CLASS_DISTORT);
58 blender::bke::node_type_socket_templates(&ntype, inputs, outputs);
59 ntype.exec_fn = exec;
60
62}
#define NODE_CLASS_DISTORT
Definition BKE_node.hh:412
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:172
void node_type_socket_templates(bNodeType *ntype, bNodeSocketTemplate *inputs, bNodeSocketTemplate *outputs)
Definition node.cc:4570
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
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_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
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_output(bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack *out, TexFn texfn, TexCallData *cdata)
const float * co
Compact definition of a node socket.
Definition BKE_node.hh:103
Defines a node type.
Definition BKE_node.hh:218
NodeExecFunction exec_fn
Definition BKE_node.hh:316
#define N_(msgid)