Blender V4.3
node_shader_wireframe.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 "BKE_node.hh"
8
9#include "GPU_material.hh"
10
11#include "UI_interface.hh"
12#include "UI_resources.hh"
13
15
17{
18 b.add_input<decl::Float>("Size").default_value(0.01f).min(0.0f).max(100.0f);
19 b.add_output<decl::Float>("Fac");
20}
21
23{
24 uiItemR(layout, ptr, "use_pixel_size", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
25}
26
28 bNode *node,
29 bNodeExecData * /*execdata*/,
30 GPUNodeStack *in,
31 GPUNodeStack *out)
32{
34 /* node->custom1 is use_pixel_size */
35 if (node->custom1) {
36 return GPU_stack_link(mat, node, "node_wireframe_screenspace", in, out);
37 }
38 else {
39 return GPU_stack_link(mat, node, "node_wireframe", in, out);
40 }
41}
42
44#ifdef WITH_MATERIALX
45{
46 /* NOTE: This node isn't supported by MaterialX. */
47 return get_output_default(socket_out_->name, NodeItem::Type::Float);
48}
49#endif
51
52} // namespace blender::nodes::node_shader_wireframe_cc
53
54/* node type definition */
56{
58
59 static blender::bke::bNodeType ntype;
60
62 ntype.declare = file_ns::node_declare;
63 ntype.draw_buttons = file_ns::node_shader_buts_wireframe;
64 ntype.gpu_fn = file_ns::node_shader_gpu_wireframe;
65 ntype.materialx_fn = file_ns::node_shader_materialx;
66
68}
#define SH_NODE_WIREFRAME
Definition BKE_node.hh:961
#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,...)
@ GPU_MATFLAG_BARYCENTRIC
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
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 void node_declare(NodeDeclarationBuilder &b)
static int node_shader_gpu_wireframe(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void node_shader_buts_wireframe(uiLayout *layout, bContext *, PointerRNA *ptr)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
void sh_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
void register_node_type_sh_wireframe()
Defines a node type.
Definition BKE_node.hh:218
NodeMaterialXFunction materialx_fn
Definition BKE_node.hh:320
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