Blender  V3.3
node_texture_scale.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2005 Blender Foundation. All rights reserved. */
3 
8 #include "node_texture_util.h"
9 #include <math.h>
10 
12  {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
13  {SOCK_VECTOR, N_("Scale"), 1.0f, 1.0f, 1.0f, 0.0f, -10.0f, 10.0f, PROP_XYZ},
14  {-1, ""},
15 };
16 
18  {SOCK_RGBA, N_("Color")},
19  {-1, ""},
20 };
21 
22 static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
23 {
24  float scale[3], new_co[3], new_dxt[3], new_dyt[3];
25  TexParams np = *p;
26 
27  np.co = new_co;
28  np.dxt = new_dxt;
29  np.dyt = new_dyt;
30 
31  tex_input_vec(scale, in[1], p, thread);
32 
33  mul_v3_v3v3(new_co, p->co, scale);
34  if (p->osatex) {
35  mul_v3_v3v3(new_dxt, p->dxt, scale);
36  mul_v3_v3v3(new_dyt, p->dyt, scale);
37  }
38 
39  tex_input_rgba(out, in[0], &np, thread);
40 }
41 static void exec(void *data,
42  int UNUSED(thread),
43  bNode *node,
44  bNodeExecData *execdata,
45  bNodeStack **in,
46  bNodeStack **out)
47 {
48  tex_output(node, execdata, in, out[0], &colorfn, data);
49 }
50 
52 {
53  static bNodeType ntype;
54 
57  node_type_exec(&ntype, NULL, NULL, exec);
58 
59  nodeRegisterType(&ntype);
60 }
void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs)
Definition: node.cc:4358
#define TEX_NODE_SCALE
Definition: BKE_node.h:1368
#define NODE_CLASS_DISTORT
Definition: BKE_node.h:353
void node_type_exec(struct bNodeType *ntype, NodeInitExecFunction init_exec_fn, NodeFreeExecFunction free_exec_fn, NodeExecFunction exec_fn)
Definition: node.cc:4455
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1357
MINLINE void mul_v3_v3v3(float r[3], const float a[3], const float b[3])
#define UNUSED(x)
@ SOCK_VECTOR
@ SOCK_RGBA
@ PROP_XYZ
Definition: RNA_types.h:162
Definition: thread.h:34
OperationNode * node
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
static bNodeSocketTemplate outputs[]
static bNodeSocketTemplate inputs[]
static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out)
void register_node_type_tex_scale(void)
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(struct bNodeType *ntype, int type, const char *name, short nclass)
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.h:84
Defines a node type.
Definition: BKE_node.h:226
#define N_(msgid)