A ElementSim is a part of a ActorSim. It contributes to the activation framework by adding its interactions to the actor. */
| 48 | A ElementSim is a part of a ActorSim. It contributes to the activation framework by adding its |
| 49 | interactions to the actor. */ |
| 50 | class ElementSim : public Ps::UserAllocated |
| 51 | { |
| 52 | PX_NOCOPY(ElementSim) |
| 53 | |
| 54 | public: |
| 55 | class ElementInteractionIterator |
| 56 | { |
| 57 | public: |
| 58 | PX_FORCE_INLINE ElementInteractionIterator(const ElementSim& e, PxU32 nbInteractions, Interaction** interactions) : |
| 59 | mInteractions(interactions), mInteractionsLast(interactions + nbInteractions), mElement(&e) {} |
| 60 | ElementSimInteraction* getNext(); |
| 61 | |
| 62 | private: |
| 63 | Interaction** mInteractions; |
| 64 | Interaction** mInteractionsLast; |
| 65 | const ElementSim* mElement; |
| 66 | }; |
| 67 | |
| 68 | class ElementInteractionReverseIterator |
| 69 | { |
| 70 | public: |
| 71 | PX_FORCE_INLINE ElementInteractionReverseIterator(const ElementSim& e, PxU32 nbInteractions, Interaction** interactions) : |
| 72 | mInteractions(interactions), mInteractionsLast(interactions + nbInteractions), mElement(&e) {} |
| 73 | ElementSimInteraction* getNext(); |
| 74 | |
| 75 | private: |
| 76 | Interaction** mInteractions; |
| 77 | Interaction** mInteractionsLast; |
| 78 | const ElementSim* mElement; |
| 79 | }; |
| 80 | |
| 81 | ElementSim(ActorSim& actor); |
| 82 | protected: |
| 83 | ~ElementSim(); |
| 84 | public: |
| 85 | |
| 86 | // Get an iterator to the interactions connected to the element |
| 87 | PX_FORCE_INLINE ElementInteractionIterator getElemInteractions() const { return ElementInteractionIterator(*this, mActor.getActorInteractionCount(), mActor.getActorInteractions()); } |
| 88 | PX_FORCE_INLINE ElementInteractionReverseIterator getElemInteractionsReverse() const { return ElementInteractionReverseIterator(*this, mActor.getActorInteractionCount(), mActor.getActorInteractions()); } |
| 89 | |
| 90 | PX_FORCE_INLINE ActorSim& getActor() const { return mActor; } |
| 91 | |
| 92 | PX_FORCE_INLINE Scene& getScene() const { return mActor.getScene(); } |
| 93 | |
| 94 | PX_FORCE_INLINE PxU32 getElementID() const { return mElementID; } |
| 95 | PX_FORCE_INLINE bool isInBroadPhase() const { return mInBroadPhase; } |
| 96 | |
| 97 | void addToAABBMgr(PxReal contactDistance, Bp::FilterGroup::Enum group, Ps::IntBool isTrigger); |
| 98 | void removeFromAABBMgr(); |
| 99 | |
| 100 | void setElementInteractionsDirty(InteractionDirtyFlag::Enum flag, PxU8 interactionFlag); |
| 101 | |
| 102 | PX_FORCE_INLINE void initID() |
| 103 | { |
| 104 | Scene& scene = getScene(); |
| 105 | mElementID = scene.getElementIDPool().createID(); |
| 106 | scene.getBoundsArray().initEntry(mElementID); |
| 107 | } |