Blender V5.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
8
9#include "node_shader_util.hh"
10
11#include "BKE_node.hh"
12
13#include "GPU_material.hh"
14
16#include "UI_resources.hh"
17
18namespace blender {
19
21
23{
24 b.add_input<decl::Float>("Size"_ustr).default_value(0.01f).min(0.0f).max(100.0f);
25 b.add_output<decl::Float>("Factor"_ustr, "Fac"_ustr);
26}
27
28static void node_shader_buts_wireframe(ui::Layout &layout, bContext * /*C*/, PointerRNA *ptr)
29{
30 layout.prop(ptr, "use_pixel_size", ui::ITEM_R_SPLIT_EMPTY_NAME, std::nullopt, ICON_NONE);
31}
32
34 bNode *node,
35 bNodeExecData * /*execdata*/,
38{
40 /* node->custom1 is use_pixel_size */
41 if (node->custom1) {
42 return GPU_stack_link(mat,
43 node,
44 "node_wireframe_screenspace",
45 in,
46 out,
49 }
50 return GPU_stack_link(mat, node, "node_wireframe", in, out, GPU_shading_data());
51}
52
54#ifdef WITH_MATERIALX
55{
56 /* NOTE: This node isn't supported by MaterialX. */
57 return get_output_default(socket_out_->identifier, NodeItem::Type::Float);
58}
59#endif
61
62} // namespace nodes::node_shader_wireframe_cc
63
64/* node type definition */
66{
67 namespace file_ns = nodes::node_shader_wireframe_cc;
68
69 static bke::bNodeType ntype;
70
71 sh_node_type_base(&ntype, "ShaderNodeWireframe"_ustr, SH_NODE_WIREFRAME);
72 ntype.ui_name = "Wireframe";
73 ntype.ui_description =
74 "Retrieve the edges of an object as it appears to Cycles.\nNote: as meshes are triangulated "
75 "before being processed by Cycles, topology will always appear triangulated";
76 ntype.enum_name_legacy = "WIREFRAME";
78 ntype.declare = file_ns::node_declare;
79 ntype.draw_buttons = file_ns::node_shader_buts_wireframe;
80 ntype.gpu_fn = file_ns::node_shader_gpu_wireframe;
81 ntype.materialx_fn = file_ns::node_shader_materialx;
82
84}
85
86} // namespace blender
#define NODE_CLASS_INPUT
Definition BKE_node.hh:478
#define SH_NODE_WIREFRAME
void node_register_type(bNodeType &ntype)
Definition node.cc:2920
static void node_shader_buts_wireframe(ui::Layout &layout, bContext *, PointerRNA *ptr)
static void node_declare(NodeDeclarationBuilder &b)
static int node_shader_gpu_wireframe(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
BMesh Iterators.
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
void register_node_type_sh_wireframe()
@ GPU_MATFLAG_BARYCENTRIC
void sh_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
GPUNodeLink * GPU_shading_data()
GPUNodeLink * GPU_kernel_globals()
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
Defines a node type.
Definition BKE_node.hh:265
NodeMaterialXFunction materialx_fn
Definition BKE_node.hh:375
void(*) draw_buttons(ui::Layout &, bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:290
std::string ui_description
Definition BKE_node.hh:271
NodeGPUExecFunction gpu_fn
Definition BKE_node.hh:373
const char * enum_name_legacy
Definition BKE_node.hh:274
NodeDeclareFunction declare
Definition BKE_node.hh:393
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)