| 653 | /////////////////////////////////////////////////////////////////////////////// |
| 654 | |
| 655 | struct ABP_Object : public Ps::UserAllocated |
| 656 | { |
| 657 | PX_FORCE_INLINE ABP_Object() : mIndex(INVALID_ID) |
| 658 | { |
| 659 | #if PX_DEBUG |
| 660 | mUpdated = false; |
| 661 | #endif |
| 662 | } |
| 663 | |
| 664 | private: |
| 665 | PxU32 mIndex; // Out-to-in, maps user handle to internal array. mIndex indexes either the static or dynamic array. |
| 666 | // PT: the type won't be available for removed objects so we have to store it there. That uses 2 bits. |
| 667 | // Then the "data" will need one more bit for marking sleeping objects so that leaves 28bits for the actual index. |
| 668 | PX_FORCE_INLINE void setData(PxU32 index, FilterType::Enum type) |
| 669 | { |
| 670 | // mIndex = index; |
| 671 | index <<= 2; |
| 672 | index |= type; |
| 673 | mIndex = index; |
| 674 | } |
| 675 | public: |
| 676 | // PT: TODO: rename "index" to data everywhere |
| 677 | PX_FORCE_INLINE void setActiveIndex(PxU32 index, FilterType::Enum type) |
| 678 | { |
| 679 | const PxU32 boxData = (index+index); |
| 680 | setData(boxData, type); |
| 681 | } |
| 682 | |
| 683 | PX_FORCE_INLINE void setSleepingIndex(PxU32 index, FilterType::Enum type) |
| 684 | { |
| 685 | const PxU32 boxData = (index+index)|1; |
| 686 | PX_ASSERT(getType()==type); |
| 687 | setData(boxData, type); |
| 688 | } |
| 689 | |
| 690 | PX_FORCE_INLINE FilterType::Enum getType() const |
| 691 | { |
| 692 | return FilterType::Enum(mIndex&3); |
| 693 | } |
| 694 | |
| 695 | PX_FORCE_INLINE PxU32 getData() const |
| 696 | { |
| 697 | return mIndex>>2; |
| 698 | } |
| 699 | |
| 700 | PX_FORCE_INLINE void invalidateIndex() |
| 701 | { |