linearRandomForce.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // Filename: linearRandomForce.h
  2. // Created by: charles (19Jun00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, 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://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef LINEARRANDOMFORCE_H
  19. #define LINEARRANDOMFORCE_H
  20. #include <stdlib.h>
  21. #include <math.h>
  22. #include "linearForce.h"
  23. ////////////////////////////////////////////////////////////////////
  24. // Class : LinearRandomForce
  25. // Description : Pure virtual, parent to noiseForce and jitterForce
  26. ////////////////////////////////////////////////////////////////////
  27. class EXPCL_PANDAPHYSICS LinearRandomForce : public LinearForce {
  28. PUBLISHED:
  29. virtual ~LinearRandomForce();
  30. virtual void output(ostream &out) const;
  31. virtual void write(ostream &out, unsigned int indent=0) const;
  32. protected:
  33. static float bounded_rand();
  34. static LVector3f random_unit_vector();
  35. LinearRandomForce(float a = 1.0f, bool m = false);
  36. LinearRandomForce(const LinearRandomForce &copy);
  37. virtual LVector3f get_child_vector(const PhysicsObject *po) = 0;
  38. virtual LinearForce *make_copy() = 0;
  39. public:
  40. static TypeHandle get_class_type() {
  41. return _type_handle;
  42. }
  43. static void init_type() {
  44. LinearForce::init_type();
  45. register_type(_type_handle, "LinearRandomForce",
  46. LinearForce::get_class_type());
  47. }
  48. virtual TypeHandle get_type() const {
  49. return get_class_type();
  50. }
  51. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  52. private:
  53. static TypeHandle _type_handle;
  54. };
  55. #include "linearRandomForce.I"
  56. #endif // LINEARRANDOMFORCE_H