linearVectorForce.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Filename: linearVectorForce.h
  2. // Created by: charles (13Jun00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) Carnegie Mellon University. All rights reserved.
  8. //
  9. // All use of this software is subject to the terms of the revised BSD
  10. // license. You should have received a copy of this license along
  11. // with this source code in a file named "LICENSE."
  12. //
  13. ////////////////////////////////////////////////////////////////////
  14. #ifndef LINEARVECTORFORCE_H
  15. #define LINEARVECTORFORCE_H
  16. #include "linearForce.h"
  17. ////////////////////////////////////////////////////////////////
  18. // Class : LinearVectorForce
  19. // Description : Simple directed vector force. Suitable for
  20. // gravity, non-turbulent wind, etc...
  21. ////////////////////////////////////////////////////////////////
  22. class EXPCL_PANDAPHYSICS LinearVectorForce : public LinearForce {
  23. PUBLISHED:
  24. LinearVectorForce(const LVector3f& vec, float a = 1.0f, bool mass = false);
  25. LinearVectorForce(const LinearVectorForce &copy);
  26. LinearVectorForce(float x = 0.0f, float y = 0.0f, float z = 0.0f,
  27. float a = 1.0f, bool mass = false);
  28. virtual ~LinearVectorForce();
  29. INLINE void set_vector(const LVector3f& v);
  30. INLINE void set_vector(float x, float y, float z);
  31. INLINE LVector3f get_local_vector() const;
  32. virtual void output(ostream &out) const;
  33. virtual void write(ostream &out, unsigned int indent=0) const;
  34. public:
  35. INLINE LinearVectorForce& operator += (const LinearVectorForce &other);
  36. private:
  37. LVector3f _fvec;
  38. virtual LinearForce *make_copy();
  39. virtual LVector3f get_child_vector(const PhysicsObject *po);
  40. public:
  41. static TypeHandle get_class_type() {
  42. return _type_handle;
  43. }
  44. static void init_type() {
  45. LinearForce::init_type();
  46. register_type(_type_handle, "LinearVectorForce",
  47. LinearForce::get_class_type());
  48. }
  49. virtual TypeHandle get_type() const {
  50. return get_class_type();
  51. }
  52. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  53. private:
  54. static TypeHandle _type_handle;
  55. };
  56. #include "linearVectorForce.I"
  57. #endif // LINEARVECTORFORCE_H