Panda3D
physicalNode.I
Go to the documentation of this file.
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 physicalNode.I
10  * @author charles
11  * @date 2000-08-01
12  */
13 
14 /**
15 
16  */
17 INLINE void PhysicalNode::
18 clear() {
19  for (Physical *physical : _physicals) {
20  nassertd(physical->_physical_node == this) continue;
21  physical->_physical_node = nullptr;
22  }
23  _physicals.clear();
24 }
25 
26 /**
27 
28  */
29 INLINE Physical *PhysicalNode::
30 get_physical(size_t index) const {
31  nassertr(index < _physicals.size(), nullptr);
32  return _physicals[index];
33 }
34 
35 /**
36 
37  */
38 INLINE size_t PhysicalNode::
39 get_num_physicals() const {
40  return _physicals.size();
41 }
42 
43 /**
44  * Adds a Physical to this PhysicalNode. If it is already added to this node,
45  * does nothing. It is an error to add a Physical to multiple PhysicalNodes.
46  */
47 INLINE void PhysicalNode::
48 add_physical(Physical *physical) {
49  if (physical->_physical_node != this) {
50  nassertv(physical->_physical_node == nullptr);
51  _physicals.push_back(physical);
52  physical->_physical_node = this;
53  }
54 }
Graph node that encapsulated a series of physical objects.
Definition: physicalNode.h:28
void add_physical(Physical *physical)
Adds a Physical to this PhysicalNode.
Definition: physicalNode.I:48
Defines a set of physically modeled attributes.
Definition: physical.h:37