Blender  V3.3
node_shader_hair_info.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2005 Blender Foundation. All rights reserved. */
3 
4 #include "node_shader_util.hh"
5 
7 
9 {
10  b.add_output<decl::Float>(N_("Is Strand"));
11  b.add_output<decl::Float>(N_("Intercept"));
12  b.add_output<decl::Float>(N_("Length"));
13  b.add_output<decl::Float>(N_("Thickness"));
14  b.add_output<decl::Vector>(N_("Tangent Normal"));
15  b.add_output<decl::Float>(N_("Random"));
16 }
17 
19  bNode *node,
20  bNodeExecData *UNUSED(execdata),
21  GPUNodeStack *in,
23 {
24  /* Length: don't request length if not needed. */
25  static const float zero = 0;
26  GPUNodeLink *length_link = (!out[2].hasoutput) ? GPU_constant(&zero) :
27  GPU_attribute(mat, CD_HAIRLENGTH, "");
28  return GPU_stack_link(mat, node, "node_hair_info", in, out, length_link);
29 }
30 
31 } // namespace blender::nodes::node_shader_hair_info_cc
32 
33 /* node type definition */
35 {
36  namespace file_ns = blender::nodes::node_shader_hair_info_cc;
37 
38  static bNodeType ntype;
39 
40  sh_node_type_base(&ntype, SH_NODE_HAIR_INFO, "Curves Info", NODE_CLASS_INPUT);
43 
44  nodeRegisterType(&ntype);
45 }
void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpu_fn)
Definition: node.cc:4465
#define SH_NODE_HAIR_INFO
Definition: BKE_node.h:1147
#define NODE_CLASS_INPUT
Definition: BKE_node.h:345
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1357
#define UNUSED(x)
@ CD_HAIRLENGTH
GPUNodeLink * GPU_attribute(GPUMaterial *mat, eCustomDataType type, const char *name)
GPUNodeLink * GPU_constant(const float *num)
bool GPU_stack_link(GPUMaterial *mat, struct bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
OperationNode * node
static int node_shader_gpu_hair_info(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
static void node_declare(NodeDeclarationBuilder &b)
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void register_node_type_sh_hair_info()
void sh_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass)
Defines a node type.
Definition: BKE_node.h:226
NodeDeclareFunction declare
Definition: BKE_node.h:324
#define N_(msgid)