Bullet Collision Detection & Physics Library: btOptimizedBvh.cpp Source File

Bullet Collision Detection & Physics Library

btOptimizedBvh.cpp
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2009 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 #include "btOptimizedBvh.h"
17 #include "btStridingMeshInterface.h"
18 #include "LinearMath/btAabbUtil2.h"
19 #include "LinearMath/btIDebugDraw.h"
20
21 btOptimizedBvh::btOptimizedBvh()
22 {
23 }
24
25 btOptimizedBvh::~btOptimizedBvh()
26 {
27 }
28
29 void btOptimizedBvh::build(btStridingMeshInterface* triangles, bool useQuantizedAabbCompression, const btVector3& bvhAabbMin, const btVector3& bvhAabbMax)
30 {
31 m_useQuantization = useQuantizedAabbCompression;
32
33 // NodeArray triangleNodes;
34
35 struct NodeTriangleCallback : public btInternalTriangleIndexCallback
36 {
37 NodeArray& m_triangleNodes;
38
39 NodeTriangleCallback& operator=(NodeTriangleCallback& other)
40 {
41 m_triangleNodes.copyFromArray(other.m_triangleNodes);
42 return *this;
43 }
44
45 NodeTriangleCallback(NodeArray& triangleNodes)
46 : m_triangleNodes(triangleNodes)
47 {
48 }
49
50 virtual void internalProcessTriangleIndex(btVector3* triangle, int partId, int triangleIndex)
51 {
52 btOptimizedBvhNode node;
53 btVector3 aabbMin, aabbMax;
54 aabbMin.setValue(btScalar(BT_LARGE_FLOAT), btScalar(BT_LARGE_FLOAT), btScalar(BT_LARGE_FLOAT));
55 aabbMax.setValue(btScalar(-BT_LARGE_FLOAT), btScalar(-BT_LARGE_FLOAT), btScalar(-BT_LARGE_FLOAT));
56 aabbMin.setMin(triangle[0]);
57 aabbMax.setMax(triangle[0]);
58 aabbMin.setMin(triangle[1]);
59 aabbMax.setMax(triangle[1]);
60 aabbMin.setMin(triangle[2]);
61 aabbMax.setMax(triangle[2]);
62
63 //with quantization?
64 node.m_aabbMinOrg = aabbMin;
65 node.m_aabbMaxOrg = aabbMax;
66
67 node.m_escapeIndex = -1;
68
69 //for child nodes
70 node.m_subPart = partId;
71 node.m_triangleIndex = triangleIndex;
72 m_triangleNodes.push_back(node);
73 }
74 };
75 struct QuantizedNodeTriangleCallback : public btInternalTriangleIndexCallback
76 {
77 QuantizedNodeArray& m_triangleNodes;
78 const btQuantizedBvh* m_optimizedTree; // for quantization
79
80 QuantizedNodeTriangleCallback& operator=(QuantizedNodeTriangleCallback& other)
81 {
82 m_triangleNodes.copyFromArray(other.m_triangleNodes);
83 m_optimizedTree = other.m_optimizedTree;
84 return *this;
85 }
86
87 QuantizedNodeTriangleCallback(QuantizedNodeArray& triangleNodes, const btQuantizedBvh* tree)
88 : m_triangleNodes(triangleNodes), m_optimizedTree(tree)
89 {
90 }
91
92 virtual void internalProcessTriangleIndex(btVector3* triangle, int partId, int triangleIndex)
93 {
94 // The partId and triangle index must fit in the same (positive) integer
95 btAssert(partId < (1 << MAX_NUM_PARTS_IN_BITS));
96 btAssert(triangleIndex < (1 << (31 - MAX_NUM_PARTS_IN_BITS)));
97 //negative indices are reserved for escapeIndex
98 btAssert(triangleIndex >= 0);
99
100 btQuantizedBvhNode node;
101 btVector3 aabbMin, aabbMax;
102 aabbMin.setValue(btScalar(BT_LARGE_FLOAT), btScalar(BT_LARGE_FLOAT), btScalar(BT_LARGE_FLOAT));
103 aabbMax.setValue(btScalar(-BT_LARGE_FLOAT), btScalar(-BT_LARGE_FLOAT), btScalar(-BT_LARGE_FLOAT));
104 aabbMin.setMin(triangle[0]);
105 aabbMax.setMax(triangle[0]);
106 aabbMin.setMin(triangle[1]);
107 aabbMax.setMax(triangle[1]);
108 aabbMin.setMin(triangle[2]);
109 aabbMax.setMax(triangle[2]);
110
111 //PCK: add these checks for zero dimensions of aabb
112 const btScalar MIN_AABB_DIMENSION = btScalar(0.002);
113 const btScalar MIN_AABB_HALF_DIMENSION = btScalar(0.001);
114 if (aabbMax.x() - aabbMin.x() < MIN_AABB_DIMENSION)
115 {
116 aabbMax.setX(aabbMax.x() + MIN_AABB_HALF_DIMENSION);
117 aabbMin.setX(aabbMin.x() - MIN_AABB_HALF_DIMENSION);
118 }
119 if (aabbMax.y() - aabbMin.y() < MIN_AABB_DIMENSION)
120 {
121 aabbMax.setY(aabbMax.y() + MIN_AABB_HALF_DIMENSION);
122 aabbMin.setY(aabbMin.y() - MIN_AABB_HALF_DIMENSION);
123 }
124 if (aabbMax.z() - aabbMin.z() < MIN_AABB_DIMENSION)
125 {
126 aabbMax.setZ(aabbMax.z() + MIN_AABB_HALF_DIMENSION);
127 aabbMin.setZ(aabbMin.z() - MIN_AABB_HALF_DIMENSION);
128 }
129
130 m_optimizedTree->quantize(&node.m_quantizedAabbMin[0], aabbMin, 0);
131 m_optimizedTree->quantize(&node.m_quantizedAabbMax[0], aabbMax, 1);
132
133 node.m_escapeIndexOrTriangleIndex = (partId << (31 - MAX_NUM_PARTS_IN_BITS)) | triangleIndex;
134
135 m_triangleNodes.push_back(node);
136 }
137 };
138
139 int numLeafNodes = 0;
140
141 if (m_useQuantization)
142 {
143 //initialize quantization values
144 setQuantizationValues(bvhAabbMin, bvhAabbMax);
145
146 QuantizedNodeTriangleCallback callback(m_quantizedLeafNodes, this);
147
148 triangles->InternalProcessAllTriangles(&callback, m_bvhAabbMin, m_bvhAabbMax);
149
150 //now we have an array of leafnodes in m_leafNodes
151 numLeafNodes = m_quantizedLeafNodes.size();
152
153 m_quantizedContiguousNodes.resize(2 * numLeafNodes);
154 }
155 else
156 {
157 NodeTriangleCallback callback(m_leafNodes);
158
159 btVector3 aabbMin(btScalar(-BT_LARGE_FLOAT), btScalar(-BT_LARGE_FLOAT), btScalar(-BT_LARGE_FLOAT));
160 btVector3 aabbMax(btScalar(BT_LARGE_FLOAT), btScalar(BT_LARGE_FLOAT), btScalar(BT_LARGE_FLOAT));
161
162 triangles->InternalProcessAllTriangles(&callback, aabbMin, aabbMax);
163
164 //now we have an array of leafnodes in m_leafNodes
165 numLeafNodes = m_leafNodes.size();
166
167 m_contiguousNodes.resize(2 * numLeafNodes);
168 }
169
170 m_curNodeIndex = 0;
171
172 buildTree(0, numLeafNodes);
173
175 if (m_useQuantization && !m_SubtreeHeaders.size())
176 {
177 btBvhSubtreeInfo& subtree = m_SubtreeHeaders.expand();
178 subtree.setAabbFromQuantizeNode(m_quantizedContiguousNodes[0]);
179 subtree.m_rootNodeIndex = 0;
180 subtree.m_subtreeSize = m_quantizedContiguousNodes[0].isLeafNode() ? 1 : m_quantizedContiguousNodes[0].getEscapeIndex();
181 }
182
183 //PCK: update the copy of the size
184 m_subtreeHeaderCount = m_SubtreeHeaders.size();
185
186 //PCK: clear m_quantizedLeafNodes and m_leafNodes, they are temporary
187 m_quantizedLeafNodes.clear();
188 m_leafNodes.clear();
189 }
190
191 void btOptimizedBvh::refit(btStridingMeshInterface* meshInterface, const btVector3& aabbMin, const btVector3& aabbMax)
192 {
193 if (m_useQuantization)
194 {
195 setQuantizationValues(aabbMin, aabbMax);
196
197 updateBvhNodes(meshInterface, 0, m_curNodeIndex, 0);
198
200
201 int i;
202 for (i = 0; i < m_SubtreeHeaders.size(); i++)
203 {
204 btBvhSubtreeInfo& subtree = m_SubtreeHeaders[i];
205 subtree.setAabbFromQuantizeNode(m_quantizedContiguousNodes[subtree.m_rootNodeIndex]);
206 }
207 }
208 else
209 {
210 }
211 }
212
213 void btOptimizedBvh::refitPartial(btStridingMeshInterface* meshInterface, const btVector3& aabbMin, const btVector3& aabbMax)
214 {
215 //incrementally initialize quantization values
216 btAssert(m_useQuantization);
217
218 btAssert(aabbMin.getX() > m_bvhAabbMin.getX());
219 btAssert(aabbMin.getY() > m_bvhAabbMin.getY());
220 btAssert(aabbMin.getZ() > m_bvhAabbMin.getZ());
221
222 btAssert(aabbMax.getX() < m_bvhAabbMax.getX());
223 btAssert(aabbMax.getY() < m_bvhAabbMax.getY());
224 btAssert(aabbMax.getZ() < m_bvhAabbMax.getZ());
225
228
229 unsigned short quantizedQueryAabbMin[3];
230 unsigned short quantizedQueryAabbMax[3];
231
232 quantize(&quantizedQueryAabbMin[0], aabbMin, 0);
233 quantize(&quantizedQueryAabbMax[0], aabbMax, 1);
234
235 int i;
236 for (i = 0; i < this->m_SubtreeHeaders.size(); i++)
237 {
238 btBvhSubtreeInfo& subtree = m_SubtreeHeaders[i];
239
240 //PCK: unsigned instead of bool
241 unsigned overlap = testQuantizedAabbAgainstQuantizedAabb(quantizedQueryAabbMin, quantizedQueryAabbMax, subtree.m_quantizedAabbMin, subtree.m_quantizedAabbMax);
242 if (overlap != 0)
243 {
244 updateBvhNodes(meshInterface, subtree.m_rootNodeIndex, subtree.m_rootNodeIndex + subtree.m_subtreeSize, i);
245
246 subtree.setAabbFromQuantizeNode(m_quantizedContiguousNodes[subtree.m_rootNodeIndex]);
247 }
248 }
249 }
250
251 void btOptimizedBvh::updateBvhNodes(btStridingMeshInterface* meshInterface, int firstNode, int endNode, int index)
252 {
253 (void)index;
254
255 btAssert(m_useQuantization);
256
257 int curNodeSubPart = -1;
258
259 //get access info to trianglemesh data
260 const unsigned char* vertexbase = 0;
261 int numverts = 0;
262 PHY_ScalarType type = PHY_INTEGER;
263 int stride = 0;
264 const unsigned char* indexbase = 0;
265 int indexstride = 0;
266 int numfaces = 0;
267 PHY_ScalarType indicestype = PHY_INTEGER;
268
269 btVector3 triangleVerts[3];
270 btVector3 aabbMin, aabbMax;
271 const btVector3& meshScaling = meshInterface->getScaling();
272
273 int i;
274 for (i = endNode - 1; i >= firstNode; i--)
275 {
276 btQuantizedBvhNode& curNode = m_quantizedContiguousNodes[i];
277 if (curNode.isLeafNode())
278 {
279 //recalc aabb from triangle data
280 int nodeSubPart = curNode.getPartId();
281 int nodeTriangleIndex = curNode.getTriangleIndex();
282 if (nodeSubPart != curNodeSubPart)
283 {
284 if (curNodeSubPart >= 0)
285 meshInterface->unLockReadOnlyVertexBase(curNodeSubPart);
286 meshInterface->getLockedReadOnlyVertexIndexBase(&vertexbase, numverts, type, stride, &indexbase, indexstride, numfaces, indicestype, nodeSubPart);
287
288 curNodeSubPart = nodeSubPart;
289 btAssert(indicestype == PHY_INTEGER || indicestype == PHY_SHORT);
290 }
291 //triangles->getLockedReadOnlyVertexIndexBase(vertexBase,numVerts,
292
293 unsigned int* gfxbase = (unsigned int*)(indexbase + nodeTriangleIndex * indexstride);
294
295 for (int j = 2; j >= 0; j--)
296 {
297 int graphicsindex = indicestype == PHY_SHORT ? ((unsigned short*)gfxbase)[j] : gfxbase[j];
298 if (type == PHY_FLOAT)
299 {
300 float* graphicsbase = (float*)(vertexbase + graphicsindex * stride);
301 triangleVerts[j] = btVector3(
302 graphicsbase[0] * meshScaling.getX(),
303 graphicsbase[1] * meshScaling.getY(),
304 graphicsbase[2] * meshScaling.getZ());
305 }
306 else
307 {
308 double* graphicsbase = (double*)(vertexbase + graphicsindex * stride);
309 triangleVerts[j] = btVector3(btScalar(graphicsbase[0] * meshScaling.getX()), btScalar(graphicsbase[1] * meshScaling.getY()), btScalar(graphicsbase[2] * meshScaling.getZ()));
310 }
311 }
312
313 aabbMin.setValue(btScalar(BT_LARGE_FLOAT), btScalar(BT_LARGE_FLOAT), btScalar(BT_LARGE_FLOAT));
314 aabbMax.setValue(btScalar(-BT_LARGE_FLOAT), btScalar(-BT_LARGE_FLOAT), btScalar(-BT_LARGE_FLOAT));
315 aabbMin.setMin(triangleVerts[0]);
316 aabbMax.setMax(triangleVerts[0]);
317 aabbMin.setMin(triangleVerts[1]);
318 aabbMax.setMax(triangleVerts[1]);
319 aabbMin.setMin(triangleVerts[2]);
320 aabbMax.setMax(triangleVerts[2]);
321
322 quantize(&curNode.m_quantizedAabbMin[0], aabbMin, 0);
323 quantize(&curNode.m_quantizedAabbMax[0], aabbMax, 1);
324 }
325 else
326 {
327 //combine aabb from both children
328
329 btQuantizedBvhNode* leftChildNode = &m_quantizedContiguousNodes[i + 1];
330
331 btQuantizedBvhNode* rightChildNode = leftChildNode->isLeafNode() ? &m_quantizedContiguousNodes[i + 2] : &m_quantizedContiguousNodes[i + 1 + leftChildNode->getEscapeIndex()];
332
333 {
334 for (int i = 0; i < 3; i++)
335 {
336 curNode.m_quantizedAabbMin[i] = leftChildNode->m_quantizedAabbMin[i];
337 if (curNode.m_quantizedAabbMin[i] > rightChildNode->m_quantizedAabbMin[i])
338 curNode.m_quantizedAabbMin[i] = rightChildNode->m_quantizedAabbMin[i];
339
340 curNode.m_quantizedAabbMax[i] = leftChildNode->m_quantizedAabbMax[i];
341 if (curNode.m_quantizedAabbMax[i] < rightChildNode->m_quantizedAabbMax[i])
342 curNode.m_quantizedAabbMax[i] = rightChildNode->m_quantizedAabbMax[i];
343 }
344 }
345 }
346 }
347
348 if (curNodeSubPart >= 0)
349 meshInterface->unLockReadOnlyVertexBase(curNodeSubPart);
350 }
351
353 btOptimizedBvh* btOptimizedBvh::deSerializeInPlace(void* i_alignedDataBuffer, unsigned int i_dataBufferSize, bool i_swapEndian)
354 {
355 btQuantizedBvh* bvh = btQuantizedBvh::deSerializeInPlace(i_alignedDataBuffer, i_dataBufferSize, i_swapEndian);
356
357 //we don't add additional data so just do a static upcast
358 return static_cast<btOptimizedBvh*>(bvh);
359 }
btQuantizedBvhNode::m_escapeIndexOrTriangleIndex
int m_escapeIndexOrTriangleIndex
Definition: btQuantizedBvh.h:64
btAlignedObjectArray::push_back
void push_back(const T &_Val)
Definition: btAlignedObjectArray.h:264
BT_LARGE_FLOAT
#define BT_LARGE_FLOAT
Definition: btScalar.h:296
btQuantizedBvh::setQuantizationValues
void setQuantizationValues(const btVector3 &bvhAabbMin, const btVector3 &bvhAabbMax, btScalar quantizationMargin=btScalar(1.0))
***************************************** expert/internal use only ************************* ...
Definition: btQuantizedBvh.cpp:81
btQuantizedBvhNode::getTriangleIndex
int getTriangleIndex() const
Definition: btQuantizedBvh.h:76
btVector3::setValue
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
Definition: btVector3.h:640
btAlignedObjectArray< btOptimizedBvhNode >
btBvhSubtreeInfo::m_subtreeSize
int m_subtreeSize
Definition: btQuantizedBvh.h:128
btVector3::setZ
void setZ(btScalar _z)
Set the z value.
Definition: btVector3.h:571
btOptimizedBvh::build
void build(btStridingMeshInterface *triangles, bool useQuantizedAabbCompression, const btVector3 &bvhAabbMin, const btVector3 &bvhAabbMax)
Definition: btOptimizedBvh.cpp:29
btBvhSubtreeInfo::m_rootNodeIndex
int m_rootNodeIndex
Definition: btQuantizedBvh.h:126
btStridingMeshInterface::InternalProcessAllTriangles
virtual void InternalProcessAllTriangles(btInternalTriangleIndexCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
Definition: btStridingMeshInterface.cpp:23
btQuantizedBvh::m_bvhAabbMax
btVector3 m_bvhAabbMax
Definition: btQuantizedBvh.h:179
btQuantizedBvhNode::isLeafNode
bool isLeafNode() const
Definition: btQuantizedBvh.h:66
btOptimizedBvhNode::m_subPart
int m_subPart
Definition: btQuantizedBvh.h:108
btAssert
#define btAssert(x)
Definition: btScalar.h:133
btStridingMeshInterface.h
btVector3::getY
const btScalar & getY() const
Return the y value.
Definition: btVector3.h:563
btOptimizedBvh::updateBvhNodes
void updateBvhNodes(btStridingMeshInterface *meshInterface, int firstNode, int endNode, int index)
Definition: btOptimizedBvh.cpp:251
btAlignedObjectArray::copyFromArray
void copyFromArray(const btAlignedObjectArray &otherArray)
Definition: btAlignedObjectArray.h:503
btOptimizedBvh::refit
void refit(btStridingMeshInterface *triangles, const btVector3 &aabbMin, const btVector3 &aabbMax)
Definition: btOptimizedBvh.cpp:191
btOptimizedBvh.h
btInternalTriangleIndexCallback
Definition: btTriangleCallback.h:30
btAlignedObjectArray::clear
void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0), to reduce performance overhead of run-time memory (de)allocations.
Definition: btAlignedObjectArray.h:183
btOptimizedBvh::btOptimizedBvh
btOptimizedBvh()
Definition: btOptimizedBvh.cpp:21
btBvhSubtreeInfo
btBvhSubtreeInfo provides info to gather a subtree of limited size
Definition: btQuantizedBvh.h:116
btVector3::getZ
const btScalar & getZ() const
Return the z value.
Definition: btVector3.h:565
btVector3::setX
void setX(btScalar _x)
Set the x value.
Definition: btVector3.h:567
MAX_NUM_PARTS_IN_BITS
#define MAX_NUM_PARTS_IN_BITS
Definition: btQuantizedBvh.h:51
btQuantizedBvh::m_contiguousNodes
NodeArray m_contiguousNodes
Definition: btQuantizedBvh.h:189
btQuantizedBvh::m_leafNodes
NodeArray m_leafNodes
Definition: btQuantizedBvh.h:188
btQuantizedBvh::m_useQuantization
bool m_useQuantization
Definition: btQuantizedBvh.h:186
btVector3::x
const btScalar & x() const
Return the x value.
Definition: btVector3.h:575
btAabbUtil2.h
btBvhSubtreeInfo::setAabbFromQuantizeNode
void setAabbFromQuantizeNode(const btQuantizedBvhNode &quantizedNode)
Definition: btQuantizedBvh.h:136
PHY_SHORT
Definition: btConcaveShape.h:30
testQuantizedAabbAgainstQuantizedAabb
unsigned testQuantizedAabbAgainstQuantizedAabb(const unsigned short int *aabbMin1, const unsigned short int *aabbMax1, const unsigned short int *aabbMin2, const unsigned short int *aabbMax2)
Definition: btAabbUtil2.h:201
btOptimizedBvhNode
btOptimizedBvhNode contains both internal and leaf node information.
Definition: btQuantizedBvh.h:94
btVector3::setY
void setY(btScalar _y)
Set the y value.
Definition: btVector3.h:569
btVector3::y
const btScalar & y() const
Return the y value.
Definition: btVector3.h:577
btVector3::z
const btScalar & z() const
Return the z value.
Definition: btVector3.h:579
btQuantizedBvh::m_curNodeIndex
int m_curNodeIndex
Definition: btQuantizedBvh.h:184
btOptimizedBvh
The btOptimizedBvh extends the btQuantizedBvh to create AABB tree for triangle meshes, through the btStridingMeshInterface.
Definition: btOptimizedBvh.h:26
btQuantizedBvhNode
btQuantizedBvhNode is a compressed aabb node, 16 bytes.
Definition: btQuantizedBvh.h:55
btQuantizedBvh::m_SubtreeHeaders
BvhSubtreeInfoArray m_SubtreeHeaders
Definition: btQuantizedBvh.h:194
btQuantizedBvh::m_bvhAabbMin
btVector3 m_bvhAabbMin
Definition: btQuantizedBvh.h:178
btQuantizedBvh::deSerializeInPlace
static btQuantizedBvh * deSerializeInPlace(void *i_alignedDataBuffer, unsigned int i_dataBufferSize, bool i_swapEndian)
deSerializeInPlace loads and initializes a BVH from a buffer in memory &#39;in place&#39; ...
Definition: btQuantizedBvh.cpp:1016
btOptimizedBvhNode::m_aabbMaxOrg
btVector3 m_aabbMaxOrg
Definition: btQuantizedBvh.h:101
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:80
btAlignedObjectArray::size
int size() const
return the number of elements in the array
Definition: btAlignedObjectArray.h:149
btBvhSubtreeInfo::m_quantizedAabbMax
unsigned short int m_quantizedAabbMax[3]
Definition: btQuantizedBvh.h:124
btStridingMeshInterface
The btStridingMeshInterface is the interface class for high performance generic access to triangle me...
Definition: btStridingMeshInterface.h:26
btIDebugDraw.h
btStridingMeshInterface::getScaling
const btVector3 & getScaling() const
Definition: btStridingMeshInterface.h:80
PHY_INTEGER
Definition: btConcaveShape.h:29
btAlignedObjectArray::resize
void resize(int newsize, const T &fillData=T())
Definition: btAlignedObjectArray.h:210
btOptimizedBvh::deSerializeInPlace
static btOptimizedBvh * deSerializeInPlace(void *i_alignedDataBuffer, unsigned int i_dataBufferSize, bool i_swapEndian)
deSerializeInPlace loads and initializes a BVH from a buffer in memory &#39;in place&#39; ...
Definition: btOptimizedBvh.cpp:353
btQuantizedBvhNode::getEscapeIndex
int getEscapeIndex() const
Definition: btQuantizedBvh.h:71
btStridingMeshInterface::getLockedReadOnlyVertexIndexBase
virtual void getLockedReadOnlyVertexIndexBase(const unsigned char **vertexbase, int &numverts, PHY_ScalarType &type, int &stride, const unsigned char **indexbase, int &indexstride, int &numfaces, PHY_ScalarType &indicestype, int subpart=0) const =0
btQuantizedBvh
The btQuantizedBvh class stores an AABB tree that can be quickly traversed on CPU and Cell SPU...
Definition: btQuantizedBvh.h:166
btQuantizedBvhNode::m_quantizedAabbMin
unsigned short int m_quantizedAabbMin[3]
Definition: btQuantizedBvh.h:61
btAlignedObjectArray::expand
T & expand(const T &fillValue=T())
Definition: btAlignedObjectArray.h:249
btOptimizedBvhNode::m_aabbMinOrg
btVector3 m_aabbMinOrg
Definition: btQuantizedBvh.h:100
btOptimizedBvhNode::m_escapeIndex
int m_escapeIndex
Definition: btQuantizedBvh.h:104
btQuantizedBvhNode::m_quantizedAabbMax
unsigned short int m_quantizedAabbMax[3]
Definition: btQuantizedBvh.h:62
btQuantizedBvh::buildTree
void buildTree(int startIndex, int endIndex)
Definition: btQuantizedBvh.cpp:121
btStridingMeshInterface::unLockReadOnlyVertexBase
virtual void unLockReadOnlyVertexBase(int subpart) const =0
btQuantizedBvh::quantize
void quantize(unsigned short *out, const btVector3 &point, int isMax) const
Definition: btQuantizedBvh.h:326
btVector3::setMax
void setMax(const btVector3 &other)
Set each element to the max of the current values and the values of another btVector3.
Definition: btVector3.h:609
btQuantizedBvh::m_quantizedLeafNodes
QuantizedNodeArray m_quantizedLeafNodes
Definition: btQuantizedBvh.h:190
btQuantizedBvh::m_subtreeHeaderCount
int m_subtreeHeaderCount
Definition: btQuantizedBvh.h:197
btBvhSubtreeInfo::m_quantizedAabbMin
unsigned short int m_quantizedAabbMin[3]
Definition: btQuantizedBvh.h:123
btOptimizedBvhNode::m_triangleIndex
int m_triangleIndex
Definition: btQuantizedBvh.h:109
btOptimizedBvh::~btOptimizedBvh
virtual ~btOptimizedBvh()
Definition: btOptimizedBvh.cpp:25
btVector3::getX
const btScalar & getX() const
Return the x value.
Definition: btVector3.h:561
btVector3::setMin
void setMin(const btVector3 &other)
Set each element to the min of the current values and the values of another btVector3.
Definition: btVector3.h:626
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:294
PHY_ScalarType
PHY_ScalarType
PHY_ScalarType enumerates possible scalar types.
Definition: btConcaveShape.h:25
btOptimizedBvh::refitPartial
void refitPartial(btStridingMeshInterface *triangles, const btVector3 &aabbMin, const btVector3 &aabbMax)
Definition: btOptimizedBvh.cpp:213
PHY_FLOAT
Definition: btConcaveShape.h:27
btQuantizedBvh::m_quantizedContiguousNodes
QuantizedNodeArray m_quantizedContiguousNodes
Definition: btQuantizedBvh.h:191
btQuantizedBvhNode::getPartId
int getPartId() const
Definition: btQuantizedBvh.h:84