Panda3D
bulletSoftBodyConfig.cxx
1 // Filename: bulletSoftBodyConfig.cxx
2 // Created by: enn0x (12Apr10)
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 #include "bulletSoftBodyConfig.h"
16 
17 ////////////////////////////////////////////////////////////////////
18 // Function: BulletSoftBodyConfig::Constructor
19 // Access: Public
20 // Description:
21 ////////////////////////////////////////////////////////////////////
22 BulletSoftBodyConfig::
23 BulletSoftBodyConfig(btSoftBody::Config &cfg) : _cfg(cfg) {
24 
25 }
26 
27 ////////////////////////////////////////////////////////////////////
28 // Function: BulletSoftBodyConfig::clear_collisions
29 // Access: Published
30 // Description:
31 ////////////////////////////////////////////////////////////////////
32 void BulletSoftBodyConfig::
33 clear_all_collision_flags() {
34 
35  _cfg.collisions = 0;
36 }
37 
38 ////////////////////////////////////////////////////////////////////
39 // Function: BulletSoftBodyConfig::set_collisions
40 // Access: Published
41 // Description:
42 ////////////////////////////////////////////////////////////////////
43 void BulletSoftBodyConfig::
44 set_collision_flag(CollisionFlag flag, bool value) {
45 
46  if (value == true) {
47  _cfg.collisions |= flag;
48  }
49  else {
50  _cfg.collisions &= ~(flag);
51  }
52 }
53 
54 ////////////////////////////////////////////////////////////////////
55 // Function: BulletSoftBodyConfig::get_collisions
56 // Access: Published
57 // Description:
58 ////////////////////////////////////////////////////////////////////
59 bool BulletSoftBodyConfig::
60 get_collision_flag(CollisionFlag flag) const {
61 
62  return (_cfg.collisions & flag) ? true : false;
63 }
64 
65 ////////////////////////////////////////////////////////////////////
66 // Function: BulletSoftBodyConfig::set_aero_model
67 // Access: Published
68 // Description:
69 ////////////////////////////////////////////////////////////////////
70 void BulletSoftBodyConfig::
71 set_aero_model(AeroModel value) {
72 
73  _cfg.aeromodel = (btSoftBody::eAeroModel::_)value;
74 }
75 
76 ////////////////////////////////////////////////////////////////////
77 // Function: BulletSoftBodyConfig::get_aero_model
78 // Access: Published
79 // Description:
80 ////////////////////////////////////////////////////////////////////
81 BulletSoftBodyConfig::AeroModel BulletSoftBodyConfig::
82 get_aero_model() const {
83 
84  return (AeroModel)_cfg.aeromodel;
85 }
86