PhysicsObject.h 998 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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_PHYSICS_OBJECT_H
  6. #define ANKI_PHYSICS_PHYSICS_OBJECT_H
  7. #include "anki/physics/Common.h"
  8. namespace anki {
  9. /// @addtogroup physics
  10. /// @{
  11. /// Base of all physics objects.
  12. class PhysicsObject
  13. {
  14. public:
  15. /// Type of the physics object.
  16. enum class Type: U8
  17. {
  18. COLLISION_SHAPE,
  19. BODY,
  20. JOINT,
  21. PLAYER_CONTROLLER,
  22. COUNT
  23. };
  24. PhysicsObject(Type type, PhysicsWorld* world)
  25. : m_world(world),
  26. m_type(type)
  27. {
  28. ANKI_ASSERT(m_world);
  29. }
  30. virtual ~PhysicsObject()
  31. {
  32. ANKI_ASSERT(m_markedForDeletion == true);
  33. }
  34. Type getType() const
  35. {
  36. return m_type;
  37. }
  38. void setMarkedForDeletion();
  39. Bool getMarkedForDeletion() const
  40. {
  41. return m_markedForDeletion;
  42. }
  43. protected:
  44. PhysicsWorld* m_world = nullptr;
  45. private:
  46. Type m_type;
  47. Bool8 m_markedForDeletion = false;
  48. };
  49. /// @}
  50. } // end namespace anki
  51. #endif