[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-physics / third-party / bullet3 / src / Bullet3Dynamics / b3CpuRigidBodyPipeline.h
1 /*
2 Copyright (c) 2013 Advanced Micro Devices, Inc.  
3
4 This software is provided 'as-is', without any express or implied warranty.
5 In no event will the authors be held liable for any damages arising from the use of this software.
6 Permission is granted to anyone to use this software for any purpose, 
7 including commercial applications, and to alter it and redistribute it freely, 
8 subject to the following restrictions:
9
10 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
11 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
12 3. This notice may not be removed or altered from any source distribution.
13 */
14 //Originally written by Erwin Coumans
15
16 #ifndef B3_CPU_RIGIDBODY_PIPELINE_H
17 #define B3_CPU_RIGIDBODY_PIPELINE_H
18
19 #include "Bullet3Common/b3AlignedObjectArray.h"
20 #include "Bullet3Collision/NarrowPhaseCollision/b3RaycastInfo.h"
21
22 class b3CpuRigidBodyPipeline
23 {
24 protected:
25         struct b3CpuRigidBodyPipelineInternalData* m_data;
26
27         int allocateCollidable();
28
29 public:
30         b3CpuRigidBodyPipeline(class b3CpuNarrowPhase* narrowphase, struct b3DynamicBvhBroadphase* broadphaseDbvt, const struct b3Config& config);
31         virtual ~b3CpuRigidBodyPipeline();
32
33         virtual void stepSimulation(float deltaTime);
34         virtual void integrate(float timeStep);
35         virtual void updateAabbWorldSpace();
36         virtual void computeOverlappingPairs();
37         virtual void computeContactPoints();
38         virtual void solveContactConstraints();
39
40         int registerConvexPolyhedron(class b3ConvexUtility* convex);
41
42         int registerPhysicsInstance(float mass, const float* position, const float* orientation, int collisionShapeIndex, int userData);
43         void writeAllInstancesToGpu();
44         void copyConstraintsToHost();
45         void setGravity(const float* grav);
46         void reset();
47
48         int createPoint2PointConstraint(int bodyA, int bodyB, const float* pivotInA, const float* pivotInB, float breakingThreshold);
49         int createFixedConstraint(int bodyA, int bodyB, const float* pivotInA, const float* pivotInB, const float* relTargetAB, float breakingThreshold);
50         void removeConstraintByUid(int uid);
51
52         void addConstraint(class b3TypedConstraint* constraint);
53         void removeConstraint(b3TypedConstraint* constraint);
54
55         void castRays(const b3AlignedObjectArray<b3RayInfo>& rays, b3AlignedObjectArray<b3RayHit>& hitResults);
56
57         const struct b3RigidBodyData* getBodyBuffer() const;
58
59         int getNumBodies() const;
60 };
61
62 #endif  //B3_CPU_RIGIDBODY_PIPELINE_H