Common.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright (C) 2009-2015, Panagiotis Christopoulos Charitos.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #ifndef ANKI_PHYSICS_COMMON_H
  6. #define ANKI_PHYSICS_COMMON_H
  7. #include "anki/util/StdTypes.h"
  8. #include "anki/util/Enum.h"
  9. #include "anki/Math.h"
  10. #include <Newton.h>
  11. namespace anki {
  12. // Forward
  13. class PhysicsWorld;
  14. class PhysicsCollisionShape;
  15. /// @addtogroup physics
  16. /// @{
  17. /// Material types.
  18. enum class PhysicsMaterialBit: U16
  19. {
  20. NONE = 0,
  21. STATIC_GEOMETRY = 1 << 0,
  22. DYNAMIC_GEOMETRY = 1 << 1,
  23. RAGDOLL = 1 << 2,
  24. PARTICLES = 1 << 3
  25. };
  26. ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(PhysicsMaterialBit, inline)
  27. /// Convert newton to AnKi.
  28. ANKI_USE_RESULT inline Quat toAnki(const Quat& q)
  29. {
  30. return Quat(q.y(), q.z(), q.w(), q.x());
  31. }
  32. /// Convert AnKi to Newton.
  33. ANKI_USE_RESULT inline Quat toNewton(const Quat& q)
  34. {
  35. return Quat(q.w(), q.x(), q.y(), q.z());
  36. }
  37. /// Convert newton to AnKi.
  38. ANKI_USE_RESULT inline Mat4 toAnki(const Mat4& m)
  39. {
  40. return m.getTransposed();
  41. }
  42. /// Convert AnKi to Newton.
  43. ANKI_USE_RESULT inline Mat4 toNewton(const Mat4& m)
  44. {
  45. return m.getTransposed();
  46. }
  47. /// @}
  48. } // end namespace anki
  49. #endif