Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members |
#include <PhysicsManager.h>
Public Member Functions | |
void | addCollisionEventReceiver (CollisionEventReceiver *newEventReceiver) |
Body * | createBody (const std::string &name, const std::string &bodyFilename, scene::Node *parent=NULL) |
Body * | createBody (const std::string &bodyFilename, scene::Node *parent=NULL) |
Creates a body to be managed by physics manager. | |
Body * | createBody (const std::string &name, BodyData *bodyData, scene::Node *parent=NULL) |
Body * | createBody (BodyData *bodyData, scene::Node *parent=NULL) |
Creates a body to be managed by physics manager. | |
Joint * | createJoint (JointType type) |
Creates a joint to be managed by physics manager. | |
Joint * | createJoint (const std::string &name, JointType type) |
Material * | createMaterial (const std::string &materialFilename) |
Shape * | createShape (ShapeType type) |
Body * | getBody (const u32 &id) |
Retrieves a pointer to a body by id. | |
Joint * | getJoint (const u32 &id) |
Retrieves a pointer to a joint by id. | |
u32 | getNumberOfBodies () const |
Retrieves the total number of created bodies. | |
u32 | getNumberOfJoints () const |
Retrieves the total number of created joints. | |
void | initialize () |
Initialize object. | |
PhysicsManager () | |
void | registerDefaultFactories () |
void | removeAllBodies () |
Removes (and destroys) all bodies. | |
void | removeAllJoints () |
Removes (and destroys) all bodies. | |
void | removeBody (const u32 &id) |
Removes a body. | |
void | removeBody (Body *actor) |
Removes a body. | |
void | removeBodyFactory () |
void | removeCollisionEventReceiver (CollisionEventReceiver *oldEventReceiver) |
void | removeDefaultFactories () |
void | removeJoint (const u32 &id) |
Removes a joint. | |
void | removeJoint (Joint *joint) |
Removes a joint. | |
void | removeJointFactory () |
void | removePhysicsDriver () |
void | removeShapeFactory () |
void | setBodyFactory (BodyFactory *factory) |
void | setCollisionAccuracy (f32 accuracy) |
void | setGravity (const core::vector3d &gravity) |
void | setHardware (bool state) |
void | setJointFactory (JointFactory *factory) |
void | setPhysicsDriver (PhysicsDriver *driver) |
void | setShapeFactory (ShapeFactory *factory) |
void | setSolverAccuracy (f32 accuracy) |
void | start () |
void | stop () |
~PhysicsManager () | |
Static Public Member Functions | |
static PhysicsManager * | getInstance () |
Get instance. | |
Protected Member Functions | |
void | initializeImpl () |
void | uninitializeImpl () |
void | updateImpl (f32 elapsedTime) |
Protected Attributes | |
std::map< u32, Body * > | mBodies |
Central list of bodies - for easy memory management and lookup. | |
BodyFactory * | mBodyFactory |
f32 | mCollisionAccuracy |
BodyDataFactory * | mDefaultBodyDataFactory |
core::vector3d | mGravity |
bool | mHardware |
JointFactory * | mJointFactory |
std::map< u32, Joint * > | mJoints |
Central list of joints - for easy memory management and lookup. | |
std::map< u32, Material * > | mMaterials |
Central list of materials - for easy memory management and lookup. | |
PhysicsDriver * | mPhysicsDriver |
ShapeFactory * | mShapeFactory |
f32 | mSolverAccuracy |
bool | mUpdatePhysics |
Physics loop control. | |
Static Protected Attributes | |
static CollisionEvent * | mCollisionEvent = NULL |
static std::list < CollisionEventReceiver * > | mCollisionEventReceivers |
Static Private Member Functions | |
static void | fireCollisionEnded (Body *body1, Body *body2) |
static void | fireCollisionStarted (Body *body1, Body *body2, const std::vector< CollisionPoint * > &points) |
static void | fireCollisionUpdate (Body *body1, Body *body2, const std::vector< CollisionPoint * > &points) |
Friends | |
class | PhysicsDriver |
Physics Manager.
This class handles everything related to physics.
physics::PhysicsManager::PhysicsManager | ( | ) |
physics::PhysicsManager::~PhysicsManager | ( | ) |
References getInstance(), mCollisionEvent, and mDefaultBodyDataFactory.
void physics::PhysicsManager::addCollisionEventReceiver | ( | CollisionEventReceiver * | newEventReceiver | ) |
References mCollisionEventReceivers.
Body * physics::PhysicsManager::createBody | ( | const std::string & | name, |
const std::string & | bodyFilename, | ||
scene::Node * | parent = NULL |
||
) |
Body * physics::PhysicsManager::createBody | ( | BodyData * | bodyData, |
scene::Node * | parent = NULL |
||
) |
Creates a body to be managed by physics manager.
References engine::Object::addDependency(), physics::BodyFactory::createBody(), engine::Object::getID(), getInstance(), mBodies, and mBodyFactory.
Body * physics::PhysicsManager::createBody | ( | const std::string & | name, |
BodyData * | bodyData, | ||
scene::Node * | parent = NULL |
||
) |
Body * physics::PhysicsManager::createBody | ( | const std::string & | bodyFilename, |
scene::Node * | parent = NULL |
||
) |
Creates a body to be managed by physics manager.
References engine::Object::addDependency(), physics::BodyFactory::createBody(), engine::Object::getID(), getInstance(), mBodies, mBodyFactory, and resource::RT_RESOURCE_BODY_DATA.
Creates a joint to be managed by physics manager.
References physics::JointFactory::createJoint(), engine::Object::getID(), mJointFactory, and mJoints.
References physics::JointFactory::createJoint(), engine::Object::getID(), mJointFactory, and mJoints.
Material * physics::PhysicsManager::createMaterial | ( | const std::string & | materialFilename | ) |
References engine::Object::getID(), getInstance(), mMaterials, and resource::RT_RESOURCE_PHYSICS_MATERIAL.
Referenced by physics::BodyData::setMaterial(), and physics::Body::setMaterial().
References physics::ShapeFactory::createShape(), and mShapeFactory.
References physics::CollisionEvent::mBody1, physics::CollisionEvent::mBody2, mCollisionEvent, and mCollisionEventReceivers.
Referenced by physics::PhysicsDriver::fireCollisionEnded().
void physics::PhysicsManager::fireCollisionStarted | ( | Body * | body1, |
Body * | body2, | ||
const std::vector< CollisionPoint * > & | points | ||
) | [static, private] |
void physics::PhysicsManager::fireCollisionUpdate | ( | Body * | body1, |
Body * | body2, | ||
const std::vector< CollisionPoint * > & | points | ||
) | [static, private] |
Retrieves a pointer to a body by id.
References mBodies.
PhysicsManager * physics::PhysicsManager::getInstance | ( | ) | [static] |
Get instance.
Reimplemented from core::Singleton< PhysicsManager >.
Referenced by createBody(), createMaterial(), physics::PhysicsDriver::fireCollisionEnded(), physics::PhysicsDriver::fireCollisionStarted(), physics::PhysicsDriver::fireCollisionUpdate(), initialize(), initializeImpl(), PhysicsManager(), registerDefaultFactories(), scene::Scene::removeAllNodes(), removeBody(), removeDefaultFactories(), physics::BodyData::setMaterial(), physics::Body::setMaterial(), start(), stop(), uninitializeImpl(), and ~PhysicsManager().
Retrieves a pointer to a joint by id.
References mJoints.
u32 physics::PhysicsManager::getNumberOfBodies | ( | ) | const |
Retrieves the total number of created bodies.
References mBodies.
u32 physics::PhysicsManager::getNumberOfJoints | ( | ) | const |
Retrieves the total number of created joints.
References mJoints.
void physics::PhysicsManager::initialize | ( | ) |
Initialize object.
Reimplemented from engine::Object.
References getInstance(), physics::PhysicsDriver::initialize(), mCollisionAccuracy, mGravity, mHardware, mPhysicsDriver, mSolverAccuracy, physics::PhysicsDriver::setCollisionAccuracy(), physics::PhysicsDriver::setGravity(), physics::PhysicsDriver::setHardware(), and physics::PhysicsDriver::setSolverAccuracy().
Referenced by engine::EngineManager::initializeImpl().
void physics::PhysicsManager::initializeImpl | ( | ) | [protected, virtual] |
Reimplemented from engine::Object.
References getInstance(), physics::PhysicsDriver::initialize(), and mPhysicsDriver.
void physics::PhysicsManager::registerDefaultFactories | ( | ) |
void physics::PhysicsManager::removeAllBodies | ( | ) |
Removes (and destroys) all bodies.
References scene::SceneManager::getInstance(), and mBodies.
Referenced by uninitializeImpl().
void physics::PhysicsManager::removeAllJoints | ( | ) |
void physics::PhysicsManager::removeBody | ( | Body * | actor | ) |
Removes a body.
References engine::Object::getID().
void physics::PhysicsManager::removeBody | ( | const u32 & | id | ) |
Removes a body.
References getInstance(), and mBodies.
void physics::PhysicsManager::removeBodyFactory | ( | ) |
References mBodyFactory.
void physics::PhysicsManager::removeCollisionEventReceiver | ( | CollisionEventReceiver * | oldEventReceiver | ) |
References mCollisionEventReceivers.
void physics::PhysicsManager::removeDefaultFactories | ( | ) |
References getInstance(), resource::ResourceManager::getInstance(), and resource::RT_RESOURCE_BODY_DATA.
Referenced by engine::EngineManager::removeDefaultFactories().
void physics::PhysicsManager::removeJoint | ( | Joint * | joint | ) |
Removes a joint.
References engine::Object::getID().
void physics::PhysicsManager::removeJointFactory | ( | ) |
References mJointFactory.
void physics::PhysicsManager::removePhysicsDriver | ( | ) |
References mPhysicsDriver.
void physics::PhysicsManager::removeShapeFactory | ( | ) |
References mShapeFactory.
void physics::PhysicsManager::setBodyFactory | ( | BodyFactory * | factory | ) |
References mBodyFactory.
void physics::PhysicsManager::setCollisionAccuracy | ( | f32 | accuracy | ) |
References mCollisionAccuracy, mPhysicsDriver, and physics::PhysicsDriver::setCollisionAccuracy().
void physics::PhysicsManager::setGravity | ( | const core::vector3d & | gravity | ) |
References mGravity, mPhysicsDriver, and physics::PhysicsDriver::setGravity().
void physics::PhysicsManager::setHardware | ( | bool | state | ) |
References mHardware, mPhysicsDriver, and physics::PhysicsDriver::setHardware().
void physics::PhysicsManager::setJointFactory | ( | JointFactory * | factory | ) |
References mJointFactory.
void physics::PhysicsManager::setPhysicsDriver | ( | PhysicsDriver * | driver | ) |
References mPhysicsDriver.
void physics::PhysicsManager::setShapeFactory | ( | ShapeFactory * | factory | ) |
References mShapeFactory.
void physics::PhysicsManager::setSolverAccuracy | ( | f32 | accuracy | ) |
References mPhysicsDriver, mSolverAccuracy, and physics::PhysicsDriver::setSolverAccuracy().
void physics::PhysicsManager::start | ( | ) |
References getInstance(), mPhysicsDriver, and mUpdatePhysics.
Referenced by engine::EngineManager::start().
void physics::PhysicsManager::stop | ( | ) |
References getInstance(), mPhysicsDriver, mUpdatePhysics, and physics::PhysicsDriver::stop().
Referenced by engine::EngineManager::stop().
void physics::PhysicsManager::uninitializeImpl | ( | ) | [protected, virtual] |
Reimplemented from engine::Object.
References getInstance(), mMaterials, removeAllBodies(), and removeAllJoints().
void physics::PhysicsManager::updateImpl | ( | f32 | elapsedTime | ) | [protected, virtual] |
Reimplemented from engine::Object.
References mPhysicsDriver, and physics::PhysicsDriver::update().
friend class PhysicsDriver [friend] |
std::map<u32, Body*> physics::PhysicsManager::mBodies [protected] |
Central list of bodies - for easy memory management and lookup.
Referenced by createBody(), getBody(), getNumberOfBodies(), removeAllBodies(), and removeBody().
BodyFactory* physics::PhysicsManager::mBodyFactory [protected] |
Referenced by createBody(), PhysicsManager(), removeBodyFactory(), and setBodyFactory().
f32 physics::PhysicsManager::mCollisionAccuracy [protected] |
Referenced by initialize(), PhysicsManager(), and setCollisionAccuracy().
CollisionEvent * physics::PhysicsManager::mCollisionEvent = NULL [static, protected] |
std::list< CollisionEventReceiver * > physics::PhysicsManager::mCollisionEventReceivers [static, protected] |
Referenced by PhysicsManager(), registerDefaultFactories(), and ~PhysicsManager().
core::vector3d physics::PhysicsManager::mGravity [protected] |
Referenced by initialize(), PhysicsManager(), and setGravity().
bool physics::PhysicsManager::mHardware [protected] |
Referenced by initialize(), PhysicsManager(), and setHardware().
JointFactory* physics::PhysicsManager::mJointFactory [protected] |
Referenced by createJoint(), PhysicsManager(), removeJointFactory(), and setJointFactory().
std::map<u32, Joint*> physics::PhysicsManager::mJoints [protected] |
Central list of joints - for easy memory management and lookup.
Referenced by createJoint(), getJoint(), getNumberOfJoints(), removeAllJoints(), and removeJoint().
std::map<u32, Material*> physics::PhysicsManager::mMaterials [protected] |
Central list of materials - for easy memory management and lookup.
Referenced by createMaterial(), and uninitializeImpl().
PhysicsDriver* physics::PhysicsManager::mPhysicsDriver [protected] |
ShapeFactory* physics::PhysicsManager::mShapeFactory [protected] |
Referenced by createShape(), PhysicsManager(), removeShapeFactory(), and setShapeFactory().
f32 physics::PhysicsManager::mSolverAccuracy [protected] |
Referenced by initialize(), PhysicsManager(), and setSolverAccuracy().
bool physics::PhysicsManager::mUpdatePhysics [protected] |
Physics loop control.
Referenced by PhysicsManager(), start(), and stop().
The KG Game Engine
Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:08 by
Doxygen
(1.7.4)
|