Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2010-10-09 20:23:01 +0000
committerStijn Buys <ingar@osirion.org>2010-10-09 20:23:01 +0000
commit0ecdd8bc98ba583bbee801b838d785c6f881d7df (patch)
tree0ae456cb1254544e43de8abf8fa4dbb6afc91e79 /src/game/base/physics.h
parente5be0871b6fed09eed40ff17201d1c7a4a990744 (diff)
removed physics references, transfer inventory on ship aquisition
Diffstat (limited to 'src/game/base/physics.h')
-rw-r--r--src/game/base/physics.h185
1 files changed, 0 insertions, 185 deletions
diff --git a/src/game/base/physics.h b/src/game/base/physics.h
deleted file mode 100644
index 3bbd749..0000000
--- a/src/game/base/physics.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- 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
-*/
-
-#ifndef __INCLUDED_BASE_PHYSICS_H__
-#define __INCLUDED_BASE_PHYSICS_H__
-
-#include "sys/sys.h"
-#include "core/zone.h"
-#include <vector>
-
-#ifdef HAVE_BULLET
-#include "btBulletDynamicsCommon.h"
-#include "BulletCollision/CollisionShapes/btTriangleMesh.h"
-#endif
-
-/*
-
- This file provides the interface between the osirion game library
- and the bullet physics library
-
-*/
-
-namespace game
-{
-
-#ifdef HAVE_BULLET
-/// helper function to convert math:Vector3f to btVector3
-inline btVector3 to_btVector3(const math::Vector3f & v)
-{
- return btVector3(v[0], v[1], v[2]);
-}
-
-/// helper function to conver math::Axis to btMatrix3x3
-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]);
-};
-#endif
-
-/* ---- class CollisionShape --------------------------------------- */
-
-/// a bullet collision shape
-class CollisionShape
-{
-public:
- CollisionShape(model::Model *model, const bool moving);
-
- ~CollisionShape();
-
- inline const std::string &label() const {
- return shape_label;
- }
-
- inline const bool moving() const {
- return shape_moving;
- }
-
-#ifdef HAVE_BULLET
- inline btCollisionShape *bullet_shape() {
- return shape_bulletshape;
- }
-#endif
-
- /* ----- static functions for the shape registry ------------------- */
-
- /// tpye definition for the collision shape registry
- typedef std::vector<CollisionShape *> Registry;
-
- static void clear();
-
- static CollisionShape *add(model::Model *model, const bool moving);
-
- static CollisionShape *find(model::Model *model, const bool moving);
-
-private:
- std::string shape_label;
- bool shape_moving;
-
-#ifdef HAVE_BULLET
- btCollisionShape *shape_bulletshape;
- btTriangleMesh *shape_mesh;
-#endif
-
- /// collision shape registry
- static Registry shape_registry;
-};
-
-/* ---- class Physics ---------------------------------------------- */
-
-/// main physics functions
-class Physics
-{
-public:
- /// intialize world physics
- static void init();
-
- /// run a world physics frame
- static void frame(const float elapsed);
-
- /// shutdown world physics
- static void shutdown();
-
-#ifdef HAVE_BULLET
- static btDefaultCollisionConfiguration *configuration;
-
- static btCollisionDispatcher *dispatcher;
-
- static btSequentialImpulseConstraintSolver *solver;
-#endif
-};
-
-/* ---- class PhysicsZone ------------------------------------------ */
-
-/// a zone containing collision objects
-class PhysicsZone : public core::Zone
-{
-public:
- PhysicsZone(const std::string &label);
- virtual ~PhysicsZone();
-
-#ifdef HAVE_BULLET
- inline btDiscreteDynamicsWorld *dynamics_world() {
- return zone_dynamics_world;
- }
-
-private:
- btAxisSweep3 *zone_cache;
- btDiscreteDynamicsWorld *zone_dynamics_world;
-#endif
-};
-
-/* ---- class PhysicsBody ------------------------------------------ */
-
-/// an object that is capable of colliding with other objects
-class PhysicsBody
-{
-public:
- /// initialize a collider attached to an entity
- /**
- * a PhysicsBody with zero mass is considered non-moving
- */
- PhysicsBody(core::Entity *entity);
- ~PhysicsBody();
-
- /// initialize the collision body
- void init_physics(const float mass);
-
- /// shutdown the collision body
- void shutdown_physics();
-
- /// collider mass
- inline const float mass() const {
- return collider_mass;
- }
-
- /// the entity the collider is attached to
- inline core::Entity *entity() {
- return collider_entity;
- }
-
-#ifdef HAVE_BULLET
- /// the bullet rigid body associated with this collider
- inline btRigidBody *body() {
- return collider_body;
- }
-#endif
-
-private:
- CollisionShape *collider_shape;
- core::Entity *collider_entity;
-#ifdef HAVE_BULLET
- btRigidBody *collider_body;
-#endif
- float collider_mass;
-};
-
-}
-
-#endif // __INCLUDED_BASE_PHYSICS_H__
-