00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef PX_PHYSICS_NX_SCENE
00032 #define PX_PHYSICS_NX_SCENE
00033
00037 #include "PxVisualizationParameter.h"
00038 #include "PxSceneDesc.h"
00039 #include "PxSimulationStatistics.h"
00040 #include "PxQueryReport.h"
00041 #include "PxQueryFiltering.h"
00042 #include "PxClient.h"
00043 #include "task/PxTask.h"
00044
00045 #if PX_USE_PARTICLE_SYSTEM_API
00046 #include "particles/PxParticleSystem.h"
00047 #include "particles/PxParticleFluid.h"
00048 #endif
00049
00050 #include "pvd/PxPvdSceneClient.h"
00051
00052 #if !PX_DOXYGEN
00053 namespace physx
00054 {
00055 #endif
00056
00057 class PxRigidStatic;
00058 class PxRigidDynamic;
00059 class PxConstraint;
00060 class PxMaterial;
00061 class PxSimulationEventCallback;
00062 class PxPhysics;
00063 class PxBatchQueryDesc;
00064 class PxBatchQuery;
00065 class PxAggregate;
00066 class PxRenderBuffer;
00067 class PxVolumeCache;
00068
00069 class PxSphereGeometry;
00070 class PxBoxGeometry;
00071 class PxCapsuleGeometry;
00072
00073 class PxPruningStructure;
00074 struct PxContactPairHeader;
00075
00076 typedef PxU8 PxDominanceGroup;
00077
00078 class PxPvdSceneClient;
00079
00086 struct PX_DEPRECATED PxActiveTransform
00087 {
00088 PxActor* actor;
00089 void* userData;
00090 PxTransform actor2World;
00091 };
00092
00101 struct PxDominanceGroupPair
00102 {
00103 PxDominanceGroupPair(PxU8 a, PxU8 b)
00104 : dominance0(a), dominance1(b) {}
00105 PxU8 dominance0;
00106 PxU8 dominance1;
00107 };
00108
00109
00117 struct PxActorTypeFlag
00118 {
00119 enum Enum
00120 {
00125 eRIGID_STATIC = (1 << 0),
00126
00131 eRIGID_DYNAMIC = (1 << 1),
00132
00133 #if PX_USE_PARTICLE_SYSTEM_API
00134
00139 ePARTICLE_SYSTEM PX_DEPRECATED = (1 << 2),
00140
00146 ePARTICLE_FLUID PX_DEPRECATED = (1 << 3),
00147 #endif
00148
00149 #if PX_USE_CLOTH_API
00150
00154 eCLOTH = (1 << 5)
00155 #endif
00156 };
00157 };
00158
00164 typedef PxFlags<PxActorTypeFlag::Enum,PxU16> PxActorTypeFlags;
00165 PX_FLAGS_OPERATORS(PxActorTypeFlag::Enum,PxU16)
00166
00167
00185 struct PxQueryCache
00186 {
00190 PX_INLINE PxQueryCache() : shape(NULL), actor(NULL), faceIndex(0xffffffff) {}
00191
00195 PX_INLINE PxQueryCache(PxShape* s, PxU32 findex) : shape(s), actor(NULL), faceIndex(findex) {}
00196
00197 PxShape* shape;
00198 PxRigidActor* actor;
00199 PxU32 faceIndex;
00200 };
00201
00211 class PxScene
00212 {
00213 protected:
00214
00215
00216
00220
00221 PxScene(): userData(0) {}
00222 virtual ~PxScene() {}
00223
00224 public:
00225
00237 virtual void release() = 0;
00238
00246 virtual void setFlag(PxSceneFlag::Enum flag, bool value) = 0;
00247
00255 virtual PxSceneFlags getFlags() const = 0;
00256
00257
00268 virtual void setLimits(const PxSceneLimits& limits) = 0;
00269
00275 virtual PxSceneLimits getLimits() const = 0;
00276
00277
00285 virtual PxPhysics& getPhysics() = 0;
00286
00292 virtual PxU32 getTimestamp() const = 0;
00293
00294
00296
00297
00310 virtual void addArticulation(PxArticulation& articulation) = 0;
00311
00324 virtual void removeArticulation(PxArticulation& articulation, bool wakeOnLostTouch = true) = 0;
00325
00341 virtual void addActor(PxActor& actor) = 0;
00342
00361 virtual void addActors(PxActor*const* actors, PxU32 nbActors) = 0;
00362
00381 virtual void addActors(const PxPruningStructure& pruningStructure) = 0;
00382
00399 virtual void removeActor(PxActor& actor, bool wakeOnLostTouch = true) = 0;
00400
00416 virtual void removeActors(PxActor*const* actors, PxU32 nbActors, bool wakeOnLostTouch = true) = 0;
00417
00430 virtual void addAggregate(PxAggregate& aggregate) = 0;
00431
00444 virtual void removeAggregate(PxAggregate& aggregate, bool wakeOnLostTouch = true) = 0;
00445
00458 virtual void addCollection(const PxCollection& collection) = 0;
00460
00461
00465
00474 virtual PxU32 getNbActors(PxActorTypeFlags types) const = 0;
00475
00487 virtual PxU32 getActors(PxActorTypeFlags types, PxActor** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00488
00505 PX_DEPRECATED virtual const PxActiveTransform*
00506 getActiveTransforms(PxU32& nbTransformsOut, PxClientID client = PX_DEFAULT_CLIENT) = 0;
00507
00508
00527 virtual PxActor** getActiveActors(PxU32& nbActorsOut, PX_DEPRECATED PxClientID client = PX_DEFAULT_CLIENT) = 0;
00528
00536 virtual PxU32 getNbArticulations() const = 0;
00537
00548 virtual PxU32 getArticulations(PxArticulation** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00549
00557 virtual PxU32 getNbConstraints() const = 0;
00558
00569 virtual PxU32 getConstraints(PxConstraint** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00570
00571
00579 virtual PxU32 getNbAggregates() const = 0;
00580
00591 virtual PxU32 getAggregates(PxAggregate** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
00592
00594
00595
00599
00650 virtual void setDominanceGroupPair(
00651 PxDominanceGroup group1, PxDominanceGroup group2, const PxDominanceGroupPair& dominance) = 0;
00652
00658 virtual PxDominanceGroupPair getDominanceGroupPair(PxDominanceGroup group1, PxDominanceGroup group2) const = 0;
00659
00661
00662
00666
00672 virtual PxCpuDispatcher* getCpuDispatcher() const = 0;
00673
00681 virtual PxGpuDispatcher* getGpuDispatcher() const = 0;
00682
00684
00697 virtual PxClientID createClient() = 0;
00698
00715 PX_DEPRECATED virtual void setClientBehaviorFlags(PxClientID client, PxClientBehaviorFlags clientBehaviorFlags) = 0;
00716
00724 PX_DEPRECATED virtual PxClientBehaviorFlags getClientBehaviorFlags(PxClientID client) const = 0;
00726
00727
00728 #if PX_USE_CLOTH_API
00729
00730
00731
00747 virtual void setClothInterCollisionDistance(PxF32 distance) = 0;
00748
00753 virtual PxF32 getClothInterCollisionDistance() const = 0;
00754
00763 virtual void setClothInterCollisionStiffness(PxF32 stiffness) = 0;
00768 virtual PxF32 getClothInterCollisionStiffness() const = 0;
00769
00778 virtual void setClothInterCollisionNbIterations(PxU32 nbIterations) = 0;
00783 virtual PxU32 getClothInterCollisionNbIterations() const = 0;
00785
00786 #endif // PX_USE_CLOTH_API
00787
00788
00789
00793
00810 virtual void setSimulationEventCallback(PxSimulationEventCallback* callback, PX_DEPRECATED PxClientID client = PX_DEFAULT_CLIENT) = 0;
00811
00822 virtual PxSimulationEventCallback*
00823 getSimulationEventCallback(PX_DEPRECATED PxClientID client = PX_DEFAULT_CLIENT) const = 0;
00824
00832 virtual void setContactModifyCallback(PxContactModifyCallback* callback) = 0;
00833
00841 virtual void setCCDContactModifyCallback(PxCCDContactModifyCallback* callback) = 0;
00842
00850 virtual PxContactModifyCallback*
00851 getContactModifyCallback() const = 0;
00852
00860 virtual PxCCDContactModifyCallback*
00861 getCCDContactModifyCallback() const = 0;
00862
00879 virtual void setBroadPhaseCallback(PxBroadPhaseCallback* callback, PX_DEPRECATED PxClientID client = PX_DEFAULT_CLIENT) = 0;
00880
00892 virtual PxBroadPhaseCallback* getBroadPhaseCallback(PX_DEPRECATED PxClientID client = PX_DEFAULT_CLIENT) const = 0;
00893
00895
00896
00900
00917 virtual void setFilterShaderData(const void* data, PxU32 dataSize) = 0;
00918
00928 virtual const void* getFilterShaderData() const = 0;
00929
00937 virtual PxU32 getFilterShaderDataSize() const = 0;
00938
00946 virtual PxSimulationFilterShader
00947 getFilterShader() const = 0;
00948
00956 virtual PxSimulationFilterCallback*
00957 getFilterCallback() const = 0;
00958
00988 virtual void resetFiltering(PxActor& actor) = 0;
00989
01004 virtual void resetFiltering(PxRigidActor& actor, PxShape*const* shapes, PxU32 shapeCount) = 0;
01005
01007
01008
01043 virtual void simulate(PxReal elapsedTime, physx::PxBaseTask* completionTask = NULL,
01044 void* scratchMemBlock = 0, PxU32 scratchMemBlockSize = 0, bool controlSimulation = true) = 0;
01045
01046
01057 virtual void advance(physx::PxBaseTask* completionTask = 0) = 0;
01058
01076 virtual void collide(PxReal elapsedTime, physx::PxBaseTask* completionTask = 0, void* scratchMemBlock = 0,
01077 PxU32 scratchMemBlockSize = 0, bool controlSimulation = true) = 0;
01078
01090 virtual bool checkResults(bool block = false) = 0;
01091
01099 virtual bool fetchCollision(bool block = false) = 0;
01100
01122 virtual bool fetchResults(bool block = false, PxU32* errorState = 0) = 0;
01123
01124
01140 virtual bool fetchResultsStart(const PxContactPairHeader*& contactPairs, PxU32& nbContactPairs, bool block = false) = 0;
01141
01142
01151 virtual void processCallbacks(physx::PxBaseTask* continuation) = 0;
01152
01153
01165 virtual void fetchResultsFinish(PxU32* errorState = 0) = 0;
01166
01167
01178 virtual void flushSimulation(bool sendPendingReports = false) = 0;
01179
01189 virtual void setGravity(const PxVec3& vec) = 0;
01190
01198 virtual PxVec3 getGravity() const = 0;
01199
01205 virtual void setBounceThresholdVelocity(const PxReal t) = 0;
01206
01212 virtual PxReal getBounceThresholdVelocity() const = 0;
01213
01214
01223 virtual void setCCDMaxPasses(PxU32 ccdMaxPasses) = 0;
01224
01233 virtual PxU32 getCCDMaxPasses() const = 0;
01234
01240 virtual PxReal getFrictionOffsetThreshold() const = 0;
01241
01246 virtual void setFrictionType(PxFrictionType::Enum frictionType) = 0;
01247
01252 virtual PxFrictionType::Enum getFrictionType() const = 0;
01253
01255
01256
01271 virtual bool setVisualizationParameter(PxVisualizationParameter::Enum param, PxReal value) = 0;
01272
01281 virtual PxReal getVisualizationParameter(PxVisualizationParameter::Enum paramEnum) const = 0;
01282
01283
01290 virtual void setVisualizationCullingBox(const PxBounds3& box) = 0;
01291
01298 virtual PxBounds3 getVisualizationCullingBox() const = 0;
01299
01311 virtual const PxRenderBuffer& getRenderBuffer() = 0;
01312
01322 virtual void getSimulationStatistics(PxSimulationStatistics& stats) const = 0;
01323
01324
01326
01327
01331
01337 virtual PxPruningStructureType::Enum getStaticStructure() const = 0;
01338
01344 virtual PxPruningStructureType::Enum getDynamicStructure() const = 0;
01345
01361 virtual void flushQueryUpdates() = 0;
01362
01374 PX_DEPRECATED virtual PxBatchQuery* createBatchQuery(const PxBatchQueryDesc& desc) = 0;
01375
01383 PX_DEPRECATED virtual PxVolumeCache* createVolumeCache(PxU32 maxStaticShapes = 32, PxU32 maxDynamicShapes = 8) = 0;
01384
01392 virtual void setDynamicTreeRebuildRateHint(PxU32 dynamicTreeRebuildRateHint) = 0;
01393
01401 virtual PxU32 getDynamicTreeRebuildRateHint() const = 0;
01402
01411 virtual void forceDynamicTreeRebuild(bool rebuildStaticStructure, bool rebuildDynamicStructure) = 0;
01412
01435 virtual bool raycast(
01436 const PxVec3& origin, const PxVec3& unitDir, const PxReal distance,
01437 PxRaycastCallback& hitCall, PxHitFlags hitFlags = PxHitFlags(PxHitFlag::eDEFAULT),
01438 const PxQueryFilterData& filterData = PxQueryFilterData(), PxQueryFilterCallback* filterCall = NULL,
01439 const PxQueryCache* cache = NULL) const = 0;
01440
01468 virtual bool sweep(const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance,
01469 PxSweepCallback& hitCall, PxHitFlags hitFlags = PxHitFlags(PxHitFlag::eDEFAULT),
01470 const PxQueryFilterData& filterData = PxQueryFilterData(), PxQueryFilterCallback* filterCall = NULL,
01471 const PxQueryCache* cache = NULL, const PxReal inflation = 0.f) const = 0;
01472
01473
01493 virtual bool overlap(const PxGeometry& geometry, const PxTransform& pose, PxOverlapCallback& hitCall,
01494 const PxQueryFilterData& filterData = PxQueryFilterData(), PxQueryFilterCallback* filterCall = NULL
01495 ) const = 0;
01496
01497
01504 virtual PxU32 getSceneQueryStaticTimestamp() const = 0;
01506
01507
01511
01517 virtual PxBroadPhaseType::Enum getBroadPhaseType() const = 0;
01518
01525 virtual bool getBroadPhaseCaps(PxBroadPhaseCaps& caps) const = 0;
01526
01532 virtual PxU32 getNbBroadPhaseRegions() const = 0;
01533
01542 virtual PxU32 getBroadPhaseRegions(PxBroadPhaseRegionInfo* userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0;
01543
01560 virtual PxU32 addBroadPhaseRegion(const PxBroadPhaseRegion& region, bool populateRegion=false) = 0;
01561
01575 virtual bool removeBroadPhaseRegion(PxU32 handle) = 0;
01576
01578
01579
01580
01584
01590 virtual PxTaskManager* getTaskManager() const = 0;
01591
01592
01611 virtual void lockRead(const char* file=NULL, PxU32 line=0) = 0;
01612
01618 virtual void unlockRead() = 0;
01619
01645 virtual void lockWrite(const char* file=NULL, PxU32 line=0) = 0;
01646
01652 virtual void unlockWrite() = 0;
01653
01654
01668 virtual void setNbContactDataBlocks(PxU32 numBlocks) = 0;
01669
01670
01680 virtual PxU32 getNbContactDataBlocksUsed() const = 0;
01681
01691 virtual PxU32 getMaxNbContactDataBlocksUsed() const = 0;
01692
01693
01699 virtual PxU32 getContactReportStreamBufferSize() const = 0;
01700
01701
01709 virtual void setSolverBatchSize(PxU32 solverBatchSize) = 0;
01710
01718 virtual PxU32 getSolverBatchSize() const = 0;
01719
01720
01722
01730 virtual PxReal getWakeCounterResetValue() const = 0;
01731
01748 virtual void shiftOrigin(const PxVec3& shift) = 0;
01749
01754 virtual PxPvdSceneClient* getScenePvdClient() = 0;
01755
01756 void* userData;
01757 };
01758
01759 #if !PX_DOXYGEN
01760 }
01761 #endif
01762
01764 #endif