Changeset 2430 for code/branches/physics/src/bullet/BulletCollision/BroadphaseCollision/btQuantizedBvh.h
- Timestamp:
- Dec 13, 2008, 11:45:51 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/physics/src/bullet/BulletCollision/BroadphaseCollision/btQuantizedBvh.h
r2192 r2430 159 159 ATTRIBUTE_ALIGNED16(class) btQuantizedBvh 160 160 { 161 protected:162 163 NodeArray m_leafNodes;164 NodeArray m_contiguousNodes;165 166 QuantizedNodeArray m_quantizedLeafNodes;167 168 QuantizedNodeArray m_quantizedContiguousNodes;169 170 int m_curNodeIndex;171 172 173 //quantization data174 bool m_useQuantization;175 btVector3 m_bvhAabbMin;176 btVector3 m_bvhAabbMax;177 btVector3 m_bvhQuantization;178 161 public: 179 BT_DECLARE_ALIGNED_ALLOCATOR();180 181 162 enum btTraversalMode 182 163 { … … 185 166 TRAVERSAL_RECURSIVE 186 167 }; 168 187 169 protected: 188 170 171 172 btVector3 m_bvhAabbMin; 173 btVector3 m_bvhAabbMax; 174 btVector3 m_bvhQuantization; 175 176 int m_bulletVersion; //for serialization versioning. It could also be used to detect endianess. 177 178 int m_curNodeIndex; 179 //quantization data 180 bool m_useQuantization; 181 182 183 184 NodeArray m_leafNodes; 185 NodeArray m_contiguousNodes; 186 QuantizedNodeArray m_quantizedLeafNodes; 187 QuantizedNodeArray m_quantizedContiguousNodes; 188 189 189 btTraversalMode m_traversalMode; 190 191 190 BvhSubtreeInfoArray m_SubtreeHeaders; 192 191 193 192 //This is only used for serialization so we don't have to add serialization directly to btAlignedObjectArray 194 193 int m_subtreeHeaderCount; 194 195 196 195 197 196 198 … … 297 299 void walkStacklessQuantizedTreeAgainstRay(btNodeOverlapCallback* nodeCallback, const btVector3& raySource, const btVector3& rayTarget, const btVector3& aabbMin, const btVector3& aabbMax, int startNodeIndex,int endNodeIndex) const; 298 300 void walkStacklessQuantizedTree(btNodeOverlapCallback* nodeCallback,unsigned short int* quantizedQueryAabbMin,unsigned short int* quantizedQueryAabbMax,int startNodeIndex,int endNodeIndex) const; 301 void walkStacklessTreeAgainstRay(btNodeOverlapCallback* nodeCallback, const btVector3& raySource, const btVector3& rayTarget, const btVector3& aabbMin, const btVector3& aabbMax, int startNodeIndex,int endNodeIndex) const; 299 302 300 303 ///tree traversal designed for small-memory processors like PS3 SPU … … 308 311 309 312 310 #define USE_BANCHLESS 1 311 #ifdef USE_BANCHLESS 312 //This block replaces the block below and uses no branches, and replaces the 8 bit return with a 32 bit return for improved performance (~3x on XBox 360) 313 SIMD_FORCE_INLINE unsigned testQuantizedAabbAgainstQuantizedAabb(unsigned short int* aabbMin1,unsigned short int* aabbMax1,const unsigned short int* aabbMin2,const unsigned short int* aabbMax2) const 314 { 315 return static_cast<unsigned int>(btSelect((unsigned)((aabbMin1[0] <= aabbMax2[0]) & (aabbMax1[0] >= aabbMin2[0]) 316 & (aabbMin1[2] <= aabbMax2[2]) & (aabbMax1[2] >= aabbMin2[2]) 317 & (aabbMin1[1] <= aabbMax2[1]) & (aabbMax1[1] >= aabbMin2[1])), 318 1, 0)); 319 } 320 #else 321 SIMD_FORCE_INLINE bool testQuantizedAabbAgainstQuantizedAabb(unsigned short int* aabbMin1,unsigned short int* aabbMax1,const unsigned short int* aabbMin2,const unsigned short int* aabbMax2) const 322 { 323 bool overlap = true; 324 overlap = (aabbMin1[0] > aabbMax2[0] || aabbMax1[0] < aabbMin2[0]) ? false : overlap; 325 overlap = (aabbMin1[2] > aabbMax2[2] || aabbMax1[2] < aabbMin2[2]) ? false : overlap; 326 overlap = (aabbMin1[1] > aabbMax2[1] || aabbMax1[1] < aabbMin2[1]) ? false : overlap; 327 return overlap; 328 } 329 #endif //USE_BANCHLESS 313 330 314 331 315 void updateSubtreeHeaders(int leftChildNodexIndex,int rightChildNodexIndex); 332 316 333 317 public: 318 319 BT_DECLARE_ALIGNED_ALLOCATOR(); 320 334 321 btQuantizedBvh(); 335 322 … … 364 351 ///Make sure rounding is done in a way that unQuantize(quantizeWithClamp(...)) is conservative 365 352 ///end-points always set the first bit, so that they are sorted properly (so that neighbouring AABBs overlap properly) 366 /// todo: double-check this353 ///@todo: double-check this 367 354 if (isMax) 368 355 {
Note: See TracChangeset
for help on using the changeset viewer.