29#ifndef SC_INTERACTION_H
30#define SC_INTERACTION_H
32#include "foundation/Px.h"
33#include "ScInteractionFlags.h"
35#include "ScActorSim.h"
36#include "foundation/PxUserAllocated.h"
37#include "foundation/PxUtilities.h"
41#define PX_INVALID_INTERACTION_ACTOR_ID 0xffffffff
42#define PX_INVALID_INTERACTION_SCENE_ID 0xffffffff
55 ~Interaction() { PX_ASSERT(!readInteractionFlag(InteractionFlag::eIN_DIRTY_LIST)); }
68 PX_FORCE_INLINE InteractionType::Enum getType()
const {
return InteractionType::Enum(mInteractionType); }
70 PX_FORCE_INLINE PxU8 readInteractionFlag(PxU8 flag)
const {
return PxU8(mInteractionFlags & flag); }
71 PX_FORCE_INLINE void raiseInteractionFlag(InteractionFlag::Enum flag) { mInteractionFlags |= flag; }
72 PX_FORCE_INLINE void clearInteractionFlag(InteractionFlag::Enum flag) { mInteractionFlags &= ~flag; }
88 PX_FORCE_INLINE PxIntBool needsRefiltering()
const {
return (getDirtyFlags() & InteractionDirtyFlag::eFILTER_STATE); }
102 PX_FORCE_INLINE bool isRegistered()
const {
return mSceneId != PX_INVALID_INTERACTION_SCENE_ID; }
110 void addToDirtyList();
111 void removeFromDirtyList();
124 const PxU8 mInteractionType;
125 PxU8 mInteractionFlags;
136 bool active = activateInteraction(
this, data);
138 mActor0.registerInteractionInActor(
this);
139 mActor1.registerInteractionInActor(
this);
146 mActor0.unregisterInteractionFromActor(
this);
147 mActor1.unregisterInteractionFromActor(
this);
150PX_FORCE_INLINE void Sc::Interaction::setActorId(ActorSim* actor, PxU32
id)
152 PX_ASSERT(
id != PX_INVALID_INTERACTION_ACTOR_ID);
153 PX_ASSERT(&mActor0 == actor || &mActor1 == actor);
154 if(&mActor0 == actor)
160PX_FORCE_INLINE PxU32 Sc::Interaction::getActorId(
const ActorSim* actor)
const
162 PX_ASSERT(&mActor0 == actor || &mActor1 == actor);
163 return &mActor0 == actor ? mActorId0 : mActorId1;
168 const PxIntBool res = readInteractionFlag(InteractionFlag::eRB_ELEMENT);
170 ((getType() == InteractionType::eOVERLAP) ||
171 (getType() == InteractionType::eTRIGGER) ||
172 (getType() == InteractionType::eMARKER))) ||
174 ((getType() == InteractionType::eCONSTRAINTSHADER) ||
175 (getType() == InteractionType::eARTICULATION))));
182 PX_ASSERT(getType() != InteractionType::eARTICULATION);
184 mDirtyFlags |= PxTo8(dirtyFlags);
185 if(!readInteractionFlag(InteractionFlag::eIN_DIRTY_LIST))
188 raiseInteractionFlag(InteractionFlag::eIN_DIRTY_LIST);
Definition PxUserAllocated.h:43
Definition ScActorSim.h:83
Definition ScInteraction.h:50
PX_FORCE_INLINE void setDirty(PxU32 dirtyFlags)
Mark the interaction as dirty. This will put the interaction into a list that is processed once per s...
Definition ScInteraction.h:180
void setClean(bool removeFromList)
Clear all flags that mark the interaction as dirty and optionally remove the interaction from the lis...
Definition ScInteraction.cpp:60
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39