Blender V4.3
node_shader_rgb.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_output<decl::Color>("Color").default_value({0.5f, 0.5f, 0.5f, 1.0f});
16}
17
19 bNode *node,
20 bNodeExecData * /*execdata*/,
21 GPUNodeStack * /*in*/,
22 GPUNodeStack *out)
23{
24 const bNodeSocket *socket = static_cast<bNodeSocket *>(node->outputs.first);
25 float *value = static_cast<bNodeSocketValueRGBA *>(socket->default_value)->value;
26 return GPU_link(mat, "set_rgba", GPU_uniform(value), &out->link);
27}
28
30#ifdef WITH_MATERIALX
31{
32 NodeItem color = get_output_default("Color", NodeItem::Type::Color4);
33 return create_node("constant", NodeItem::Type::Color4, {{"value", color}});
34}
35#endif
37
38} // namespace blender::nodes::node_shader_rgb_cc
39
41{
42 namespace file_ns = blender::nodes::node_shader_rgb_cc;
43
44 static blender::bke::bNodeType ntype;
45
47 ntype.declare = file_ns::node_declare;
48 ntype.gpu_fn = file_ns::gpu_shader_rgb;
49 ntype.materialx_fn = file_ns::node_shader_materialx;
50
52}
#define SH_NODE_RGB
Definition BKE_node.hh:891
#define NODE_CLASS_INPUT
Definition BKE_node.hh:404
bool GPU_link(GPUMaterial *mat, const char *name,...)
GPUNodeLink * GPU_uniform(const float *num)
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 gpu_shader_rgb(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *, GPUNodeStack *out)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
void register_node_type_sh_rgb()
void sh_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
void * default_value
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