Unravel Engine C++ Reference
Loading...
Searching...
No Matches
model.cpp
Go to the documentation of this file.
1#include "model.hpp"
2#include "material.hpp"
3#include "mesh.hpp"
4
7
11
12namespace unravel
13{
15{
16 entt::meta_factory<model>{}
17 .type("model"_hs)
19 entt::attribute{"name", "model"},
20 entt::attribute{"pretty_name", "Model"},
21 })
22 .data<&model::set_materials, &model::get_materials>("materials"_hs)
24 entt::attribute{"name", "materials"},
25 entt::attribute{"pretty_name", "Materials"},
26 entt::attribute{"tooltip", "Materials for this model."},
27 })
28 .data<&model::set_material_instances, &model::get_material_instances>("material_instances"_hs)
30 entt::attribute{"name", "material_instances"},
31 entt::attribute{"pretty_name", "Material Instances"},
32 entt::attribute{"tooltip", "Material instances for this model."},
33 })
34 .data<&model::set_lods, &model::get_lods>("lods"_hs)
36 entt::attribute{"name", "lods"},
37 entt::attribute{"pretty_name", "LOD"},
38 entt::attribute{"tooltip", "Levels of Detail."},
39 })
40 .data<&model::set_lod_limits, &model::get_lod_limits>("lod_limits"_hs)
42 entt::attribute{"name", "lod_limits"},
43 entt::attribute{"pretty_name", "LOD Ranges"},
44 entt::attribute{"tooltip", "LOD ranges in % of screen."},
45 entt::attribute{"format", "%.2f%%"},
46 entt::attribute{"min", 0},
47 entt::attribute{"max", 100},
48 });
49}
50
52{
53 try_save(ar, ser20::make_nvp("lods", obj.mesh_lods_));
54 try_save(ar, ser20::make_nvp("materials", obj.materials_));
55 try_save(ar, ser20::make_nvp("material_instances", obj.material_instances_));
56 try_save(ar, ser20::make_nvp("lod_limits", obj.lod_limits_));
57}
60
62{
63 try_load(ar, ser20::make_nvp("lods", obj.mesh_lods_));
64 try_load(ar, ser20::make_nvp("materials", obj.materials_));
65 try_load(ar, ser20::make_nvp("material_instances", obj.material_instances_));
66 try_load(ar, ser20::make_nvp("lod_limits", obj.lod_limits_));
67}
70} // namespace unravel
Structure describing a LOD group (set of meshes), LOD transitions, and their materials.
Definition model.h:42
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