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

Bullet Collision Detection & Physics Library

btGImpactQuantizedBvhStructs.h
Go to the documentation of this file.
1#ifndef GIM_QUANTIZED_SET_STRUCTS_H_INCLUDED
2#define GIM_QUANTIZED_SET_STRUCTS_H_INCLUDED
3
7/*
8This source file is part of GIMPACT Library.
9
10For the latest info, see http://gimpact.sourceforge.net/
11
12Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371.
13email: projectileman@yahoo.com
14
15
16This software is provided 'as-is', without any express or implied warranty.
17In no event will the authors be held liable for any damages arising from the use of this software.
18Permission is granted to anyone to use this software for any purpose,
19including commercial applications, and to alter it and redistribute it freely,
20subject to the following restrictions:
21
221. 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.
232. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
243. This notice may not be removed or altered from any source distribution.
25*/
26
27#include "btGImpactBvh.h"
28#include "btQuantization.h"
29
32 ATTRIBUTE_ALIGNED16(struct)
33 BT_QUANTIZED_BVH_NODE
34{
35 //12 bytes
36 unsigned short int m_quantizedAabbMin[3];
37 unsigned short int m_quantizedAabbMax[3];
38 //4 bytes
39 int m_escapeIndexOrDataIndex;
40
41 BT_QUANTIZED_BVH_NODE()
42 {
43 m_escapeIndexOrDataIndex = 0;
44 }
45
46 SIMD_FORCE_INLINE bool isLeafNode() const
47 {
48 //skipindex is negative (internal node), triangleindex >=0 (leafnode)
49 return (m_escapeIndexOrDataIndex >= 0);
50 }
51
52 SIMD_FORCE_INLINE int getEscapeIndex() const
53 {
54 //btAssert(m_escapeIndexOrDataIndex < 0);
55 return -m_escapeIndexOrDataIndex;
56 }
57
58 SIMD_FORCE_INLINE void setEscapeIndex(int index)
59 {
60 m_escapeIndexOrDataIndex = -index;
61 }
62
63 SIMD_FORCE_INLINE int getDataIndex() const
64 {
65 //btAssert(m_escapeIndexOrDataIndex >= 0);
66
67 return m_escapeIndexOrDataIndex;
68 }
69
70 SIMD_FORCE_INLINE void setDataIndex(int index)
71 {
72 m_escapeIndexOrDataIndex = index;
73 }
74
75 SIMD_FORCE_INLINE bool testQuantizedBoxOverlapp(
76 unsigned short* quantizedMin, unsigned short* quantizedMax) const
77 {
78 if (m_quantizedAabbMin[0] > quantizedMax[0] ||
79 m_quantizedAabbMax[0] < quantizedMin[0] ||
80 m_quantizedAabbMin[1] > quantizedMax[1] ||
81 m_quantizedAabbMax[1] < quantizedMin[1] ||
82 m_quantizedAabbMin[2] > quantizedMax[2] ||
83 m_quantizedAabbMax[2] < quantizedMin[2])
84 {
85 return false;
86 }
87 return true;
88 }
89};
90
91#endif // GIM_QUANTIZED_SET_STRUCTS_H_INCLUDED
btGImpactBvh.h
btQuantization.h
ATTRIBUTE_ALIGNED16
#define ATTRIBUTE_ALIGNED16(a)
Definition btScalar.h:99
SIMD_FORCE_INLINE
#define SIMD_FORCE_INLINE
Definition btScalar.h:98
BT_QUANTIZED_BVH_NODE::isLeafNode
bool isLeafNode() const
Definition btGImpactQuantizedBvhStructs.h:46
BT_QUANTIZED_BVH_NODE::testQuantizedBoxOverlapp
bool testQuantizedBoxOverlapp(unsigned short *quantizedMin, unsigned short *quantizedMax) const
Definition btGImpactQuantizedBvhStructs.h:75
BT_QUANTIZED_BVH_NODE::getEscapeIndex
int getEscapeIndex() const
Definition btGImpactQuantizedBvhStructs.h:52
BT_QUANTIZED_BVH_NODE::setEscapeIndex
void setEscapeIndex(int index)
Definition btGImpactQuantizedBvhStructs.h:58
BT_QUANTIZED_BVH_NODE::setDataIndex
void setDataIndex(int index)
Definition btGImpactQuantizedBvhStructs.h:70
BT_QUANTIZED_BVH_NODE::getDataIndex
int getDataIndex() const
Definition btGImpactQuantizedBvhStructs.h:63
BT_QUANTIZED_BVH_NODE::m_quantizedAabbMin
unsigned short int m_quantizedAabbMin[3]
Definition btGImpactQuantizedBvhStructs.h:36
BT_QUANTIZED_BVH_NODE::m_escapeIndexOrDataIndex
int m_escapeIndexOrDataIndex
Definition btGImpactQuantizedBvhStructs.h:39
BT_QUANTIZED_BVH_NODE::BT_QUANTIZED_BVH_NODE
BT_QUANTIZED_BVH_NODE()
Definition btGImpactQuantizedBvhStructs.h:41
BT_QUANTIZED_BVH_NODE::m_quantizedAabbMax
unsigned short int m_quantizedAabbMax[3]
Definition btGImpactQuantizedBvhStructs.h:37