Panda3D
Loading...
Searching...
No Matches
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 */
21BulletSoftBodyWorldInfo::
22BulletSoftBodyWorldInfo(btSoftBodyWorldInfo &info) : _info(info) {
23
24}
25
26/**
27 *
28 */
29void BulletSoftBodyWorldInfo::
30garbage_collect(int lifetime) {
31 LightMutexHolder holder(BulletWorld::get_global_lock());
32
33 _info.m_sparsesdf.GarbageCollect(lifetime);
34}
35
36/**
37 *
38 */
39void BulletSoftBodyWorldInfo::
40set_air_density(PN_stdfloat density) {
41 LightMutexHolder holder(BulletWorld::get_global_lock());
42
43 _info.air_density = (btScalar)density;
44}
45
46/**
47 *
48 */
49void BulletSoftBodyWorldInfo::
50set_water_density(PN_stdfloat density) {
51 LightMutexHolder holder(BulletWorld::get_global_lock());
52
53 _info.water_density = (btScalar)density;
54}
55
56/**
57 *
58 */
59void BulletSoftBodyWorldInfo::
60set_water_offset(PN_stdfloat offset) {
61 LightMutexHolder holder(BulletWorld::get_global_lock());
62
63 _info.water_offset = (btScalar)offset;
64}
65
66/**
67 *
68 */
69void BulletSoftBodyWorldInfo::
70set_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 */
80void BulletSoftBodyWorldInfo::
81set_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 */
91PN_stdfloat BulletSoftBodyWorldInfo::
92get_air_density() const {
93 LightMutexHolder holder(BulletWorld::get_global_lock());
94
95 return (PN_stdfloat)_info.air_density;
96}
97
98/**
99 *
100 */
101PN_stdfloat BulletSoftBodyWorldInfo::
102get_water_density() const {
103 LightMutexHolder holder(BulletWorld::get_global_lock());
104
105 return (PN_stdfloat)_info.water_density;
106}
107
108/**
109 *
110 */
111PN_stdfloat BulletSoftBodyWorldInfo::
112get_water_offset() const {
113 LightMutexHolder holder(BulletWorld::get_global_lock());
114
115 return (PN_stdfloat)_info.water_offset;
116}
117
118/**
119 *
120 */
121LVector3 BulletSoftBodyWorldInfo::
122get_water_normal() const {
123 LightMutexHolder holder(BulletWorld::get_global_lock());
124
125 return btVector3_to_LVector3(_info.water_normal);
126}
127
128/**
129 *
130 */
131LVector3 BulletSoftBodyWorldInfo::
132get_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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Similar to MutexHolder, but for a light mutex.