Blender V4.3
node_shader_hair_info.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
8
10{
11 b.add_output<decl::Float>("Is Strand");
12 b.add_output<decl::Float>("Intercept");
13 b.add_output<decl::Float>("Length");
14 b.add_output<decl::Float>("Thickness");
15 b.add_output<decl::Vector>("Tangent Normal");
16 b.add_output<decl::Float>("Random");
17}
18
20 bNode *node,
21 bNodeExecData * /*execdata*/,
22 GPUNodeStack *in,
23 GPUNodeStack *out)
24{
25 /* Length: don't request length if not needed. */
26 static const float zero = 0;
27 GPUNodeLink *length_link = out[2].hasoutput ? GPU_attribute_hair_length(mat) :
28 GPU_constant(&zero);
29 return GPU_stack_link(mat, node, "node_hair_info", in, out, length_link);
30}
31
33#ifdef WITH_MATERIALX
34{
35 /* NOTE: This node doesn't have an implementation in MaterialX. */
36 return get_output_default(socket_out_->name, NodeItem::Type::Any);
37}
38#endif
40
41} // namespace blender::nodes::node_shader_hair_info_cc
42
43/* node type definition */
45{
47
48 static blender::bke::bNodeType ntype;
49
51 ntype.declare = file_ns::node_declare;
52 ntype.gpu_fn = file_ns::node_shader_gpu_hair_info;
53 ntype.materialx_fn = file_ns::node_shader_materialx;
54
56}
#define SH_NODE_HAIR_INFO
Definition BKE_node.hh:959
#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,...)
GPUNodeLink * GPU_constant(const float *num)
GPUNodeLink * GPU_attribute_hair_length(GPUMaterial *mat)
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_hair_info(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
void register_node_type_sh_hair_info()
void sh_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
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
NodeDeclareFunction declare
Definition BKE_node.hh:347