Blender V4.3
node_shader_gamma.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2006 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_input<decl::Color>("Color")
12 .default_value({1.0f, 1.0f, 1.0f, 1.0f})
13 .description("Color input on which correction will be applied");
14 b.add_input<decl::Float>("Gamma")
15 .default_value(1.0f)
16 .min(0.001f)
17 .max(10.0f)
19 .description(
20 "Gamma correction value\n"
21 "Gamma controls the relative intensity of the mid-tones compared to the full black and "
22 "full white");
23 b.add_output<decl::Color>("Color");
24}
25
27 bNode *node,
28 bNodeExecData * /*execdata*/,
29 GPUNodeStack *in,
30 GPUNodeStack *out)
31{
32 return GPU_stack_link(mat, node, "node_gamma", in, out);
33}
34
36#ifdef WITH_MATERIALX
37{
38 NodeItem color = get_input_value("Color", NodeItem::Type::Color4);
39 NodeItem gamma = get_input_value("Gamma", NodeItem::Type::Float);
40 return color ^ gamma;
41}
42#endif
44
45} // namespace blender::nodes::node_shader_gamma_cc
46
48{
49 namespace file_ns = blender::nodes::node_shader_gamma_cc;
50
51 static blender::bke::bNodeType ntype;
52
54 ntype.declare = file_ns::node_declare;
55 ntype.gpu_fn = file_ns::node_shader_gpu_gamma;
56 ntype.materialx_fn = file_ns::node_shader_materialx;
57
59}
#define SH_NODE_GAMMA
Definition BKE_node.hh:946
#define NODE_CLASS_OP_COLOR
Definition BKE_node.hh:406
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
@ PROP_NONE
Definition RNA_types.hh:136
local_group_size(16, 16) .push_constant(Type b
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
static int node_shader_gpu_gamma(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void node_declare(NodeDeclarationBuilder &b)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
void register_node_type_sh_gamma()
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