linearRandomForce.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Filename: linearRandomForce.h
  2. // Created by: charles (19Jun00)
  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 LINEARRANDOMFORCE_H
  15. #define LINEARRANDOMFORCE_H
  16. #include <stdlib.h>
  17. #include <math.h>
  18. #include "linearForce.h"
  19. ////////////////////////////////////////////////////////////////////
  20. // Class : LinearRandomForce
  21. // Description : Pure virtual, parent to noiseForce and jitterForce
  22. ////////////////////////////////////////////////////////////////////
  23. class EXPCL_PANDAPHYSICS LinearRandomForce : public LinearForce {
  24. PUBLISHED:
  25. virtual ~LinearRandomForce();
  26. virtual void output(ostream &out) const;
  27. virtual void write(ostream &out, unsigned int indent=0) const;
  28. protected:
  29. static float bounded_rand();
  30. static LVector3f random_unit_vector();
  31. LinearRandomForce(float a = 1.0f, bool m = false);
  32. LinearRandomForce(const LinearRandomForce &copy);
  33. virtual LVector3f get_child_vector(const PhysicsObject *po) = 0;
  34. virtual LinearForce *make_copy() = 0;
  35. public:
  36. static TypeHandle get_class_type() {
  37. return _type_handle;
  38. }
  39. static void init_type() {
  40. LinearForce::init_type();
  41. register_type(_type_handle, "LinearRandomForce",
  42. LinearForce::get_class_type());
  43. }
  44. virtual TypeHandle get_type() const {
  45. return get_class_type();
  46. }
  47. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  48. private:
  49. static TypeHandle _type_handle;
  50. };
  51. #include "linearRandomForce.I"
  52. #endif // LINEARRANDOMFORCE_H