Tizen 2.1 base
[platform/upstream/libbullet.git] / Extras / PhysicsEffects / include / BulletPhysicsEffects / btBulletPhysicsEffectsWorld.h
1 /*\r
2 Physics Effects Copyright(C) 2011 Sony Computer Entertainment Inc.\r
3 All rights reserved.\r
4 \r
5 Physics Effects is open software; you can redistribute it and/or\r
6 modify it under the terms of the BSD License.\r
7 \r
8 Physics Effects is distributed in the hope that it will be useful,\r
9 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
11 See the BSD License for more details.\r
12 \r
13 A copy of the BSD License is distributed with\r
14 Physics Effects under the filename: physics_effects_license.txt\r
15 */\r
16 \r
17  #ifndef _BT_PARALLEL_DYNAMICS_WORLD_H\r
18 #define _BT_PARALLEL_DYNAMICS_WORLD_H\r
19 \r
20 #include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"\r
21 #include "physics_effects/base_level/rigidbody/pfx_rigid_body.h"\r
22 #include "physics_effects/base_level/rigidbody/pfx_rigid_state.h"\r
23 #include "physics_effects/base_level/collision/pfx_collidable.h"\r
24 #include "physics_effects/base_level/solver/pfx_solver_body.h"\r
25 \r
26 //#define USE_PE_GATHER_SCATTER_SPURS_TASK 1\r
27 \r
28 \r
29 class btThreadSupportInterface;\r
30 class SpuPEGatherScatterTaskProcess;\r
31 struct CellSpurs;\r
32 class SpuBatchRaycaster;\r
33 struct btLowLevelBroadphase;\r
34 \r
35 #define PARALLEL_BATCH_SIZE 64\r
36 \r
37 \r
38 ///btBulletPhysicsEffectsWorld adds parallel processing for integration/motion prediction\r
39 class btBulletPhysicsEffectsWorld : public btDiscreteDynamicsWorld\r
40 {\r
41 \r
42 protected:\r
43         btAlignedObjectArray<sce::PhysicsEffects::PfxRigidState>        m_lowLevelStates;\r
44         btAlignedObjectArray<sce::PhysicsEffects::PfxRigidBody>         m_lowLevelBodies;\r
45         btAlignedObjectArray<sce::PhysicsEffects::PfxSolverBody>        m_lowLevelSolverBodies;\r
46         btAlignedObjectArray<sce::PhysicsEffects::PfxCollidable>        m_lowLevelCollidables;\r
47 \r
48         //PfxSolverBody solverBodies[NUM_RIGIDBODIES];\r
49 \r
50         class SpuPEGatherScatterTaskProcess*    m_PEGatherScatterProcess;\r
51 \r
52         struct btLowLevelData*                                                  m_lowLevelData;\r
53 \r
54         void    createStateAndCollidable(btRigidBody* body);\r
55 \r
56         void    syncRigidBodyState(btRigidBody* body);\r
57 public:\r
58 \r
59         btBulletPhysicsEffectsWorld(struct btLowLevelData* lowLevelData, btDispatcher* dispatcher,btLowLevelBroadphase* pairCache,btConstraintSolver* constraintSolver,btCollisionConfiguration* collisionConfiguration, btThreadSupportInterface* threadSupport);\r
60                 \r
61         virtual ~btBulletPhysicsEffectsWorld();\r
62         \r
63         virtual void    predictUnconstraintMotion(btScalar timeStep);\r
64                 \r
65         virtual void integrateTransforms(btScalar timeStep);\r
66 \r
67         virtual void    solveConstraints(btContactSolverInfo& solverInfo);\r
68 \r
69         virtual void    calculateSimulationIslands();\r
70 \r
71         virtual void    addRigidBody(btRigidBody* body);\r
72 \r
73         virtual void    addRigidBody(btRigidBody* body, short group, short mask);\r
74 \r
75         virtual void    removeRigidBody(btRigidBody* body);\r
76 \r
77 \r
78 };\r
79 #endif //_BT_PARALLEL_DYNAMICS_WORLD_H