Panda3D
forceNode.I
1 // Filename: forceNode.I
2 // Created by: charles (02Aug00)
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 
15 ////////////////////////////////////////////////////////////////////
16 // Function : clear
17 // Access : public
18 ////////////////////////////////////////////////////////////////////
19 INLINE void ForceNode::
20 clear() {
21  _forces.erase(_forces.begin(), _forces.end());
22 }
23 
24 ////////////////////////////////////////////////////////////////////
25 // Function : get_force
26 // Access : public
27 ////////////////////////////////////////////////////////////////////
28 INLINE BaseForce *ForceNode::
29 get_force(int index) const {
30  nassertr(index >= 0 && index < (int)_forces.size(),
31  (BaseForce *) NULL);
32  return _forces[index];
33 }
34 
35 ////////////////////////////////////////////////////////////////////
36 // Function : get_num_forces
37 // Access : public
38 ////////////////////////////////////////////////////////////////////
39 INLINE int ForceNode::
40 get_num_forces() const {
41  return _forces.size();
42 }
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  force->_force_node_path = NodePath(this);
53 }
pure virtual base class for all forces that could POSSIBLY exist.
Definition: baseForce.h:32
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:165