Unravel Engine C++ Reference
Loading...
Searching...
No Matches
tonemapping_component.cpp
Go to the documentation of this file.
2
5
6namespace unravel
7{
8
10{
11 entt::meta_factory<tonemapping_method>{}
12 .type("tonemapping_method"_hs)
14 entt::attribute{"name", "tonemapping_method"},
15 entt::attribute{"pretty_name", "Tonemapping Method"},
16 })
17 .data<tonemapping_method::none>("none"_hs)
19 entt::attribute{"name", "none"},
20 entt::attribute{"pretty_name", "None"},
21 })
22 .data<tonemapping_method::exponential>("exponential"_hs)
24 entt::attribute{"name", "exponential"},
25 entt::attribute{"pretty_name", "Exponential"},
26 })
27 .data<tonemapping_method::reinhard>("reinhard"_hs)
29 entt::attribute{"name", "reinhard"},
30 entt::attribute{"pretty_name", "Reinhard"},
31 })
32 .data<tonemapping_method::reinhard_lum>("reinhard_lum"_hs)
34 entt::attribute{"name", "reinhard_lum"},
35 entt::attribute{"pretty_name", "Reinhard Lum"},
36 })
37 .data<tonemapping_method::duiker>("duiker"_hs)
39 entt::attribute{"name", "duiker"},
40 entt::attribute{"pretty_name", "Dukier"},
41 })
42 .data<tonemapping_method::aces>("aces"_hs)
44 entt::attribute{"name", "aces"},
45 entt::attribute{"pretty_name", "Aces"},
46 })
47 .data<tonemapping_method::aces_lum>("aces_lum"_hs)
49 entt::attribute{"name", "aces_lum"},
50 entt::attribute{"pretty_name", "Aces Lum"},
51 })
52 .data<tonemapping_method::filmic>("filmic"_hs)
54 entt::attribute{"name", "filmic"},
55 entt::attribute{"pretty_name", "Filmic"},
56 });
57
58 // Register tonemapping_pass::settings class with entt
59 entt::meta_factory<tonemapping_pass::settings>{}
60 .type("tonemapping_settings"_hs)
62 entt::attribute{"name", "tonemapping_settings"},
63 entt::attribute{"pretty_name", "Tonemapping Settings"},
64 })
65 .data<&tonemapping_pass::settings::exposure>("exposure"_hs)
67 entt::attribute{"name", "exposure"},
68 entt::attribute{"pretty_name", "Exposure"},
69 entt::attribute{"min", 0.0f},
70 entt::attribute{"step", 0.1f},
71 })
72 .data<&tonemapping_pass::settings::method>("method"_hs)
74 entt::attribute{"name", "method"},
75 entt::attribute{"pretty_name", "Method"},
76 });
77}
78
80{
81 try_save(ar, ser20::make_nvp("exposure", obj.exposure));
82 try_save(ar, ser20::make_nvp("method", obj.method));
83}
86
88{
89 try_load(ar, ser20::make_nvp("exposure", obj.exposure));
90 try_load(ar, ser20::make_nvp("method", obj.method));
91}
94
96{
97 entt::meta_factory<tonemapping_component>{}
98 .type("tonemapping_component"_hs)
100 entt::attribute{"name", "tonemapping_component"},
101 entt::attribute{"category", "RENDERING"},
102 entt::attribute{"pretty_name", "Tonemapping"},
103 })
104 .func<&component_meta<tonemapping_component>::exists>("component_exists"_hs)
105 .func<&component_meta<tonemapping_component>::add>("component_add"_hs)
106 .func<&component_meta<tonemapping_component>::remove>("component_remove"_hs)
107 .func<&component_meta<tonemapping_component>::save>("component_save"_hs)
108 .func<&component_meta<tonemapping_component>::load>("component_load"_hs)
109 .data<&tonemapping_component::enabled>("enabled"_hs)
110 .custom<entt::attributes>(entt::attributes{
111 entt::attribute{"name", "enabled"},
112 entt::attribute{"pretty_name", "Enabled"},
113 entt::attribute{"tooltip", "Enable/disable tonemapping"},
114 })
115 .data<&tonemapping_component::settings>("settings"_hs)
117 entt::attribute{"name", "settings"},
118 entt::attribute{"pretty_name", "Settings"},
119 entt::attribute{"flattable", true},
120 });
121}
122
124{
125 try_save(ar, ser20::make_nvp("enabled", obj.enabled));
126 try_save(ar, ser20::make_nvp("settings", obj.settings));
127}
130
132{
133 try_load(ar, ser20::make_nvp("enabled", obj.enabled));
134 try_load(ar, ser20::make_nvp("settings", obj.settings));
135}
138} // namespace unravel
bool enabled
Whether tonemapping is enabled.
attributes::value_type attribute
Definition reflection.h:19
std::map< std::string, meta_any > attributes
Definition reflection.h:18
BinaryInputArchive iarchive_binary_t
simd::JSONOutputArchive oarchive_associative_t
BinaryOutputArchive oarchive_binary_t
simd::JSONInputArchive iarchive_associative_t
#define REFLECT(cls)
Definition reflection.h:133
#define REFLECT_INLINE(cls)
Definition reflection.h:128
#define SAVE_INSTANTIATE(cls, Archive)
#define LOAD(cls)
auto try_save(Archive &ar, ser20::NameValuePair< T > &&t, const hpp::source_location &loc=hpp::source_location::current()) -> bool
#define LOAD_INSTANTIATE(cls, Archive)
#define SAVE(cls)
#define LOAD_INLINE(cls)
#define SAVE_INLINE(cls)
auto try_load(Archive &ar, ser20::NameValuePair< T > &&t, const hpp::source_location &loc=hpp::source_location::current()) -> bool