Annwvyn::AnnPhysicsEngine Class Reference

Class that abstract the physics engine initialization and collision information queries for Annwvyn. More...

#include <AnnPhysicsEngine.hpp>

Inheritance diagram for Annwvyn::AnnPhysicsEngine:
Collaboration diagram for Annwvyn::AnnPhysicsEngine:

Public Types

enum  CollisionMasks : int { Player = MASK(0), General = MASK(1), ColideWithAll = Player | General }
 Flag for collisions. More...
 

Public Member Functions

 AnnPhysicsEngine (Ogre::SceneNode *rootNode, AnnPlayerBodyPtr player)
 Create the physics engine. More...
 
 ~AnnPhysicsEngine ()
 Destroy the physics engine. More...
 
void addPlayerPhysicalBodyToDynamicsWorld () const
 Add the player body to the dynamics world. More...
 
void createPlayerPhysicalVirtualBody (Ogre::SceneNode *node)
 Create player's rigid-body. More...
 
void createVirtualBodyShape (float radius=0.125f) const
 Create player's body shape (a capsule) More...
 
btDiscreteDynamicsWorld * getWorld () const
 Pointer to the bullet's dynamics world. More...
 
void step (float delta) const
 
void processCollisionTesting () const
 Process the collision query system. More...
 
void removeRigidBody (btRigidBody *body) const
 Remove a body from simulation. More...
 
void initPlayerStandingPhysics (Ogre::SceneNode *playerAnchorNode)
 Init the class "standing" designed for the Oculus physics where the player is not moving in the room at all. More...
 
void initPlayerRoomscalePhysics (Ogre::SceneNode *playerAnchorNode) const
 Init the "room-scale" physics model where the controls don't break when the player move is ass in the real world. More...
 
void setDebugPhysics (bool state)
 Set the debug drawer state. More...
 
void stepDebugDrawer () const
 Step the debug drawing for the physical representation. More...
 
void changeGravity (AnnVect3 gravity) const
 Change the gravity vector. More...
 
void resetGravity () const
 Restore the default gravity. More...
 
void toggleDebugPhysics ()
 Toggle the debug physics overlay. More...
 
void setDebugDrawerColorMultiplier (float value) const
 Set the color multiplier to convert raw color to HDR light value. More...
 
btCollisionShape * _getGameObjectShape (AnnGameObject *obj, phyShapeType type)
 advanced : functions called to setup physics by game objects More...
 
- Public Member Functions inherited from Annwvyn::AnnSubSystem
 AnnSubSystem (const std::string &systemName)
 Construct a SubSystem. More...
 
virtual ~AnnSubSystem ()
 Destruct a SubSystem. More...
 

Static Public Member Functions

static std::string getBulletVersion ()
 

Private Member Functions

void update () override
 Update by steeping simulation by one frame time. Should be called only once, and only by AnnEngine. More...
 

Private Attributes

std::unique_ptr< btBroadphaseInterface > Broadphase
 Bullet Broadphase. More...
 
std::unique_ptr< btDefaultCollisionConfiguration > CollisionConfiguration
 Bullet Default Collision Configuration. More...
 
std::unique_ptr< btCollisionDispatcher > Dispatcher
 Bullet Collision Dispatcher. More...
 
std::unique_ptr< btSequentialImpulseConstraintSolver > Solver
 Bullet Sequential Impulse Constraint Solver. More...
 
std::unique_ptr< btDiscreteDynamicsWorld > DynamicsWorld
 Bullet Dynamics World. More...
 
bool debugPhysics
 Should use the debug drawer. More...
 
std::unique_ptr< BtOgre::DebugDrawer > debugDrawer
 Debug drawer object from BtOgre. More...
 
BtOgre::RigidBodyState * playerRigidBodyState
 Rigid body state from BtOgre for the Player object. More...
 
AnnPlayerBodyPtr playerObject
 Shared pointer to the player. More...
 
AnnVect3 defaultGravity
 Default value for gravity. Should be initialized to (0, -9.82f, 0) unless something is wrong with this planet. More...
 

Friends

class AnnEngine
 

Additional Inherited Members

- Protected Member Functions inherited from Annwvyn::AnnSubSystem
virtual bool needUpdate ()
 To be called by AnnEngine : Return if the subsystem wants to be updated. More...
 
