Changeset 8351 for code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btQuantizedBvh.h
- Timestamp:
- Apr 28, 2011, 7:15:14 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btQuantizedBvh.h
r5781 r8351 17 17 #define QUANTIZED_BVH_H 18 18 19 class btSerializer; 20 19 21 //#define DEBUG_CHECK_DEQUANTIZATION 1 20 22 #ifdef DEBUG_CHECK_DEQUANTIZATION … … 29 31 #include "LinearMath/btVector3.h" 30 32 #include "LinearMath/btAlignedAllocator.h" 33 34 #ifdef BT_USE_DOUBLE_PRECISION 35 #define btQuantizedBvhData btQuantizedBvhDoubleData 36 #define btOptimizedBvhNodeData btOptimizedBvhNodeDoubleData 37 #define btQuantizedBvhDataName "btQuantizedBvhDoubleData" 38 #else 39 #define btQuantizedBvhData btQuantizedBvhFloatData 40 #define btOptimizedBvhNodeData btOptimizedBvhNodeFloatData 41 #define btQuantizedBvhDataName "btQuantizedBvhFloatData" 42 #endif 43 31 44 32 45 … … 191 204 192 205 //This is only used for serialization so we don't have to add serialization directly to btAlignedObjectArray 193 int m_subtreeHeaderCount;206 mutable int m_subtreeHeaderCount; 194 207 195 208 … … 444 457 } 445 458 459 //////////////////////////////////////////////////////////////////// 446 460 447 461 /////Calculate space needed to store BVH for serialization 448 unsigned calculateSerializeBufferSize() ;462 unsigned calculateSerializeBufferSize() const; 449 463 450 464 /// Data buffer MUST be 16 byte aligned 451 virtual bool serialize(void *o_alignedDataBuffer, unsigned i_dataBufferSize, bool i_swapEndian) ;465 virtual bool serialize(void *o_alignedDataBuffer, unsigned i_dataBufferSize, bool i_swapEndian) const; 452 466 453 467 ///deSerializeInPlace loads and initializes a BVH from a buffer in memory 'in place' … … 455 469 456 470 static unsigned int getAlignmentSerializationPadding(); 471 ////////////////////////////////////////////////////////////////////// 472 473 474 virtual int calculateSerializeBufferSizeNew() const; 475 476 ///fills the dataBuffer and returns the struct name (and 0 on failure) 477 virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const; 478 479 virtual void deSerializeFloat(struct btQuantizedBvhFloatData& quantizedBvhFloatData); 480 481 virtual void deSerializeDouble(struct btQuantizedBvhDoubleData& quantizedBvhDoubleData); 482 483 484 //////////////////////////////////////////////////////////////////// 457 485 458 486 SIMD_FORCE_INLINE bool isQuantized() … … 471 499 472 500 501 struct btBvhSubtreeInfoData 502 { 503 int m_rootNodeIndex; 504 int m_subtreeSize; 505 unsigned short m_quantizedAabbMin[3]; 506 unsigned short m_quantizedAabbMax[3]; 507 }; 508 509 struct btOptimizedBvhNodeFloatData 510 { 511 btVector3FloatData m_aabbMinOrg; 512 btVector3FloatData m_aabbMaxOrg; 513 int m_escapeIndex; 514 int m_subPart; 515 int m_triangleIndex; 516 char m_pad[4]; 517 }; 518 519 struct btOptimizedBvhNodeDoubleData 520 { 521 btVector3DoubleData m_aabbMinOrg; 522 btVector3DoubleData m_aabbMaxOrg; 523 int m_escapeIndex; 524 int m_subPart; 525 int m_triangleIndex; 526 char m_pad[4]; 527 }; 528 529 530 struct btQuantizedBvhNodeData 531 { 532 unsigned short m_quantizedAabbMin[3]; 533 unsigned short m_quantizedAabbMax[3]; 534 int m_escapeIndexOrTriangleIndex; 535 }; 536 537 struct btQuantizedBvhFloatData 538 { 539 btVector3FloatData m_bvhAabbMin; 540 btVector3FloatData m_bvhAabbMax; 541 btVector3FloatData m_bvhQuantization; 542 int m_curNodeIndex; 543 int m_useQuantization; 544 int m_numContiguousLeafNodes; 545 int m_numQuantizedContiguousNodes; 546 btOptimizedBvhNodeFloatData *m_contiguousNodesPtr; 547 btQuantizedBvhNodeData *m_quantizedContiguousNodesPtr; 548 btBvhSubtreeInfoData *m_subTreeInfoPtr; 549 int m_traversalMode; 550 int m_numSubtreeHeaders; 551 552 }; 553 554 struct btQuantizedBvhDoubleData 555 { 556 btVector3DoubleData m_bvhAabbMin; 557 btVector3DoubleData m_bvhAabbMax; 558 btVector3DoubleData m_bvhQuantization; 559 int m_curNodeIndex; 560 int m_useQuantization; 561 int m_numContiguousLeafNodes; 562 int m_numQuantizedContiguousNodes; 563 btOptimizedBvhNodeDoubleData *m_contiguousNodesPtr; 564 btQuantizedBvhNodeData *m_quantizedContiguousNodesPtr; 565 566 int m_traversalMode; 567 int m_numSubtreeHeaders; 568 btBvhSubtreeInfoData *m_subTreeInfoPtr; 569 }; 570 571 572 SIMD_FORCE_INLINE int btQuantizedBvh::calculateSerializeBufferSizeNew() const 573 { 574 return sizeof(btQuantizedBvhData); 575 } 576 577 578 473 579 #endif //QUANTIZED_BVH_H
Note: See TracChangeset
for help on using the changeset viewer.