Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/base/physics.h')
-rw-r--r--src/game/base/physics.h55
1 files changed, 37 insertions, 18 deletions
diff --git a/src/game/base/physics.h b/src/game/base/physics.h
index 37ed1cf..3bbd749 100644
--- a/src/game/base/physics.h
+++ b/src/game/base/physics.h
@@ -1,7 +1,7 @@
/*
base/physics.h
- This file is part of the Osirion project and is distributed under
- the terms and conditions of the GNU General Public License version 2
+ This file is part of the Osirion project and is distributed under
+ the terms and conditions of the GNU General Public License version 2
*/
#ifndef __INCLUDED_BASE_PHYSICS_H__
@@ -23,7 +23,8 @@
*/
-namespace game {
+namespace game
+{
#ifdef HAVE_BULLET
/// helper function to convert math:Vector3f to btVector3
@@ -36,29 +37,36 @@ inline btVector3 to_btVector3(const math::Vector3f & v)
inline btMatrix3x3 to_btMatrix3x3(const math::Axis &a)
{
return btMatrix3x3(a[0][0], a[0][1], a[0][2],
- a[1][0], a[1][1], a[1][2],
- a[2][0], a[2][1], a[2][2]);
+ a[1][0], a[1][1], a[1][2],
+ a[2][0], a[2][1], a[2][2]);
};
#endif
/* ---- class CollisionShape --------------------------------------- */
/// a bullet collision shape
-class CollisionShape {
+class CollisionShape
+{
public:
CollisionShape(model::Model *model, const bool moving);
~CollisionShape();
- inline const std::string &label() const { return shape_label; }
+ inline const std::string &label() const {
+ return shape_label;
+ }
- inline const bool moving() const { return shape_moving; }
+ inline const bool moving() const {
+ return shape_moving;
+ }
#ifdef HAVE_BULLET
- inline btCollisionShape *bullet_shape() { return shape_bulletshape; }
+ inline btCollisionShape *bullet_shape() {
+ return shape_bulletshape;
+ }
#endif
-/* ----- static functions for the shape registry ------------------- */
+ /* ----- static functions for the shape registry ------------------- */
/// tpye definition for the collision shape registry
typedef std::vector<CollisionShape *> Registry;
@@ -85,7 +93,8 @@ private:
/* ---- class Physics ---------------------------------------------- */
/// main physics functions
-class Physics {
+class Physics
+{
public:
/// intialize world physics
static void init();
@@ -108,13 +117,16 @@ public:
/* ---- class PhysicsZone ------------------------------------------ */
/// a zone containing collision objects
-class PhysicsZone : public core::Zone {
+class PhysicsZone : public core::Zone
+{
public:
PhysicsZone(const std::string &label);
virtual ~PhysicsZone();
#ifdef HAVE_BULLET
- inline btDiscreteDynamicsWorld *dynamics_world() { return zone_dynamics_world; }
+ inline btDiscreteDynamicsWorld *dynamics_world() {
+ return zone_dynamics_world;
+ }
private:
btAxisSweep3 *zone_cache;
@@ -125,10 +137,11 @@ private:
/* ---- class PhysicsBody ------------------------------------------ */
/// an object that is capable of colliding with other objects
-class PhysicsBody {
+class PhysicsBody
+{
public:
/// initialize a collider attached to an entity
- /**
+ /**
* a PhysicsBody with zero mass is considered non-moving
*/
PhysicsBody(core::Entity *entity);
@@ -141,14 +154,20 @@ public:
void shutdown_physics();
/// collider mass
- inline const float mass() const { return collider_mass; }
+ inline const float mass() const {
+ return collider_mass;
+ }
/// the entity the collider is attached to
- inline core::Entity *entity() { return collider_entity; }
+ inline core::Entity *entity() {
+ return collider_entity;
+ }
#ifdef HAVE_BULLET
/// the bullet rigid body associated with this collider
- inline btRigidBody *body() { return collider_body; }
+ inline btRigidBody *body() {
+ return collider_body;
+ }
#endif
private: