Blender V5.0
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
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>("Factor", "Fac");
20}
21
23{
24 layout->prop(ptr, "use_pixel_size", UI_ITEM_R_SPLIT_EMPTY_NAME, std::nullopt, ICON_NONE);
25}
26
28 bNode *node,
29 bNodeExecData * /*execdata*/,
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 return GPU_stack_link(mat, node, "node_wireframe", in, out);
39}
40
42#ifdef WITH_MATERIALX
43{
44 /* NOTE: This node isn't supported by MaterialX. */
45 return get_output_default(socket_out_->identifier, NodeItem::Type::Float);
46}
47#endif
49
50} // namespace blender::nodes::node_shader_wireframe_cc
51
52/* node type definition */
54{
56
57 static blender::bke::bNodeType ntype;
58
59 sh_node_type_base(&ntype, "ShaderNodeWireframe", SH_NODE_WIREFRAME);
60 ntype.ui_name = "Wireframe";
61 ntype.ui_description =
62 "Retrieve the edges of an object as it appears to Cycles.\nNote: as meshes are triangulated "
63 "before being processed by Cycles, topology will always appear triangulated";
64 ntype.enum_name_legacy = "WIREFRAME";
66 ntype.declare = file_ns::node_declare;
67 ntype.draw_buttons = file_ns::node_shader_buts_wireframe;
68 ntype.gpu_fn = file_ns::node_shader_gpu_wireframe;
69 ntype.materialx_fn = file_ns::node_shader_materialx;
70
72}
#define NODE_CLASS_INPUT
Definition BKE_node.hh:447
#define SH_NODE_WIREFRAME
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)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
#define in
#define out
void node_register_type(bNodeType &ntype)
Definition node.cc:2416
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, std::string idname, const std::optional< int16_t > legacy_type)
void register_node_type_sh_wireframe()
int16_t custom1
Defines a node type.
Definition BKE_node.hh:238
NodeMaterialXFunction materialx_fn
Definition BKE_node.hh:344
std::string ui_description
Definition BKE_node.hh:244
NodeGPUExecFunction gpu_fn
Definition BKE_node.hh:342
const char * enum_name_legacy
Definition BKE_node.hh:247
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:259
NodeDeclareFunction declare
Definition BKE_node.hh:362
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)
PointerRNA * ptr
Definition wm_files.cc:4238