PlayRho  2.0.0
An interactive physics engine & library.
ShapeModel.hpp File Reference

Definition of the ShapeModel class and related code. More...

#include <type_traits>
#include <utility>
#include <playrho/d2/detail/ShapeConcept.hpp>
Include dependency graph for ShapeModel.hpp:
This graph shows which files directly or indirectly include this file:

Classes

struct  playrho::d2::detail::IsValidShapeType< T, class >
 An "is valid shape type" trait. More...
 
struct  playrho::d2::detail::IsValidShapeType< T, std::void_t< decltype(GetChildCount(std::declval< T >())), decltype(GetChild(std::declval< T >(), std::declval< ChildCounter >())), decltype(GetMassData(std::declval< T >())), decltype(GetVertexRadius(std::declval< T >(), std::declval< ChildCounter >())), decltype(GetDensity(std::declval< T >())), decltype(GetFriction(std::declval< T >())), decltype(GetRestitution(std::declval< T >())), decltype(std::declval< T >()==std::declval< T >()), decltype(std::declval< DecayedTypeIfNotSame< T, Shape >>()), decltype(std::is_constructible_v< DecayedTypeIfNotSame< T, Shape >, T >)> >
 An "is valid shape type" trait. More...
 
struct  playrho::d2::detail::ShapeModel< T >
 Internal model configuration concept. More...
 

Namespaces

 playrho
 
 playrho::d2
 
 playrho::d2::detail
 

Typedefs

template<class T >
using playrho::d2::detail::RotateReturnType = decltype(Rotate(std::declval< T & >(), std::declval< Angle >()))
 Return type for a Rotate function taking an arbitrary type and a value. More...
 
template<class T >
using playrho::d2::detail::ScaleReturnType = decltype(Scale(std::declval< T & >(), std::declval< Vec2 >()))
 Return type for a Scale function taking an arbitrary type and a value. More...
 
template<class T >
using playrho::d2::detail::SetDensityReturnType = decltype(SetDensity(std::declval< T & >(), std::declval< NonNegative< AreaDensity > >()))
 Return type for a SetDensity function taking an arbitrary type and a value. More...
 
template<class T >
using playrho::d2::detail::SetFilterReturnType = decltype(SetFilter(std::declval< T & >(), std::declval< Filter >()))
 Return type for a SetFilter function taking an arbitrary type and a value. More...
 
template<class T >
using playrho::d2::detail::SetFrictionReturnType = decltype(SetFriction(std::declval< T & >(), std::declval< Real >()))
 Return type for a SetFriction function taking an arbitrary type and a value. More...
 
template<class T >
using playrho::d2::detail::SetRestitutionReturnType = decltype(SetRestitution(std::declval< T & >(), std::declval< Real >()))
 Return type for a SetRestitution function taking an arbitrary type and a value. More...
 
template<class T >
using playrho::d2::detail::SetSensorReturnType = decltype(SetSensor(std::declval< T & >(), std::declval< bool >()))
 Return type for a SetSensor function taking an arbitrary type and a value. More...
 
template<class T >
using playrho::d2::detail::TranslateReturnType = decltype(Translate(std::declval< T & >(), std::declval< Length2 >()))
 Return type for a Translate function taking an arbitrary type and a value. More...
 

Functions

template<class T >
auto playrho::d2::detail::Rotate (T &, const UnitVec &value) -> std::enable_if_t< IsValidShapeTypeV< T > &&!HasRotateV< T >, void >
 Fallback rotate function that throws unless the given value has no effect.
 
template<class T >
auto playrho::d2::detail::Scale (T &, const Vec2 &value) -> std::enable_if_t< IsValidShapeTypeV< T > &&!HasScaleV< T >, void >
 Fallback scale function that throws unless the given value has no effect.
 
template<class T >
auto playrho::d2::detail::SetDensity (T &o, NonNegative< AreaDensity > value) -> std::enable_if_t< IsValidShapeTypeV< T > &&!HasSetDensityV< T >, void >
 Fallback density setter that throws unless given the same value as current.
 
template<class T >
auto playrho::d2::detail::SetFilter (T &o, Filter value) -> std::enable_if_t< IsValidShapeTypeV< T > &&!HasSetFilterV< T >, void >
 Fallback filter setter that throws unless given the same value as current.
 
template<class T >
auto playrho::d2::detail::SetFriction (T &o, NonNegative< Real > value) -> std::enable_if_t< IsValidShapeTypeV< T > &&!HasSetFrictionV< T >, void >
 Fallback friction setter that throws unless given the same value as current.
 
template<class T >
auto playrho::d2::detail::SetRestitution (T &o, Real value) -> std::enable_if_t< IsValidShapeTypeV< T > &&!HasSetRestitutionV< T >, void >
 Fallback restitution setter that throws unless given the same value as current.
 
template<class T >
auto playrho::d2::detail::SetSensor (T &o, bool value) -> std::enable_if_t< IsValidShapeTypeV< T > &&!HasSetSensorV< T >, void >
 Fallback sensor setter that throws unless given the same value as current.
 
template<class T >
auto playrho::d2::detail::Translate (T &, const Length2 &value) -> std::enable_if_t< IsValidShapeTypeV< T > &&!HasTranslateV< T >, void >
 Fallback translate function that throws unless the given value has no effect.
 

Variables

template<class T >
constexpr bool playrho::d2::detail::HasRotateV = playrho::detail::is_detected_v<RotateReturnType, T>
 Helper variable template on whether Rotate(T&, Angle) is found.
 
template<class T >
constexpr bool playrho::d2::detail::HasScaleV = playrho::detail::is_detected_v<ScaleReturnType, T>
 Helper variable template on whether Scale(T&, Vec2) is found.
 
template<class T >
constexpr bool playrho::d2::detail::HasSetDensityV = playrho::detail::is_detected_v<SetDensityReturnType, T>
 Helper variable template on whether SetDensity(T&, NonNegative<AreaDensity>) is found.
 
template<class T >
constexpr bool playrho::d2::detail::HasSetFilterV = playrho::detail::is_detected_v<SetFilterReturnType, T>
 Helper variable template on whether SetFilter(T&, Filter) is found.
 
template<class T >
constexpr bool playrho::d2::detail::HasSetFrictionV = playrho::detail::is_detected_v<SetFrictionReturnType, T>
 Helper variable template on whether SetFriction(T&, Real) is found.
 
template<class T >
constexpr bool playrho::d2::detail::HasSetRestitutionV = playrho::detail::is_detected_v<SetRestitutionReturnType, T>
 Helper variable template on whether SetRestitution(T&, Real) is found.
 
template<class T >
constexpr bool playrho::d2::detail::HasSetSensorV = playrho::detail::is_detected_v<SetSensorReturnType, T>
 Helper variable template on whether SetSensor(T&, bool) is found.
 
template<class T >
constexpr bool playrho::d2::detail::HasTranslateV = playrho::detail::is_detected_v<TranslateReturnType, T>
 Helper variable template on whether Translate(T&, Length2) is found.
 
template<class T >
constexpr bool playrho::d2::detail::IsValidShapeTypeV = IsValidShapeType<T>::value
 Boolean value for whether the specified type is a valid shape type. More...
 

Detailed Description

Definition of the ShapeModel class and related code.