Blender V4.3
node_shader_light_path.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 Camera Ray");
12 b.add_output<decl::Float>("Is Shadow Ray");
13 b.add_output<decl::Float>("Is Diffuse Ray");
14 b.add_output<decl::Float>("Is Glossy Ray");
15 b.add_output<decl::Float>("Is Singular Ray");
16 b.add_output<decl::Float>("Is Reflection Ray");
17 b.add_output<decl::Float>("Is Transmission Ray");
18 b.add_output<decl::Float>("Ray Length");
19 b.add_output<decl::Float>("Ray Depth");
20 b.add_output<decl::Float>("Diffuse Depth");
21 b.add_output<decl::Float>("Glossy Depth");
22 b.add_output<decl::Float>("Transparent Depth");
23 b.add_output<decl::Float>("Transmission Depth");
24}
25
27 bNode *node,
28 bNodeExecData * /*execdata*/,
29 GPUNodeStack *in,
30 GPUNodeStack *out)
31{
32 return GPU_stack_link(mat, node, "node_light_path", in, out);
33}
34
36#ifdef WITH_MATERIALX
37{
38 /* NOTE: This node isn't supported by MaterialX. Only default values returned. */
39 if (STREQ(socket_out_->name, "Is Camera Ray")) {
40 return val(1.0f);
41 }
42 if (STREQ(socket_out_->name, "Ray Length")) {
43 return val(1.0f);
44 }
45 NodeItem res = val(0.0f);
46 return res;
47}
48#endif
50
51} // namespace blender::nodes::node_shader_light_path_cc
52
53/* node type definition */
55{
57
58 static blender::bke::bNodeType ntype;
59
60 sh_node_type_base(&ntype, SH_NODE_LIGHT_PATH, "Light Path", NODE_CLASS_INPUT);
61 ntype.declare = file_ns::node_declare;
62 ntype.gpu_fn = file_ns::node_shader_gpu_light_path;
63 ntype.materialx_fn = file_ns::node_shader_materialx;
64
66}
#define NODE_CLASS_INPUT
Definition BKE_node.hh:404
#define STREQ(a, b)
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
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_light_path(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
void register_node_type_sh_light_path()
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