Panda3D
bulletSoftBodyWorldInfo.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 bulletSoftBodyWorldInfo.cxx
10  * @author enn0x
11  * @date 2010-03-04
12  */
13 
15 
16 #include "bulletWorld.h"
17 
18 /**
19  *
20  */
21 BulletSoftBodyWorldInfo::
22 BulletSoftBodyWorldInfo(btSoftBodyWorldInfo &info) : _info(info) {
23 
24 }
25 
26 /**
27  *
28  */
29 void BulletSoftBodyWorldInfo::
30 garbage_collect(int lifetime) {
31  LightMutexHolder holder(BulletWorld::get_global_lock());
32 
33  _info.m_sparsesdf.GarbageCollect(lifetime);
34 }
35 
36 /**
37  *
38  */
39 void BulletSoftBodyWorldInfo::
40 set_air_density(PN_stdfloat density) {
41  LightMutexHolder holder(BulletWorld::get_global_lock());
42 
43  _info.air_density = (btScalar)density;
44 }
45 
46 /**
47  *
48  */
49 void BulletSoftBodyWorldInfo::
50 set_water_density(PN_stdfloat density) {
51  LightMutexHolder holder(BulletWorld::get_global_lock());
52 
53  _info.water_density = (btScalar)density;
54 }
55 
56 /**
57  *
58  */
59 void BulletSoftBodyWorldInfo::
60 set_water_offset(PN_stdfloat offset) {
61  LightMutexHolder holder(BulletWorld::get_global_lock());
62 
63  _info.water_offset = (btScalar)offset;
64 }
65 
66 /**
67  *
68  */
69 void BulletSoftBodyWorldInfo::
70 set_water_normal(const LVector3 &normal) {
71  LightMutexHolder holder(BulletWorld::get_global_lock());
72 
73  nassertv(!normal.is_nan());
74  _info.water_normal.setValue(normal.get_x(), normal.get_y(), normal.get_z());
75 }
76 
77 /**
78  *
79  */
80 void BulletSoftBodyWorldInfo::
81 set_gravity(const LVector3 &gravity) {
82  LightMutexHolder holder(BulletWorld::get_global_lock());
83 
84  nassertv(!gravity.is_nan());
85  _info.m_gravity.setValue(gravity.get_x(), gravity.get_y(), gravity.get_z());
86 }
87 
88 /**
89  *
90  */
91 PN_stdfloat BulletSoftBodyWorldInfo::
92 get_air_density() const {
93  LightMutexHolder holder(BulletWorld::get_global_lock());
94 
95  return (PN_stdfloat)_info.air_density;
96 }
97 
98 /**
99  *
100  */
101 PN_stdfloat BulletSoftBodyWorldInfo::
102 get_water_density() const {
103  LightMutexHolder holder(BulletWorld::get_global_lock());
104 
105  return (PN_stdfloat)_info.water_density;
106 }
107 
108 /**
109  *
110  */
111 PN_stdfloat BulletSoftBodyWorldInfo::
112 get_water_offset() const {
113  LightMutexHolder holder(BulletWorld::get_global_lock());
114 
115  return (PN_stdfloat)_info.water_offset;
116 }
117 
118 /**
119  *
120  */
121 LVector3 BulletSoftBodyWorldInfo::
122 get_water_normal() const {
123  LightMutexHolder holder(BulletWorld::get_global_lock());
124 
125  return btVector3_to_LVector3(_info.water_normal);
126 }
127 
128 /**
129  *
130  */
131 LVector3 BulletSoftBodyWorldInfo::
132 get_gravity() const {
133  LightMutexHolder holder(BulletWorld::get_global_lock());
134 
135  return btVector3_to_LVector3(_info.m_gravity);
136 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Similar to MutexHolder, but for a light mutex.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.