RioEngine  0.1
My first attempt to create a 3D WYSIWYG Game Engine
cbulletproperties.cpp
Go to the documentation of this file.
1 //--------------------------------------------------------------- @License begins
2 // RioEngine: The late night Coke -without whores- debugging sessions
3 // 2012-2015 Leopoldo Lomas Flores. Torreon, Coahuila. MEXICO
4 // leopoldolomas [at] gmail
5 // www.rioengine.com
6 // www.leopoldolomas.info
7 // "You have a problem, you face it like a man."
8 //
9 // This is free and unencumbered software released into the public domain.
10 //
11 // Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
12 // software, either in source code form or as a compiled binary, for any purpose,
13 // commercial or non-commercial, and by any means.
14 //
15 // In jurisdictions that recognize copyright laws, the author or authors of this
16 // software dedicate any and all copyright interest in the software to the public
17 // domain. We make this dedication for the benefit of the public at large and to
18 // the detriment of our heirs and successors. We intend this dedication to be
19 // an overt act of relinquishment in perpetuity of all present and future
20 // rights to this software under copyright law.
21 //
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS
24 // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
26 // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 //--------------------------------------------------------------- @License ends
29 
30 #include "cbulletproperties.h"
31 #include "misc/btcustom.h"
32 
33 //-----------------------------------------------------------------------------
34 
36  m_shapeType = CBulletProperties::ShapeTypes::Box;
37  m_activationState = CBulletProperties::ActivationState::ActiveTag;
38  m_linearFactor = btCustom::zero_vector();
39  m_angularFactor = btCustom::zero_vector();
40  m_size = btCustom::zero_vector();
41  m_planeNormal = btCustom::zero_vector();
42  m_physicsEnabled = false;
43  m_vertices = "";
44  m_mass = 0;
45  m_restitution = 0;
46  m_friction = 0;
47  m_height = 0;
48  m_radius = 0;
49  m_planeConstant = 0;
50  m_rigidBody = NULL;
51 }
52 
53 //-----------------------------------------------------------------------------
54 
56  copyValuesFromObject(original_obj);
57 }
58 
59 //-----------------------------------------------------------------------------
60 
62  m_physicsEnabled = original_obj.physicsEnabled();
63  m_mass = original_obj.mass();
64  m_restitution = original_obj.restitution();
65  m_friction = original_obj.friction();
66  m_shapeType = original_obj.shapeType();
67  m_activationState = original_obj.activationState();
68  m_height = original_obj.height();
69  m_radius = original_obj.radius();
70  m_planeNormal = original_obj.planeNormal();
71  m_planeConstant = original_obj.planeConstant();
72  m_vertices = original_obj.vertices();
73  m_size = original_obj.size();
74  m_rigidBody = NULL;
75 }
76 
77 //-----------------------------------------------------------------------------
78 
80  if (this == &original_obj) {
81  return *this;
82  }
83 
84  copyValuesFromObject(original_obj);
85 
86  return *this;
87 }
88 
89 //-----------------------------------------------------------------------------
90 
92  return m_physicsEnabled;
93 }
94 
95 //-----------------------------------------------------------------------------
96 
97 void CBulletProperties::setPhysicsEnabled(bool physics_enabled) {
98  m_physicsEnabled = physics_enabled;
99 }
100 
101 //-----------------------------------------------------------------------------
102 
103 const float CBulletProperties::mass() const {
104  return m_mass;
105 }
106 
107 //-----------------------------------------------------------------------------
108 
109 void CBulletProperties::setMass(float mass) {
110  m_mass = mass;
111 }
112 
113 //-----------------------------------------------------------------------------
114 
115 const float CBulletProperties::restitution() const {
116  return m_restitution;
117 }
118 
119 //-----------------------------------------------------------------------------
120 
121 void CBulletProperties::setRestitution(float restitution) {
122  m_restitution = restitution;
123 }
124 
125 //-----------------------------------------------------------------------------
126 
127 const float CBulletProperties::friction() const {
128  return m_friction;
129 }
130 
131 //-----------------------------------------------------------------------------
132 
133 void CBulletProperties::setFriction(float friction) {
134  m_friction = friction;
135 }
136 
137 //-----------------------------------------------------------------------------
138 
139 const btVector3& CBulletProperties::linearFactor() const {
140  return m_linearFactor;
141 }
142 
143 //-----------------------------------------------------------------------------
144 
145 void CBulletProperties::setLinearFactor(const btVector3 &linear_factor) {
146  m_linearFactor = linear_factor;
147 }
148 
149 //-----------------------------------------------------------------------------
150 
151 const btVector3& CBulletProperties::angularFactor() const {
152  return m_angularFactor;
153 }
154 
155 //-----------------------------------------------------------------------------
156 
157 void CBulletProperties::setAngularFactor(const btVector3 &angular_factor) {
158  m_angularFactor = angular_factor;
159 }
160 
161 //-----------------------------------------------------------------------------
162 
164  return m_shapeType;
165 }
166 
167 //-----------------------------------------------------------------------------
168 
170  m_shapeType = shape_type;
171 }
172 
173 //-----------------------------------------------------------------------------
174 
175 const float CBulletProperties::height() const {
176  return m_height;
177 }
178 
179 //-----------------------------------------------------------------------------
180 
181 void CBulletProperties::setHeight(float height) {
182  m_height = height;
183 }
184 
185 //-----------------------------------------------------------------------------
186 
187 const float CBulletProperties::radius() const {
188  return m_radius;
189 }
190 
191 //-----------------------------------------------------------------------------
192 
193 void CBulletProperties::setRadius(float radius) {
194  m_radius = radius;
195 }
196 
197 //-----------------------------------------------------------------------------
198 
199 const btVector3& CBulletProperties::size() const {
200  return m_size;
201 }
202 
203 //-----------------------------------------------------------------------------
204 
205 void CBulletProperties::setSize(const btVector3 &size) {
206  m_size = size;
207 }
208 
209 //-----------------------------------------------------------------------------
210 
211 const btVector3& CBulletProperties::planeNormal() const {
212  return m_planeNormal;
213 }
214 
215 //-----------------------------------------------------------------------------
216 
217 void CBulletProperties::setPlaneNormal(const btVector3 &plane_normal) {
218  m_planeNormal = plane_normal;
219 }
220 
221 //-----------------------------------------------------------------------------
222 
223 const float CBulletProperties::planeConstant() const {
224  return m_planeConstant;
225 }
226 
227 //-----------------------------------------------------------------------------
228 
229 void CBulletProperties::setPlaneConstant(float plane_constant) {
230  m_planeConstant = plane_constant;
231 }
232 
233 //-----------------------------------------------------------------------------
234 
235 const QString& CBulletProperties::vertices() const {
236  return m_vertices;
237 }
238 
239 //-----------------------------------------------------------------------------
240 
241 void CBulletProperties::setVertices(const QString& vertices) {
242  m_vertices = vertices;
243 }
244 
245 //-----------------------------------------------------------------------------
246 
247 btRigidBody* CBulletProperties::rigidBody() const {
248  return m_rigidBody;
249 }
250 
251 //-----------------------------------------------------------------------------
252 
253 void CBulletProperties::setRigidBody(btRigidBody* rigid_body) {
254  if (rigid_body) {
255  // TODO
256  }
257  m_rigidBody = rigid_body;
258 }
259 
260 //-----------------------------------------------------------------------------
261 
263  return m_activationState;
264 }
265 
266 //-----------------------------------------------------------------------------
267 
269  m_activationState = activationState;
270 }
271 
272 //-----------------------------------------------------------------------------
273 
275 }
const float planeConstant() const
void setPhysicsEnabled(bool physics_enabled)
void setFriction(float friction)
void setRadius(float radius)
void setRigidBody(btRigidBody *rigid_body)
const float height() const
btVector3 zero_vector()
Definition: btcustom.cpp:26
const btVector3 & linearFactor() const
const ShapeTypes shapeType() const
const float friction() const
void setLinearFactor(const btVector3 &linear_factor)
virtual void copyValuesFromObject(const CBulletProperties &original_obj)
const QString & vertices() const
void setPlaneNormal(const btVector3 &plane_normal)
const CBulletProperties & operator=(const CBulletProperties &original_obj)
void setHeight(float height)
void setPlaneConstant(float plane_constant)
const float mass() const
void setShapeType(ShapeTypes shape_type)
void setVertices(const QString &vertices)
const float restitution() const
const float radius() const
const bool physicsEnabled() const
const btVector3 & size() const
const btVector3 & angularFactor() const
void setAngularFactor(const btVector3 &angular_factor)
void setSize(const btVector3 &size)
btRigidBody * rigidBody() const
const btVector3 & planeNormal() const
void setActivationState(const CBulletProperties::ActivationState &activationState)
void setMass(float mass)
CBulletProperties::ActivationState activationState() const
void setRestitution(float restitution)