baseForce.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // Filename: baseForce.h
  2. // Created by: charles (08Aug00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://www.panda3d.org/license.txt .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef BASEFORCE_H
  19. #define BASEFORCE_H
  20. #include <pandabase.h>
  21. #include <typedReferenceCount.h>
  22. #include <luse.h>
  23. #include "physicsObject.h"
  24. class ForceNode;
  25. ////////////////////////////////////////////////////////////////////
  26. // Class : BaseForce
  27. // Description : pure virtual base class for all forces that could
  28. // POSSIBLY exist.
  29. ////////////////////////////////////////////////////////////////////
  30. class EXPCL_PANDAPHYSICS BaseForce : public TypedReferenceCount {
  31. private:
  32. ForceNode *_force_node;
  33. bool _active;
  34. virtual LVector3f get_child_vector(const PhysicsObject *po) = 0;
  35. protected:
  36. BaseForce(bool active = true);
  37. BaseForce(const BaseForce &copy);
  38. PUBLISHED:
  39. virtual ~BaseForce(void);
  40. INLINE bool get_active(void) const;
  41. INLINE void set_active(bool active);
  42. virtual bool is_linear(void) const = 0;
  43. INLINE ForceNode *get_force_node(void) const;
  44. virtual LVector3f get_vector(const PhysicsObject *po) = 0;
  45. public:
  46. static TypeHandle get_class_type(void) {
  47. return _type_handle;
  48. }
  49. static void init_type(void) {
  50. TypedReferenceCount::init_type();
  51. register_type(_type_handle, "BaseForce",
  52. TypedReferenceCount::get_class_type());
  53. }
  54. virtual TypeHandle get_type(void) const {
  55. return get_class_type();
  56. }
  57. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  58. private:
  59. static TypeHandle _type_handle;
  60. friend class ForceNode;
  61. };
  62. #include "baseForce.I"
  63. #endif // BASEFORCE_H