Blender  V3.3
node_shader_normal.cc
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_shader_util.hh"
9 
11 
13 {
14  b.add_input<decl::Vector>(N_("Normal"))
15  .default_value({0.0f, 0.0f, 1.0f})
16  .min(-1.0f)
17  .max(1.0f)
18  .subtype(PROP_DIRECTION);
19  b.add_output<decl::Vector>(N_("Normal"))
20  .default_value({0.0f, 0.0f, 1.0f})
21  .min(-1.0f)
22  .max(1.0f)
23  .subtype(PROP_DIRECTION);
24  b.add_output<decl::Float>(N_("Dot"));
25 }
26 
28  bNode *node,
29  bNodeExecData *UNUSED(execdata),
30  GPUNodeStack *in,
32 {
33  GPUNodeLink *vec = GPU_uniform(out[0].vec);
34  return GPU_stack_link(mat, node, "normal_new_shading", in, out, vec);
35 }
36 
37 } // namespace blender::nodes::node_shader_normal_cc
38 
40 {
41  namespace file_ns = blender::nodes::node_shader_normal_cc;
42 
43  static bNodeType ntype;
44 
48 
49  nodeRegisterType(&ntype);
50 }
void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpu_fn)
Definition: node.cc:4465
#define NODE_CLASS_OP_VECTOR
Definition: BKE_node.h:348
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1357
#define UNUSED(x)
GPUNodeLink * GPU_uniform(const float *num)
bool GPU_stack_link(GPUMaterial *mat, struct bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value SH_NODE_NORMAL
@ PROP_DIRECTION
Definition: RNA_types.h:155
OperationNode * node
static void node_declare(NodeDeclarationBuilder &b)
static int gpu_shader_normal(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void register_node_type_sh_normal()
void sh_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass)
#define min(a, b)
Definition: sort.c:35
Defines a node type.
Definition: BKE_node.h:226
NodeDeclareFunction declare
Definition: BKE_node.h:324
#define N_(msgid)