13 entt::meta_factory<combine_mode>{}
14 .type(
"combine_mode"_hs)
19 .data<combine_mode::average>(
"average"_hs)
24 .data<combine_mode::minimum>(
"minimum"_hs)
29 .data<combine_mode::multiply>(
"multiply"_hs)
34 .data<combine_mode::maximum>(
"maximum"_hs)
41 entt::meta_factory<physics_material>{}
42 .type(
"physics_material"_hs)
47 .data<&physics_material::restitution>(
"restitution"_hs)
51 entt::attribute{
"tooltip",
"Restitution represents the bounciness of the material. A value of 0.0 means no bounce (perfectly inelastic collision), while 1.0 means perfect bounce (perfectly elastic collision)."},
55 .data<&physics_material::friction>(
"friction"_hs)
59 entt::attribute{
"tooltip",
"Friction represents the resistance to sliding motion. A value of 0.0 means no friction (perfectly slippery), while values around 1.0 represent typical real-world friction. Values slightly above 1.0 can simulate very high friction surfaces but should be used cautiously."},
63 .data<&physics_material::stiffness>(
"stiffness"_hs)
67 entt::attribute{
"tooltip",
"Stiffness represents how much force is required to deform the material. A high value means the material is very stiff (resists deformation)."},
71 .data<&physics_material::damping>(
"damping"_hs)
75 entt::attribute{
"tooltip",
"Damping represents energy loss in motion (e.g., through internal friction). A value of 0.0 means no damping (energy is conserved), while 1.0 represents very high damping (rapid energy loss). Typical values range from 0.01 to 0.3 for realistic simulations."},
79 .data<&physics_material::restitution_combine>(
"restitution_combine"_hs)
83 entt::attribute{
"tooltip",
"How to combine the restitution(bounce) values of both colliders in a collision pair tocalculate the total restitution(bounce) between them."},
85 .data<&physics_material::friction_combine>(
"friction_combine"_hs)
89 entt::attribute{
"tooltip",
"How to combine the friction values of both colliders in a collision pair tocalculate the total friction between them."},
95 try_save(ar, ser20::make_nvp(
"restitution", obj.restitution));
96 try_save(ar, ser20::make_nvp(
"friction", obj.friction));
97 try_save(ar, ser20::make_nvp(
"stiffness", obj.stiffness));
98 try_save(ar, ser20::make_nvp(
"damping", obj.damping));
99 try_save(ar, ser20::make_nvp(
"restitution_combine", obj.restitution_combine));
100 try_save(ar, ser20::make_nvp(
"friction_combine", obj.friction_combine));
107 try_load(ar, ser20::make_nvp(
"restitution", obj.restitution));
108 try_load(ar, ser20::make_nvp(
"friction", obj.friction));
109 try_load(ar, ser20::make_nvp(
"stiffness", obj.stiffness));
110 try_load(ar, ser20::make_nvp(
"damping", obj.damping));
111 try_load(ar, ser20::make_nvp(
"restitution_combine", obj.restitution_combine));
112 try_load(ar, ser20::make_nvp(
"friction_combine", obj.friction_combine));
119 std::ofstream stream(absolute_path);
123 try_save(ar, ser20::make_nvp(
"physics_material", *obj));
129 std::ofstream stream(absolute_path, std::ios::binary);
133 try_save(ar, ser20::make_nvp(
"physics_material", *obj));
139 std::ifstream stream(absolute_path);
143 try_load(ar, ser20::make_nvp(
"physics_material", *obj));
149 std::ifstream stream(absolute_path, std::ios::binary);
153 try_load(ar, ser20::make_nvp(
"physics_material", *obj));
attributes::value_type attribute
std::map< std::string, meta_any > attributes
auto create_oarchive_associative(std::ostream &stream)
BinaryInputArchive iarchive_binary_t
auto create_iarchive_associative(std::istream &stream)
simd::JSONOutputArchive oarchive_associative_t
BinaryOutputArchive oarchive_binary_t
simd::JSONInputArchive iarchive_associative_t
void save_to_file_bin(const std::string &absolute_path, const animation_clip &obj)
void load_from_file(const std::string &absolute_path, animation_clip &obj)
void save_to_file(const std::string &absolute_path, const animation_clip &obj)
void load_from_file_bin(const std::string &absolute_path, animation_clip &obj)
#define SAVE_INSTANTIATE(cls, Archive)
auto try_save(Archive &ar, ser20::NameValuePair< T > &&t, const hpp::source_location &loc=hpp::source_location::current()) -> bool
#define LOAD_INSTANTIATE(cls, Archive)
auto try_load(Archive &ar, ser20::NameValuePair< T > &&t, const hpp::source_location &loc=hpp::source_location::current()) -> bool
Represents the physical properties of a material.
std::shared_ptr< physics_material > sptr
Shared pointer to a physics material.