Blender V5.3
node_shader_shadow_raycast.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2026 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "node_shader_util.hh"
10
11namespace blender {
12
14
16{
17 const bNodeTree *ntree = b.tree_or_null();
18 const bool is_gpu_internal = ntree && (ntree->flag & NTREE_IS_GPU_SHADER_INTERNAL);
19
20 b.add_input<decl::Int>("LightIndex"_ustr).available(is_gpu_internal);
21
22 b.add_input<decl::Vector>("Position"_ustr).hide_value();
23 b.add_input<decl::Float>("Softness"_ustr)
24 .default_value(1.0f)
25 .min(0.0f)
26 .max(1.0f)
28 b.add_output<decl::Color>("Color"_ustr);
29}
30
32 bNode *node,
33 bNodeExecData * /*execdata*/,
36{
37 if (!in[0].link) {
38 /* Error: not linked to a light accumulation zone. */
40 return false;
41 }
42
43 if (!in[1].link) {
44 GPU_link(mat, "world_position_get", GPU_shading_data(), &in[1].link);
45 }
46 else {
48 }
49
50 return GPU_stack_link(
51 mat, node, "node_shadow_raycast", in, out, GPU_kernel_globals(), GPU_shading_data());
52}
53
54} // namespace nodes::node_shader_shadow_raycast_cc
55
56/* node type definition */
58{
59 namespace file_ns = nodes::node_shader_shadow_raycast_cc;
60
61 static bke::bNodeType ntype;
62
63 sh_node_type_base(&ntype, "ShaderNodeShadowRaycast"_ustr, SH_NODE_SHADOW_RAYCAST);
64 ntype.ui_name = "Shadow Raycast";
65 ntype.ui_description = "Shadow Raycast";
66 ntype.enum_name_legacy = "SHADOW_RAYCAST";
68 ntype.declare = file_ns::node_declare;
70 ntype.gpu_fn = file_ns::node_shader_gpu_shadow_raycast;
71 // ntype.materialx_fn = file_ns::node_shader_materialx;
72
74}
75
76} // namespace blender
#define NODE_CLASS_INPUT
Definition BKE_node.hh:478
#define SH_NODE_SHADOW_RAYCAST
#define BLI_assert_unreachable()
void node_register_type(bNodeType &ntype)
Definition node.cc:2920
static void node_declare(NodeDeclarationBuilder &b)
static int node_shader_gpu_shadow_raycast(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,...)
@ GPU_MATFLAG_SHADOW_OFFSET
void sh_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
bool GPU_link(GPUMaterial *mat, const char *name,...)
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
GPUNodeLink * GPU_shading_data()
@ NTREE_IS_GPU_SHADER_INTERNAL
void register_node_type_sh_shadow_raycast()
GPUNodeLink * GPU_kernel_globals()
void search_link_ops_for_shader_material_lighting_node(nodes::GatherLinkSearchOpParams &params)
@ PROP_FACTOR
Definition RNA_types.hh:308
eNodeTree_Flag flag
Defines a node type.
Definition BKE_node.hh:265
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
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
Definition BKE_node.hh:409
NodeDeclareFunction declare
Definition BKE_node.hh:393