Blender V5.3
node_shader_background.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
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::Color>("Color"_ustr)
21 .default_value({0.8f, 0.8f, 0.8f, 1.0f})
22 .description("Color of the emitted light");
23 b.add_input<decl::Float>("Strength"_ustr)
24 .default_value(1.0f)
25 .min(0.0f)
26 .max(1000000.0f)
27 .description("Strength of the emitted light")
28 .translation_context(BLT_I18NCONTEXT_AMOUNT);
29 b.add_input<decl::Float>("Weight"_ustr).available(is_gpu_internal);
30 b.add_output<decl::Shader>("Background"_ustr);
31}
32
34 bNode *node,
35 bNodeExecData * /*execdata*/,
38{
39 return GPU_stack_link(
40 mat, node, "node_background", in, out, GPU_kernel_globals(), GPU_shading_data());
41}
42
43} // namespace nodes::node_shader_background_cc
44
45/* node type definition */
47{
48 namespace file_ns = nodes::node_shader_background_cc;
49
50 static bke::bNodeType ntype;
51
52 sh_node_type_base(&ntype, "ShaderNodeBackground"_ustr, SH_NODE_BACKGROUND);
53 ntype.ui_name = "Background";
54 ntype.ui_description =
55 "Add background light emission.\nNote: This node should only be used for the world surface "
56 "output";
57 ntype.enum_name_legacy = "BACKGROUND";
59 ntype.declare = file_ns::node_declare;
61 ntype.gpu_fn = file_ns::node_shader_gpu_background;
62
64}
65
66} // namespace blender
#define NODE_CLASS_SHADER
Definition BKE_node.hh:491
#define SH_NODE_BACKGROUND
#define BLT_I18NCONTEXT_AMOUNT
void node_register_type(bNodeType &ntype)
Definition node.cc:2920
static void node_declare(NodeDeclarationBuilder &b)
static int node_shader_gpu_background(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,...)
void sh_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
bool world_shader_nodes_poll(const bContext *C)
GPUNodeLink * GPU_shading_data()
@ NTREE_IS_GPU_SHADER_INTERNAL
GPUNodeLink * GPU_kernel_globals()
void register_node_type_sh_background()
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
NodeDeclareFunction declare
Definition BKE_node.hh:393
bool(*) add_ui_poll(const bContext *C)
Definition BKE_node.hh:341