Blender V4.3
node_shader_bsdf_hair.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::Color>("Color").default_value({0.8f, 0.8f, 0.8f, 1.0f});
15 b.add_input<decl::Float>("Offset").default_value(0.0f).min(-M_PI_2).max(M_PI_2).subtype(
17 b.add_input<decl::Float>("RoughnessU")
18 .default_value(0.1f)
19 .min(0.0f)
20 .max(1.0f)
22 b.add_input<decl::Float>("RoughnessV")
23 .default_value(1.0f)
24 .min(0.0f)
25 .max(1.0f)
27 b.add_input<decl::Vector>("Tangent").hide_value();
28 b.add_input<decl::Float>("Weight").available(false);
29 b.add_output<decl::Shader>("BSDF");
30}
31
32static void node_shader_buts_hair(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
33{
34 uiItemR(layout, ptr, "component", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
35}
36
38 bNode *node,
39 bNodeExecData * /*execdata*/,
40 GPUNodeStack *in,
41 GPUNodeStack *out)
42{
44
45 return GPU_stack_link(mat, node, "node_bsdf_hair", in, out);
46}
47
48} // namespace blender::nodes::node_shader_bsdf_hair_cc
49
50/* node type definition */
52{
54
55 static blender::bke::bNodeType ntype;
56
57 sh_node_type_base(&ntype, SH_NODE_BSDF_HAIR, "Hair BSDF", NODE_CLASS_SHADER);
58 ntype.declare = file_ns::node_declare;
60 ntype.draw_buttons = file_ns::node_shader_buts_hair;
61 blender::bke::node_type_size(&ntype, 150, 60, 200);
62 ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_hair;
63
65}
#define NODE_CLASS_SHADER
Definition BKE_node.hh:417
#define M_PI_2
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
@ GPU_MATFLAG_GLOSSY
@ GPU_MATFLAG_DIFFUSE
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
@ PROP_ANGLE
Definition RNA_types.hh:155
@ PROP_FACTOR
Definition RNA_types.hh:154
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_type_size(bNodeType *ntype, int width, int minwidth, int maxwidth)
Definition node.cc:4602
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
static void node_declare(NodeDeclarationBuilder &b)
static void node_shader_buts_hair(uiLayout *layout, bContext *, PointerRNA *ptr)
static int node_shader_gpu_bsdf_hair(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
void register_node_type_sh_bsdf_hair()
void sh_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
bool object_cycles_shader_nodes_poll(const bContext *C)
Defines a node type.
Definition BKE_node.hh:218
bool(* add_ui_poll)(const bContext *C)
Definition BKE_node.hh:288
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