- Protected Attributes inherited from Annwvyn::AnnSubSystem
std::string name
 Name of the subsystem. More...
 

Detailed Description

Class that abstract the physics engine initialization and collision information queries for Annwvyn.

Definition at line 42 of file AnnPhysicsEngine.hpp.

Member Enumeration Documentation

◆ CollisionMasks

Flag for collisions.

Enumerator
Player 
General 
ColideWithAll 

Definition at line 53 of file AnnPhysicsEngine.hpp.

Constructor & Destructor Documentation

◆ AnnPhysicsEngine()

AnnPhysicsEngine::AnnPhysicsEngine ( Ogre::SceneNode *  rootNode,
AnnPlayerBodyPtr  player 
)

Create the physics engine.

Definition at line 13 of file AnnPhysicsEngine.cpp.

Here is the call graph for this function:

◆ ~AnnPhysicsEngine()

AnnPhysicsEngine::~AnnPhysicsEngine ( )

Destroy the physics engine.

Definition at line 45 of file AnnPhysicsEngine.cpp.

Member Function Documentation

◆ _getGameObjectShape()

btCollisionShape * AnnPhysicsEngine::_getGameObjectShape ( AnnGameObject obj,
phyShapeType  type 
)

advanced : functions called to setup physics by game objects

Definition at line 191 of file AnnPhysicsEngine.cpp.

Here is the call graph for this function:

◆ addPlayerPhysicalBodyToDynamicsWorld()

void AnnPhysicsEngine::addPlayerPhysicalBodyToDynamicsWorld ( ) const

Add the player body to the dynamics world.

Definition at line 49 of file AnnPhysicsEngine.cpp.

Here is the caller graph for this function:

◆ changeGravity()

void AnnPhysicsEngine::changeGravity ( AnnVect3  gravity) const

Change the gravity vector.

Definition at line 140 of file AnnPhysicsEngine.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createPlayerPhysicalVirtualBody()

void AnnPhysicsEngine::createPlayerPhysicalVirtualBody ( Ogre::SceneNode *  node)

Create player's rigid-body.

Definition at line 54 of file AnnPhysicsEngine.cpp.

Here is the caller graph for this function:

◆ createVirtualBodyShape()

void AnnPhysicsEngine::createVirtualBodyShape ( float  radius = 0.125f) const

Create player's body shape (a capsule)

Definition at line 79 of file AnnPhysicsEngine.cpp.

Here is the caller graph for this function:

◆ getBulletVersion()

static std::string Annwvyn::AnnPhysicsEngine::getBulletVersion ( )
inlinestatic

Definition at line 45 of file AnnPhysicsEngine.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getWorld()

btDiscreteDynamicsWorld * AnnPhysicsEngine::getWorld ( ) const

Pointer to the bullet's dynamics world.

Definition at line 85 of file AnnPhysicsEngine.cpp.

Here is the call graph for this function:

◆ initPlayerRoomscalePhysics()

void AnnPhysicsEngine::initPlayerRoomscalePhysics ( Ogre::SceneNode *  playerAnchorNode) const

Init the "room-scale" physics model where the controls don't break when the player move is ass in the real world.

Definition at line 162 of file AnnPhysicsEngine.cpp.

◆ initPlayerStandingPhysics()

void AnnPhysicsEngine::initPlayerStandingPhysics ( Ogre::SceneNode *  playerAnchorNode)

Init the class "standing" designed for the Oculus physics where the player is not moving in the room at all.

Definition at line 177 of file AnnPhysicsEngine.cpp.

Here is the call graph for this function:

◆ processCollisionTesting()

void AnnPhysicsEngine::processCollisionTesting ( ) const

Process the collision query system.

Definition at line 101 of file AnnPhysicsEngine.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeRigidBody()

void AnnPhysicsEngine::removeRigidBody ( btRigidBody *  body) const

Remove a body from simulation.

Definition at line 116 of file AnnPhysicsEngine.cpp.

◆ resetGravity()

void AnnPhysicsEngine::resetGravity ( ) const

Restore the default gravity.

Definition at line 145 of file AnnPhysicsEngine.cpp.

Here is the call graph for this function:

