Unravel Engine C++ Reference
Loading...
Searching...
No Matches
reflection_probe_component.cpp
Go to the documentation of this file.
4
7
8namespace unravel
9{
11{
12 entt::meta_factory<reflection_probe_component>{}
13 .type("reflection_probe_component"_hs)
15 entt::attribute{"name", "reflection_probe_component"},
16 entt::attribute{"category", "LIGHTING"},
17 entt::attribute{"pretty_name", "Reflection Probe"},
18 })
19 .func<&component_meta<reflection_probe_component>::exists>("component_exists"_hs)
20 .func<&component_meta<reflection_probe_component>::add>("component_add"_hs)
21 .func<&component_meta<reflection_probe_component>::remove>("component_remove"_hs)
22 .func<&component_meta<reflection_probe_component>::save>("component_save"_hs)
23 .func<&component_meta<reflection_probe_component>::load>("component_load"_hs)
25 .custom<entt::attributes>(entt::attributes{
26 entt::attribute{"name", "probe"},
27 entt::attribute{"pretty_name", "Probe"},
28 })
29 .data<&reflection_probe_component::set_faces_per_frame, &reflection_probe_component::get_faces_per_frame>("faces_per_frame"_hs)
31 entt::attribute{"name", "faces_per_frame"},
32 entt::attribute{"pretty_name", "Faces Per Frame"},
33 entt::attribute{"min", 1},
34 entt::attribute{"max", 6},
35 })
36 .data<&reflection_probe_component::set_apply_prefilter, &reflection_probe_component::get_apply_prefilter>("apply_prefilter"_hs)
38 entt::attribute{"name", "apply_prefilter"},
39 entt::attribute{"pretty_name", "Apply Prefilter"},
40 entt::attribute{"tooltip", "Enables prefiltering which improves quality but may impact performance"},
41 });
42}
43
45{
46 try_save(ar, ser20::make_nvp("probe", obj.get_probe()));
47 try_save(ar, ser20::make_nvp("faces_per_frame", obj.get_faces_per_frame()));
48 try_save(ar, ser20::make_nvp("apply_prefilter", obj.get_apply_prefilter()));
49}
52
54{
55 reflection_probe probe;
56 if(try_load(ar, ser20::make_nvp("probe", probe)))
57 {
58 obj.set_probe(probe);
59 }
60
61 size_t faces_per_frame = 1;
62 if(try_load(ar, ser20::make_nvp("faces_per_frame", faces_per_frame)))
63 {
64 obj.set_faces_per_frame(faces_per_frame);
65 }
66
67 bool apply_prefilter = false;
68 if(try_load(ar, ser20::make_nvp("apply_prefilter", apply_prefilter)))
69 {
70 obj.set_apply_prefilter(apply_prefilter);
71 }
72}
75} // namespace unravel
Class that contains core reflection probe data, used for rendering and other purposes.
auto get_probe() const -> const reflection_probe &
Gets the reflection probe object.
void set_probe(const reflection_probe &probe)
Sets the reflection probe object.
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 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)
auto try_load(Archive &ar, ser20::NameValuePair< T > &&t, const hpp::source_location &loc=hpp::source_location::current()) -> bool
Structure representing a reflection probe.