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::hable>("hable"_hs)
39 entt::attribute{"name", "hable"},
40 entt::attribute{"pretty_name", "Hable"},
41 })
42 .data<tonemapping_method::filmic>("filmic"_hs)
44 entt::attribute{"name", "filmic"},
45 entt::attribute{"pretty_name", "Filmic"},
46 })
47 .data<tonemapping_method::aces>("aces"_hs)
49 entt::attribute{"name", "aces"},
50 entt::attribute{"pretty_name", "ACES"},
51 })
52 .data<tonemapping_method::aces_lum>("aces_lum"_hs)
54 entt::attribute{"name", "aces_lum"},
55 entt::attribute{"pretty_name", "ACES Lum"},
56 })
57 .data<tonemapping_method::reinhard2>("reinhard2"_hs)
59 entt::attribute{"name", "reinhard2"},
60 entt::attribute{"pretty_name", "Reinhard2"},
61 })
62 .data<tonemapping_method::unreal3>("unreal3"_hs)
64 entt::attribute{"name", "unreal3"},
65 entt::attribute{"pretty_name", "Unreal3"},
66 })
67 .data<tonemapping_method::lottes>("lottes"_hs)
69 entt::attribute{"name", "lottes"},
70 entt::attribute{"pretty_name", "Lottes"},
71 })
72 .data<tonemapping_method::uchimura>("uchimura"_hs)
74 entt::attribute{"name", "uchimura"},
75 entt::attribute{"pretty_name", "Uchimura"},
76 })
77 .data<tonemapping_method::neutral>("neutral"_hs)
79 entt::attribute{"name", "neutral"},
80 entt::attribute{"pretty_name", "Neutral"},
81 })
82 .data<tonemapping_method::agx>("agx"_hs)
84 entt::attribute{"name", "agx"},
85 entt::attribute{"pretty_name", "AgX"},
86 })
87 .data<tonemapping_method::agx_golden>("agx_golden"_hs)
89 entt::attribute{"name", "agx_golden"},
90 entt::attribute{"pretty_name", "AgX Golden"},
91 })
92 .data<tonemapping_method::agx_punchy>("agx_punchy"_hs)
94 entt::attribute{"name", "agx_punchy"},
95 entt::attribute{"pretty_name", "AgX Punchy"},
96 });
97
98 // Register tonemapping_pass::settings class with entt
99 entt::meta_factory<tonemapping_pass::settings>{}
100 .type("tonemapping_settings"_hs)
102 entt::attribute{"name", "tonemapping_settings"},
103 entt::attribute{"pretty_name", "Tonemapping Settings"},
104 })
105 .data<&tonemapping_pass::settings::exposure>("exposure"_hs)
107 entt::attribute{"name", "exposure"},
108 entt::attribute{"pretty_name", "Exposure"},
109 entt::attribute{"min", 0.0f},
110 entt::attribute{"step", 0.1f},
111 })
112 .data<&tonemapping_pass::settings::method>("method"_hs)
114 entt::attribute{"name", "method"},
115 entt::attribute{"pretty_name", "Method"},
116 });
117}
118
120{
121 try_save(ar, ser20::make_nvp("exposure", obj.exposure));
122 try_save(ar, ser20::make_nvp("method", obj.method));
123}
126
128{
129 try_load(ar, ser20::make_nvp("exposure", obj.exposure));
130 try_load(ar, ser20::make_nvp("method", obj.method));
131}
134
136{
137 entt::meta_factory<tonemapping_component>{}
138 .type("tonemapping_component"_hs)
140 entt::attribute{"name", "tonemapping_component"},
141 entt::attribute{"category", "RENDERING"},
142 entt::attribute{"pretty_name", "Tonemapping"},
143 })
144 .func<&component_meta<tonemapping_component>::exists>("component_exists"_hs)
145 .func<&component_meta<tonemapping_component>::add>("component_add"_hs)
146 .func<&component_meta<tonemapping_component>::remove>("component_remove"_hs)
147 .func<&component_meta<tonemapping_component>::save>("component_save"_hs)
148 .func<&component_meta<tonemapping_component>::load>("component_load"_hs)
149 .data<&tonemapping_component::enabled>("enabled"_hs)
150 .custom<entt::attributes>(entt::attributes{
151 entt::attribute{"name", "enabled"},
152 entt::attribute{"pretty_name", "Enabled"},
153 entt::attribute{"tooltip", "Enable/disable tonemapping"},
154 })
155 .data<&tonemapping_component::settings>("settings"_hs)
157 entt::attribute{"name", "settings"},
158 entt::attribute{"pretty_name", "Settings"},
159 entt::attribute{"flattable", true},
160 });
161}
162
164{
165 try_save(ar, ser20::make_nvp("enabled", obj.enabled));
166 try_save(ar, ser20::make_nvp("settings", obj.settings));
167}
170
172{
173 try_load(ar, ser20::make_nvp("enabled", obj.enabled));
174 try_load(ar, ser20::make_nvp("settings", obj.settings));
175}
178} // 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:149
#define REFLECT_INLINE(cls)
Definition reflection.h:144
#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