Blender V4.3
node_shader_bsdf_toon.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>("Size").default_value(0.5f).min(0.0f).max(1.0f).subtype(PROP_FACTOR);
16 b.add_input<decl::Float>("Smooth").default_value(0.0f).min(0.0f).max(1.0f).subtype(PROP_FACTOR);
17 b.add_input<decl::Vector>("Normal").hide_value();
18 b.add_input<decl::Float>("Weight").available(false);
19 b.add_output<decl::Shader>("BSDF");
20}
21
22static void node_shader_buts_toon(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
23{
24 uiItemR(layout, ptr, "component", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
25}
26
28 bNode *node,
29 bNodeExecData * /*execdata*/,
30 GPUNodeStack *in,
31 GPUNodeStack *out)
32{
33 if (!in[3].link) {
34 GPU_link(mat, "world_normals_get", &in[3].link);
35 }
36
38
39 return GPU_stack_link(mat, node, "node_bsdf_toon", in, out);
40}
41
42} // namespace blender::nodes::node_shader_bsdf_toon_cc
43
44/* node type definition */
46{
48
49 static blender::bke::bNodeType ntype;
50
51 sh_node_type_base(&ntype, SH_NODE_BSDF_TOON, "Toon BSDF", NODE_CLASS_SHADER);
52 ntype.declare = file_ns::node_declare;
54 ntype.draw_buttons = file_ns::node_shader_buts_toon;
56 ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_toon;
57
59}
#define NODE_CLASS_SHADER
Definition BKE_node.hh:417
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
@ GPU_MATFLAG_DIFFUSE
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
bool GPU_link(GPUMaterial *mat, const char *name,...)
@ 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_preset(bNodeType *ntype, eNodeSizePreset size)
Definition node.cc:4614
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
static void node_declare(NodeDeclarationBuilder &b)
static int node_shader_gpu_bsdf_toon(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void node_shader_buts_toon(uiLayout *layout, bContext *, PointerRNA *ptr)
void register_node_type_sh_bsdf_toon()
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