◆ setDebugDrawerColorMultiplier()

void AnnPhysicsEngine::setDebugDrawerColorMultiplier ( float  value) const

Set the color multiplier to convert raw color to HDR light value.

Definition at line 186 of file AnnPhysicsEngine.cpp.

◆ setDebugPhysics()

void AnnPhysicsEngine::setDebugPhysics ( bool  state)

Set the debug drawer state.

Definition at line 123 of file AnnPhysicsEngine.cpp.

Here is the caller graph for this function:

◆ step()

void AnnPhysicsEngine::step ( float  delta) const

Step the simulation

Parameters
deltaInterval in seconds that time has to be simulated

Definition at line 90 of file AnnPhysicsEngine.cpp.

Here is the caller graph for this function:

◆ stepDebugDrawer()

void AnnPhysicsEngine::stepDebugDrawer ( ) const

Step the debug drawing for the physical representation.

Definition at line 95 of file AnnPhysicsEngine.cpp.

Here is the caller graph for this function:

◆ toggleDebugPhysics()

void AnnPhysicsEngine::toggleDebugPhysics ( )

Toggle the debug physics overlay.

Definition at line 157 of file AnnPhysicsEngine.cpp.

Here is the call graph for this function:

◆ update()

void AnnPhysicsEngine::update ( )
overrideprivatevirtual

Update by steeping simulation by one frame time. Should be called only once, and only by AnnEngine.

Reimplemented from Annwvyn::AnnSubSystem.

Definition at line 150 of file AnnPhysicsEngine.cpp.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ AnnEngine

friend class AnnEngine
friend

Definition at line 116 of file AnnPhysicsEngine.hpp.

Member Data Documentation

◆ Broadphase

std::unique_ptr<btBroadphaseInterface> Annwvyn::AnnPhysicsEngine::Broadphase
private

Bullet Broadphase.

Definition at line 121 of file AnnPhysicsEngine.hpp.

◆ CollisionConfiguration

std::unique_ptr<btDefaultCollisionConfiguration> Annwvyn::AnnPhysicsEngine::CollisionConfiguration
private

Bullet Default Collision Configuration.

Definition at line 124 of file AnnPhysicsEngine.hpp.

◆ debugDrawer

std::unique_ptr<BtOgre::DebugDrawer> Annwvyn::AnnPhysicsEngine::debugDrawer
private

Debug drawer object from BtOgre.

Definition at line 139 of file AnnPhysicsEngine.hpp.

◆ debugPhysics

bool Annwvyn::AnnPhysicsEngine::debugPhysics
private

Should use the debug drawer.

Definition at line 136 of file AnnPhysicsEngine.hpp.

◆ defaultGravity

AnnVect3 Annwvyn::AnnPhysicsEngine::defaultGravity
private

Default value for gravity. Should be initialized to (0, -9.82f, 0) unless something is wrong with this planet.

Definition at line 148 of file AnnPhysicsEngine.hpp.

◆ Dispatcher

std::unique_ptr<btCollisionDispatcher> Annwvyn::AnnPhysicsEngine::Dispatcher
private

Bullet Collision Dispatcher.

Definition at line 127 of file AnnPhysicsEngine.hpp.

◆ DynamicsWorld

std::unique_ptr<btDiscreteDynamicsWorld> Annwvyn::AnnPhysicsEngine::DynamicsWorld
private

Bullet Dynamics World.

Definition at line 133 of file AnnPhysicsEngine.hpp.

◆ playerObject

AnnPlayerBodyPtr Annwvyn::AnnPhysicsEngine::playerObject
private

Shared pointer to the player.

Definition at line 145 of file AnnPhysicsEngine.hpp.

◆ playerRigidBodyState

BtOgre::RigidBodyState* Annwvyn::AnnPhysicsEngine::playerRigidBodyState
private

Rigid body state from BtOgre for the Player object.

Definition at line 142 of file AnnPhysicsEngine.hpp.

◆ Solver

std::unique_ptr<btSequentialImpulseConstraintSolver> Annwvyn::AnnPhysicsEngine::Solver
private

Bullet Sequential Impulse Constraint Solver.

Definition at line 130 of file AnnPhysicsEngine.hpp.


The documentation for this class was generated from the following files: