Blender
V5.0
source
blender
nodes
composite
nodes
node_composite_exposure.cc
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2020 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9
#include <cmath>
10
11
#include "
BLI_math_vector_types.hh
"
12
13
#include "
FN_multi_function_builder.hh
"
14
15
#include "
NOD_multi_function.hh
"
16
17
#include "
GPU_material.hh
"
18
19
#include "
node_composite_util.hh
"
20
21
/* **************** Exposure ******************** */
22
23
namespace
blender::nodes::node_composite_exposure_cc
{
24
25
static
void
cmp_node_exposure_declare
(
NodeDeclarationBuilder
&
b
)
26
{
27
b
.use_custom_socket_order();
28
b
.allow_any_socket_order();
29
b
.is_function_node();
30
b
.add_input<
decl::Color
>(
"Image"
).default_value({1.0f, 1.0f, 1.0f, 1.0f}).hide_value();
31
b
.add_output<
decl::Color
>(
"Image"
).align_with_previous();
32
33
b
.add_input<
decl::Float
>(
"Exposure"
).
min
(-10.0f).max(10.0f);
34
}
35
36
using namespace
blender::compositor
;
37
38
static
int
node_gpu_material
(
GPUMaterial
*material,
39
bNode
*node,
40
bNodeExecData
*
/*execdata*/
,
41
GPUNodeStack
*
inputs
,
42
GPUNodeStack
*
outputs
)
43
{
44
return
GPU_stack_link
(material, node,
"node_composite_exposure"
,
inputs
,
outputs
);
45
}
46
47
static
void
node_build_multi_function
(
blender::nodes::NodeMultiFunctionBuilder
&builder)
48
{
49
static
auto
function = mf::build::SI2_SO<float4, float, float4>(
50
"Exposure"
,
51
[](
const
float4
&
color
,
const
float
exposure) ->
float4
{
52
return
float4
(
color
.xyz() * std::exp2(exposure),
color
.w);
53
},
54
mf::build::exec_presets::SomeSpanOrSingle<0>());
55
builder.
set_matching_fn
(function);
56
}
57
58
}
// namespace blender::nodes::node_composite_exposure_cc
59
60
static
void
register_node_type_cmp_exposure
()
61
{
62
namespace
file_ns =
blender::nodes::node_composite_exposure_cc
;
63
64
static
blender::bke::bNodeType
ntype;
65
66
cmp_node_type_base
(&ntype,
"CompositorNodeExposure"
,
CMP_NODE_EXPOSURE
);
67
ntype.
ui_name
=
"Exposure"
;
68
ntype.
ui_description
=
"Adjust brightness using a camera exposure parameter"
;
69
ntype.
enum_name_legacy
=
"EXPOSURE"
;
70
ntype.
nclass
=
NODE_CLASS_OP_COLOR
;
71
ntype.
declare
= file_ns::cmp_node_exposure_declare;
72
ntype.
gpu_fn
= file_ns::node_gpu_material;
73
ntype.
build_multi_function
= file_ns::node_build_multi_function;
74
75
blender::bke::node_register_type
(ntype);
76
}
77
NOD_REGISTER_NODE
(
register_node_type_cmp_exposure
)
NODE_CLASS_OP_COLOR
#define NODE_CLASS_OP_COLOR
Definition
BKE_node.hh:449
CMP_NODE_EXPOSURE
#define CMP_NODE_EXPOSURE
Definition
BKE_node_legacy_types.hh:247
BLI_math_vector_types.hh
FN_multi_function_builder.hh
GPU_material.hh
GPU_stack_link
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
Definition
gpu_node_graph.cc:851
NOD_multi_function.hh
NOD_REGISTER_NODE
#define NOD_REGISTER_NODE(REGISTER_FUNC)
Definition
NOD_register.hh:34
blender::nodes::NodeDeclarationBuilder
Definition
NOD_node_declaration.hh:664
blender::nodes::NodeMultiFunctionBuilder
Definition
NOD_multi_function.hh:18
blender::nodes::NodeMultiFunctionBuilder::set_matching_fn
void set_matching_fn(const mf::MultiFunction *fn)
Definition
NOD_multi_function.hh:99
blender::nodes::decl::Color
Definition
NOD_socket_declarations.hh:139
blender::nodes::decl::Float
Definition
NOD_socket_declarations.hh:25
b
b
Definition
compositor_morphological_distance_infos.hh:24
blender::bke::node_register_type
void node_register_type(bNodeType &ntype)
Definition
node.cc:2416
blender::color
Definition
BLI_color.hh:32
blender::compositor
Definition
BKE_node.hh:77
blender::nodes::node_composite_exposure_cc
Definition
node_composite_exposure.cc:23
blender::nodes::node_composite_exposure_cc::node_build_multi_function
static void node_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder)
Definition
node_composite_exposure.cc:47
blender::nodes::node_composite_exposure_cc::cmp_node_exposure_declare
static void cmp_node_exposure_declare(NodeDeclarationBuilder &b)
Definition
node_composite_exposure.cc:25
blender::nodes::node_composite_exposure_cc::node_gpu_material
static int node_gpu_material(GPUMaterial *material, bNode *node, bNodeExecData *, GPUNodeStack *inputs, GPUNodeStack *outputs)
Definition
node_composite_exposure.cc:38
blender::float4
VecBase< float, 4 > float4
Definition
BLI_math_vector_types.hh:620
register_node_type_cmp_exposure
static void register_node_type_cmp_exposure()
Definition
node_composite_exposure.cc:60
cmp_node_type_base
void cmp_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
Definition
node_composite_util.cc:33
node_composite_util.hh
outputs
static blender::bke::bNodeSocketTemplate outputs[]
Definition
node_texture_at.cc:16
inputs
static blender::bke::bNodeSocketTemplate inputs[]
Definition
node_texture_at.cc:11
min
#define min(a, b)
Definition
sort.cc:36
GPUMaterial
Definition
gpu/intern/gpu_material.cc:63
GPUNodeStack
Definition
GPU_material.hh:295
bNodeExecData
Definition
node_util.hh:22
bNode
Definition
DNA_node_types.h:422
blender::bke::bNodeType
Defines a node type.
Definition
BKE_node.hh:238
blender::bke::bNodeType::ui_description
std::string ui_description
Definition
BKE_node.hh:244
blender::bke::bNodeType::ui_name
std::string ui_name
Definition
BKE_node.hh:243
blender::bke::bNodeType::gpu_fn
NodeGPUExecFunction gpu_fn
Definition
BKE_node.hh:342
blender::bke::bNodeType::build_multi_function
NodeMultiFunctionBuildFunction build_multi_function
Definition
BKE_node.hh:351
blender::bke::bNodeType::nclass
short nclass
Definition
BKE_node.hh:251
blender::bke::bNodeType::enum_name_legacy
const char * enum_name_legacy
Definition
BKE_node.hh:247
blender::bke::bNodeType::declare
NodeDeclareFunction declare
Definition
BKE_node.hh:362
Generated on
for Blender by
doxygen
1.16.1