Blender V4.3
node_shader_rgb_to_bw.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
9#include "node_shader_util.hh"
10
12
14{
15 b.add_input<decl::Color>("Color").default_value({0.5f, 0.5f, 0.5f, 1.0f});
16 b.add_output<decl::Float>("Val");
17}
18
20 bNode *node,
21 bNodeExecData * /*execdata*/,
22 GPUNodeStack *in,
23 GPUNodeStack *out)
24{
25 return GPU_stack_link(mat, node, "rgbtobw", in, out);
26}
27
29#ifdef WITH_MATERIALX
30{
31 NodeItem color = get_input_value("Color", NodeItem::Type::Color4);
32 return create_node("luminance", NodeItem::Type::Color4, {{"in", color}});
33}
34#endif
36
37} // namespace blender::nodes::node_shader_rgb_to_bw_cc
38
40{
42
43 static blender::bke::bNodeType ntype;
44
46 ntype.declare = file_ns::sh_node_rgbtobw_declare;
47 ntype.gpu_fn = file_ns::gpu_shader_rgbtobw;
48 ntype.materialx_fn = file_ns::node_shader_materialx;
49
51}
#define NODE_CLASS_CONVERTER
Definition BKE_node.hh:410
#define SH_NODE_RGBTOBW
Definition BKE_node.hh:895
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 sh_node_rgbtobw_declare(NodeDeclarationBuilder &b)
static int gpu_shader_rgbtobw(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
void register_node_type_sh_rgbtobw()
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