forceNode.I 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Filename: forceNode.I
  2. // Created by: charles (02Aug00)
  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. ////////////////////////////////////////////////////////////////////
  19. // Function : clear
  20. // Access : public
  21. ////////////////////////////////////////////////////////////////////
  22. INLINE void ForceNode::
  23. clear(void) {
  24. _forces.erase(_forces.begin(), _forces.end());
  25. }
  26. ////////////////////////////////////////////////////////////////////
  27. // Function : get_force
  28. // Access : public
  29. ////////////////////////////////////////////////////////////////////
  30. INLINE BaseForce *ForceNode::
  31. get_force(int index) const {
  32. nassertr(index >= 0 && index < (int)_forces.size(),
  33. (BaseForce *) NULL);
  34. return _forces[index];
  35. }
  36. ////////////////////////////////////////////////////////////////////
  37. // Function : get_num_forces
  38. // Access : public
  39. ////////////////////////////////////////////////////////////////////
  40. INLINE int ForceNode::
  41. get_num_forces(void) const {
  42. return _forces.size();
  43. }
  44. ////////////////////////////////////////////////////////////////////
  45. // Function : add_force
  46. // Access : public
  47. ////////////////////////////////////////////////////////////////////
  48. INLINE void ForceNode::
  49. add_force(BaseForce *force) {
  50. _forces.push_back(force);
  51. force->_force_node = this;
  52. }