Blender V4.3
node_composite_normal.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2006 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include "GPU_material.hh"
10
11#include "COM_shader_node.hh"
12
14
15/* **************** NORMAL ******************** */
16
18
20{
21 b.add_input<decl::Vector>("Normal")
22 .default_value({0.0f, 0.0f, 1.0f})
23 .min(-1.0f)
24 .max(1.0f)
26 .compositor_domain_priority(0);
27 b.add_output<decl::Vector>("Normal")
28 .default_value({0.0f, 0.0f, 1.0f})
29 .min(-1.0f)
30 .max(1.0f)
32 b.add_output<decl::Float>("Dot");
33}
34
35using namespace blender::realtime_compositor;
36
38 public:
40
41 void compile(GPUMaterial *material) override
42 {
45
46 GPU_stack_link(material,
47 &bnode(),
48 "node_composite_normal",
49 inputs,
50 outputs,
52 }
53
54 /* The vector value is stored in the default value of the output socket. */
55 const float *get_vector_value()
56 {
57 return node()
58 .output_by_identifier("Normal")
59 ->default_value_typed<bNodeSocketValueVector>()
60 ->value;
61 }
62};
63
65{
66 return new NormalShaderNode(node);
67}
68
69} // namespace blender::nodes::node_composite_normal_cc
70
72{
74
75 static blender::bke::bNodeType ntype;
76
77 cmp_node_type_base(&ntype, CMP_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR);
78 ntype.declare = file_ns::cmp_node_normal_declare;
79 ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
80
82}
#define NODE_CLASS_OP_VECTOR
Definition BKE_node.hh:407
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
GPUNodeLink * GPU_uniform(const float *num)
@ PROP_DIRECTION
Definition RNA_types.hh:165
DOutputSocket output_by_identifier(StringRef identifier) const
local_group_size(16, 16) .push_constant(Type b
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
static void cmp_node_normal_declare(NodeDeclarationBuilder &b)
static ShaderNode * get_compositor_shader_node(DNode node)
void register_node_type_cmp_normal()
void cmp_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
#define min(a, b)
Definition sort.c:32
Defines a node type.
Definition BKE_node.hh:218
NodeDeclareFunction declare
Definition BKE_node.hh:347
NodeGetCompositorShaderNodeFunction get_compositor_shader_node
Definition BKE_node.hh:328