Toast Engine
Loading...
Searching...
No Matches
physics_material.hpp
Go to the documentation of this file.
1
8
9#pragma once
10#include <toast/assets/data.hpp>
11
12namespace assets {
13
14class TOAST_API PhysicsMaterial : public Data {
15public:
16 explicit PhysicsMaterial(const toml::table& table, Handle<Schema> schema = {});
17
18 [[nodiscard]]
19 auto type() const -> std::string_view override {
20 return "physics_material";
21 }
22
23 [[nodiscard]]
24 auto get() const -> toml::table;
25 [[nodiscard]]
26 auto restitution() const noexcept -> float;
27 [[nodiscard]]
28 auto staticFriction() const noexcept -> float;
29 [[nodiscard]]
30 auto dynamicFriction() const noexcept -> float;
31 [[nodiscard]]
32 auto rollingFriction() const noexcept -> float;
33 [[nodiscard]]
34 auto spinFriction() const noexcept -> float;
35
36protected:
37 void onReloaded() override;
38
39private:
40 void readFields();
41
42 float m_restitution = 0.0f;
43 float m_static_friction = 0.0f;
44 float m_dynamic_friction = 0.0f;
45 float m_rolling_friction = 0.0f;
46 float m_spin_friction = 0.0f;
47};
48
49}
Type-safe smart pointer for assets.
Definition core_types.hpp:149
Typed data asset backed by schema-driven TOML.