linearRandomForce.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /**
  2. * PANDA 3D SOFTWARE
  3. * Copyright (c) Carnegie Mellon University. All rights reserved.
  4. *
  5. * All use of this software is subject to the terms of the revised BSD
  6. * license. You should have received a copy of this license along
  7. * with this source code in a file named "LICENSE."
  8. *
  9. * @file linearRandomForce.h
  10. * @author charles
  11. * @date 2000-06-19
  12. */
  13. #ifndef LINEARRANDOMFORCE_H
  14. #define LINEARRANDOMFORCE_H
  15. #include <stdlib.h>
  16. #include "cmath.h"
  17. #include "mathNumbers.h"
  18. #include "linearForce.h"
  19. /**
  20. * Pure virtual, parent to noiseForce and jitterForce
  21. */
  22. class EXPCL_PANDA_PHYSICS LinearRandomForce : public LinearForce {
  23. PUBLISHED:
  24. virtual ~LinearRandomForce();
  25. virtual void output(std::ostream &out) const;
  26. virtual void write(std::ostream &out, int indent=0) const;
  27. protected:
  28. static PN_stdfloat bounded_rand();
  29. static LVector3 random_unit_vector();
  30. LinearRandomForce(PN_stdfloat a = 1.0f, bool m = false);
  31. LinearRandomForce(const LinearRandomForce &copy);
  32. virtual LVector3 get_child_vector(const PhysicsObject *po) = 0;
  33. virtual LinearForce *make_copy() = 0;
  34. public:
  35. static TypeHandle get_class_type() {
  36. return _type_handle;
  37. }
  38. static void init_type() {
  39. LinearForce::init_type();
  40. register_type(_type_handle, "LinearRandomForce",
  41. LinearForce::get_class_type());
  42. }
  43. virtual TypeHandle get_type() const {
  44. return get_class_type();
  45. }
  46. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  47. private:
  48. static TypeHandle _type_handle;
  49. };
  50. #include "linearRandomForce.I"
  51. #endif // LINEARRANDOMFORCE_H