Panda3D
bulletSoftBodyShape.cxx
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 bulletSoftBodyShape.cxx
10  * @author enn0x
11  * @date 2010-05-06
12  */
13 
14 #include "bulletSoftBodyShape.h"
15 
16 #include "bulletSoftBodyNode.h"
17 #include "bulletWorld.h"
18 
19 TypeHandle BulletSoftBodyShape::_type_handle;
20 
21 /**
22  *
23  */
24 BulletSoftBodyShape::
25 BulletSoftBodyShape(btSoftBodyCollisionShape *shapePtr) {
26 
27  _shape = shapePtr;
28  _shape->setUserPointer(this);
29 }
30 
31 /**
32  *
33  */
34 btCollisionShape *BulletSoftBodyShape::
35 ptr() const {
36 
37  return _shape;
38 }
39 
40 /**
41  *
42  */
43 BulletSoftBodyNode *BulletSoftBodyShape::
44 get_body() const {
45  LightMutexHolder holder(BulletWorld::get_global_lock());
46 
47  if (_shape->m_body) {
48  return (BulletSoftBodyNode *)_shape->m_body->getUserPointer();
49  }
50  else
51  {
52  return nullptr;
53  }
54 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Similar to MutexHolder, but for a light mutex.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81