Bullet Collision Detection & Physics Library: btGImpactBvhStructs.h Source File

Bullet Collision Detection & Physics Library

btGImpactBvhStructs.h
Go to the documentation of this file.
1 #ifndef GIM_BOX_SET_STRUCT_H_INCLUDED
2 #define GIM_BOX_SET_STRUCT_H_INCLUDED
3
7 /*
8 This source file is part of GIMPACT Library.
9
10 For the latest info, see http://gimpact.sourceforge.net/
11
12 Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371.
13 email: projectileman@yahoo.com
14
15
16 This software is provided 'as-is', without any express or implied warranty.
17 In no event will the authors be held liable for any damages arising from the use of this software.
18 Permission is granted to anyone to use this software for any purpose,
19 including commercial applications, and to alter it and redistribute it freely,
20 subject to the following restrictions:
21
22 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.
23 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
24 3. This notice may not be removed or altered from any source distribution.
25 */
26
27 #include "LinearMath/btAlignedObjectArray.h"
28
29 #include "btBoxCollision.h"
30 #include "btTriangleShapeEx.h"
31
33 struct GIM_PAIR
34 {
35 int m_index1;
36 int m_index2;
37 GIM_PAIR()
38 {
39 }
40
41 GIM_PAIR(const GIM_PAIR& p)
42 {
43 m_index1 = p.m_index1;
44 m_index2 = p.m_index2;
45 }
46
47 GIM_PAIR(int index1, int index2)
48 {
49 m_index1 = index1;
50 m_index2 = index2;
51 }
52 };
53
55 struct GIM_BVH_DATA
56 {
57 btAABB m_bound;
58 int m_data;
59 };
60
62 class GIM_BVH_TREE_NODE
63 {
64 public:
65 btAABB m_bound;
66
67 protected:
68 int m_escapeIndexOrDataIndex;
69
70 public:
71 GIM_BVH_TREE_NODE()
72 {
73 m_escapeIndexOrDataIndex = 0;
74 }
75
76 SIMD_FORCE_INLINE bool isLeafNode() const
77 {
78 //skipindex is negative (internal node), triangleindex >=0 (leafnode)
79 return (m_escapeIndexOrDataIndex >= 0);
80 }
81
82 SIMD_FORCE_INLINE int getEscapeIndex() const
83 {
84 //btAssert(m_escapeIndexOrDataIndex < 0);
85 return -m_escapeIndexOrDataIndex;
86 }
87
88 SIMD_FORCE_INLINE void setEscapeIndex(int index)
89 {
90 m_escapeIndexOrDataIndex = -index;
91 }
92
93 SIMD_FORCE_INLINE int getDataIndex() const
94 {
95 //btAssert(m_escapeIndexOrDataIndex >= 0);
96
97 return m_escapeIndexOrDataIndex;
98 }
99
100 SIMD_FORCE_INLINE void setDataIndex(int index)
101 {
102 m_escapeIndexOrDataIndex = index;
103 }
104 };
105
106 #endif // GIM_BOXPRUNING_H_INCLUDED
GIM_PAIR::GIM_PAIR
GIM_PAIR(int index1, int index2)
Definition: btGImpactBvhStructs.h:47
GIM_PAIR::GIM_PAIR
GIM_PAIR()
Definition: btGImpactBvhStructs.h:37
GIM_BVH_DATA
GIM_BVH_DATA is an internal GIMPACT collision structure to contain axis aligned bounding box...
Definition: btGImpactBvhStructs.h:55
btTriangleShapeEx.h
GIM_PAIR::m_index2
int m_index2
Definition: btGImpactBvhStructs.h:36
SIMD_FORCE_INLINE
#define SIMD_FORCE_INLINE
Definition: btScalar.h:83
GIM_BVH_TREE_NODE::getDataIndex
int getDataIndex() const
Definition: btGImpactBvhStructs.h:93
GIM_BVH_TREE_NODE::setEscapeIndex
void setEscapeIndex(int index)
Definition: btGImpactBvhStructs.h:88
GIM_BVH_TREE_NODE::isLeafNode
bool isLeafNode() const
Definition: btGImpactBvhStructs.h:76
btAABB
Axis aligned box.
Definition: btBoxCollision.h:214
GIM_BVH_TREE_NODE::m_escapeIndexOrDataIndex
int m_escapeIndexOrDataIndex
Definition: btGImpactBvhStructs.h:68
GIM_BVH_DATA::m_bound
btAABB m_bound
Definition: btGImpactBvhStructs.h:57
GIM_PAIR::GIM_PAIR
GIM_PAIR(const GIM_PAIR &p)
Definition: btGImpactBvhStructs.h:41
GIM_BVH_TREE_NODE
Node Structure for trees.
Definition: btGImpactBvhStructs.h:62
btBoxCollision.h
GIM_PAIR
Overlapping pair.
Definition: btGImpactBvhStructs.h:33
btAlignedObjectArray.h
GIM_BVH_TREE_NODE::setDataIndex
void setDataIndex(int index)
Definition: btGImpactBvhStructs.h:100
GIM_BVH_TREE_NODE::m_bound
btAABB m_bound
Definition: btGImpactBvhStructs.h:65
GIM_BVH_TREE_NODE::getEscapeIndex
int getEscapeIndex() const
Definition: btGImpactBvhStructs.h:82
GIM_BVH_DATA::m_data
int m_data
Definition: btGImpactBvhStructs.h:58
GIM_BVH_TREE_NODE::GIM_BVH_TREE_NODE
GIM_BVH_TREE_NODE()
Definition: btGImpactBvhStructs.h:71
GIM_PAIR::m_index1
int m_index1
Definition: btGImpactBvhStructs.h:35