MathCommon.h 625 B

123456789101112131415161718192021222324252627
  1. #ifndef ANKI_SCRIPT_MATH_COMMON_H
  2. #define ANKI_SCRIPT_MATH_COMMON_H
  3. #include "anki/script/Common.h"
  4. namespace anki {
  5. template<typename ClassType, typename RetType,
  6. RetType (ClassType::*accessor)() const>
  7. RetType getM(const ClassType* t)
  8. {
  9. return (t->*accessor)();
  10. }
  11. template<typename ClassType, typename InType, InType& (ClassType::*accessor)()>
  12. void setM(ClassType* t, InType in)
  13. {
  14. (t->*accessor)() = in;
  15. }
  16. #define ANKI_BP_PROPERTY_MATH(ClassType__, name__) \
  17. .add_property(#name__, &getM<ClassType__, float, &ClassType__::name__>, \
  18. &setM<ClassType__, float, &ClassType__::name__>)
  19. } // end namespace
  20. #endif