Blender V4.3
node_shader_bevel.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
5#include "node_shader_util.hh"
6
7#include "UI_interface.hh"
8#include "UI_resources.hh"
9
11
13{
14 b.add_input<decl::Float>("Radius").default_value(0.05f).min(0.0f).max(1000.0f);
15 b.add_input<decl::Vector>("Normal").hide_value();
16 b.add_output<decl::Vector>("Normal");
17}
18
19static void node_shader_buts_bevel(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
20{
21 uiItemR(layout, ptr, "samples", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
22}
23
24static void node_shader_init_bevel(bNodeTree * /*ntree*/, bNode *node)
25{
26 node->custom1 = 4; /* samples */
27}
28
30 bNode *node,
31 bNodeExecData * /*execdata*/,
32 GPUNodeStack *in,
33 GPUNodeStack *out)
34{
35 if (!in[1].link) {
36 GPU_link(mat, "world_normals_get", &in[1].link);
37 }
38
39 return GPU_stack_link(mat, node, "node_bevel", in, out);
40}
41
43#ifdef WITH_MATERIALX
44{
45 /* NOTE: This node isn't supported by MaterialX. */
46 return get_input_link("Normal", NodeItem::Type::Vector3);
47}
48#endif
50
51} // namespace blender::nodes::node_shader_bevel_cc
52
53/* node type definition */
55{
56 namespace file_ns = blender::nodes::node_shader_bevel_cc;
57
58 static blender::bke::bNodeType ntype;
59
61 ntype.declare = file_ns::node_declare;
62 ntype.draw_buttons = file_ns::node_shader_buts_bevel;
63 ntype.initfunc = file_ns::node_shader_init_bevel;
64 ntype.gpu_fn = file_ns::gpu_shader_bevel;
65 ntype.materialx_fn = file_ns::node_shader_materialx;
66
68}
#define SH_NODE_BEVEL
Definition BKE_node.hh:979
#define NODE_CLASS_INPUT
Definition BKE_node.hh:404
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
bool GPU_link(GPUMaterial *mat, const char *name,...)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
local_group_size(16, 16) .push_constant(Type b
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
static int gpu_shader_bevel(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void node_shader_buts_bevel(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_shader_init_bevel(bNodeTree *, bNode *node)
static void node_declare(NodeDeclarationBuilder &b)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
void register_node_type_sh_bevel()
void sh_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
Defines a node type.
Definition BKE_node.hh:218
NodeMaterialXFunction materialx_fn
Definition BKE_node.hh:320
void(* initfunc)(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:267
NodeGPUExecFunction gpu_fn
Definition BKE_node.hh:318
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:238
NodeDeclareFunction declare
Definition BKE_node.hh:347
PointerRNA * ptr
Definition wm_files.cc:4126