22 #ifndef PLAYRHO_DYNAMICS_JOINTS_JOINT_HPP
23 #define PLAYRHO_DYNAMICS_JOINTS_JOINT_HPP
27 #include <unordered_map>
34 struct ConstraintSolverConf;
59 std::vector<std::pair<const Body*, BodyConstraintPtr>>;
61 std::unordered_map<const Body*, BodyConstraint*>;
100 virtual ~Joint() noexcept = default;
158 using FlagsType = std::uint8_t;
164 e_islandFlag = 0x01u,
166 e_collideConnectedFlag = 0x02u
170 static FlagsType GetFlags(
const JointConf& def) noexcept;
173 template <
class OUT_TYPE,
class IN_TYPE>
174 static OUT_TYPE* Create(IN_TYPE def)
176 if (OUT_TYPE::IsOkay(def))
178 return new OUT_TYPE(def);
185 static Joint* Create(
const JointConf& def);
189 static void Destroy(
const Joint* joint) noexcept;
196 const ConstraintSolverConf& conf) = 0;
208 const ConstraintSolverConf& conf)
const = 0;
211 bool IsIslanded() const noexcept;
214 void SetIslanded() noexcept;
217 void UnsetIslanded() noexcept;
222 FlagsType m_flags = 0u;
247 return (m_flags & e_collideConnectedFlag) != 0u;
250 inline bool Joint::IsIslanded() const noexcept
252 return (m_flags & e_islandFlag) != 0u;
255 inline void Joint::SetIslanded() noexcept
257 m_flags |= e_islandFlag;
260 inline void Joint::UnsetIslanded() noexcept
262 m_flags &= ~e_islandFlag;
279 #ifdef PLAYRHO_PROVIDE_VECTOR_AT
297 j.SetMotorSpeed(j.GetMotorSpeed() + delta);
303 #endif // PLAYRHO_DYNAMICS_JOINTS_JOINT_HPP