[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-physics / third-party / bullet3 / src / Bullet3Collision / BroadPhaseCollision / b3OverlappingPair.h
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2013 Erwin Coumans  http://bulletphysics.org
4
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10
11 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.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 */
15
16 #ifndef B3_OVERLAPPING_PAIR_H
17 #define B3_OVERLAPPING_PAIR_H
18
19 #include "Bullet3Common/shared/b3Int4.h"
20
21 #define B3_NEW_PAIR_MARKER -1
22 #define B3_REMOVED_PAIR_MARKER -2
23
24 typedef b3Int4 b3BroadphasePair;
25
26 inline b3Int4 b3MakeBroadphasePair(int xx, int yy)
27 {
28         b3Int4 pair;
29
30         if (xx < yy)
31         {
32                 pair.x = xx;
33                 pair.y = yy;
34         }
35         else
36         {
37                 pair.x = yy;
38                 pair.y = xx;
39         }
40         pair.z = B3_NEW_PAIR_MARKER;
41         pair.w = B3_NEW_PAIR_MARKER;
42         return pair;
43 }
44
45 /*struct b3BroadphasePair : public b3Int4
46 {
47         explicit b3BroadphasePair(){}
48         
49 };
50 */
51
52 class b3BroadphasePairSortPredicate
53 {
54 public:
55         bool operator()(const b3BroadphasePair& a, const b3BroadphasePair& b) const
56         {
57                 const int uidA0 = a.x;
58                 const int uidB0 = b.x;
59                 const int uidA1 = a.y;
60                 const int uidB1 = b.y;
61                 return uidA0 > uidB0 || (uidA0 == uidB0 && uidA1 > uidB1);
62         }
63 };
64
65 B3_FORCE_INLINE bool operator==(const b3BroadphasePair& a, const b3BroadphasePair& b)
66 {
67         return (a.x == b.x) && (a.y == b.y);
68 }
69
70 #endif  //B3_OVERLAPPING_PAIR_H