PxScene.h
Go to the documentation of this file.00001 // This code contains NVIDIA Confidential Information and is disclosed to you 00002 // under a form of NVIDIA software license agreement provided separately to you. 00003 // 00004 // Notice 00005 // NVIDIA Corporation and its licensors retain all intellectual property and 00006 // proprietary rights in and to this software and related documentation and 00007 // any modifications thereto. Any use, reproduction, disclosure, or 00008 // distribution of this software and related documentation without an express 00009 // license agreement from NVIDIA Corporation is strictly prohibited. 00010 // 00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES 00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO 00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, 00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. 00015 // 00016 // Information and code furnished is believed to be accurate and reliable. 00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such 00018 // information or for any infringement of patents or other rights of third parties that may 00019 // result from its use. No license is granted by implication or otherwise under any patent 00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice. 00021 // This code supersedes and replaces all information previously supplied. 00022 // NVIDIA Corporation products are not authorized for use as critical 00023 // components in life support devices or systems without express written approval of 00024 // NVIDIA Corporation. 00025 // 00026 // Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. 00027 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. 00028 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. 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 00155 eCLOTH PX_DEPRECATED = (1 << 5) 00156 #endif 00157 }; 00158 }; 00159 00165 typedef PxFlags<PxActorTypeFlag::Enum,PxU16> PxActorTypeFlags; 00166 PX_FLAGS_OPERATORS(PxActorTypeFlag::Enum,PxU16) 00167 00168 00186 struct PxQueryCache 00187 { 00191 PX_INLINE PxQueryCache() : shape(NULL), actor(NULL), faceIndex(0xffffffff) {} 00192 00196 PX_INLINE PxQueryCache(PxShape* s, PxU32 findex) : shape(s), actor(NULL), faceIndex(findex) {} 00197 00198 PxShape* shape; 00199 PxRigidActor* actor; 00200 PxU32 faceIndex; 00201 }; 00202 00212 class PxScene 00213 { 00214 protected: 00215 00216 /************************************************************************************************/ 00217 00221 00222 PxScene(): userData(0) {} 00223 virtual ~PxScene() {} 00224 00225 public: 00226 00238 virtual void release() = 0; 00239 00247 virtual void setFlag(PxSceneFlag::Enum flag, bool value) = 0; 00248 00256 virtual PxSceneFlags getFlags() const = 0; 00257 00258 00269 virtual void setLimits(const PxSceneLimits& limits) = 0; 00270 00276 virtual PxSceneLimits getLimits() const = 0; 00277 00278 00286 virtual PxPhysics& getPhysics() = 0; 00287 00293 virtual PxU32 getTimestamp() const = 0; 00294 00295 00297 /************************************************************************************************/ 00298 00311 virtual void addArticulation(PxArticulation& articulation) = 0; 00312 00325 virtual void removeArticulation(PxArticulation& articulation, bool wakeOnLostTouch = true) = 0; 00326 00342 virtual void addActor(PxActor& actor) = 0; 00343 00362 virtual void addActors(PxActor*const* actors, PxU32 nbActors) = 0; 00363 00382 virtual void addActors(const PxPruningStructure& pruningStructure) = 0; 00383 00400 virtual void removeActor(PxActor& actor, bool wakeOnLostTouch = true) = 0; 00401 00417 virtual void removeActors(PxActor*const* actors, PxU32 nbActors, bool wakeOnLostTouch = true) = 0; 00418 00431 virtual void addAggregate(PxAggregate& aggregate) = 0; 00432 00445 virtual void removeAggregate(PxAggregate& aggregate, bool wakeOnLostTouch = true) = 0; 00446 00459 virtual void addCollection(const PxCollection& collection) = 0; 00461 /************************************************************************************************/ 00462 00466 00475 virtual PxU32 getNbActors(PxActorTypeFlags types) const = 0; 00476 00488 virtual PxU32 getActors(PxActorTypeFlags types, PxActor** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; 00489 00506 PX_DEPRECATED virtual const PxActiveTransform* 00507 getActiveTransforms(PxU32& nbTransformsOut, PxClientID client = PX_DEFAULT_CLIENT) = 0; 00508 00509 00528 virtual PxActor** getActiveActors(PxU32& nbActorsOut, PX_DEPRECATED PxClientID client = PX_DEFAULT_CLIENT) = 0; 00529 00537 virtual PxU32 getNbArticulations() const = 0; 00538 00549 virtual PxU32 getArticulations(PxArticulation** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; 00550 00558 virtual PxU32 getNbConstraints() const = 0; 00559 00570 virtual PxU32 getConstraints(PxConstraint** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; 00571 00572 00580 virtual PxU32 getNbAggregates() const = 0; 00581 00592 virtual PxU32 getAggregates(PxAggregate** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; 00593 00595 /************************************************************************************************/ 00596 00600 00651 virtual void setDominanceGroupPair( 00652 PxDominanceGroup group1, PxDominanceGroup group2, const PxDominanceGroupPair& dominance) = 0; 00653 00659 virtual PxDominanceGroupPair getDominanceGroupPair(PxDominanceGroup group1, PxDominanceGroup group2) const = 0; 00660 00662 /************************************************************************************************/ 00663 00667 00673 virtual PxCpuDispatcher* getCpuDispatcher() const = 0; 00674 00682 virtual PxGpuDispatcher* getGpuDispatcher() const = 0; 00683 00685 /************************************************************************************************/ 00698 virtual PxClientID createClient() = 0; 00699 00716 PX_DEPRECATED virtual void setClientBehaviorFlags(PxClientID client, PxClientBehaviorFlags clientBehaviorFlags) = 0; 00717 00725 PX_DEPRECATED virtual PxClientBehaviorFlags getClientBehaviorFlags(PxClientID client) const = 0; 00727 00728 00729 #if PX_USE_CLOTH_API 00730 00731 /************************************************************************************************/ 00732 00750 PX_DEPRECATED virtual void setClothInterCollisionDistance(PxF32 distance) = 0; 00751 00757 PX_DEPRECATED virtual PxF32 getClothInterCollisionDistance() const = 0; 00758 00768 PX_DEPRECATED virtual void setClothInterCollisionStiffness(PxF32 stiffness) = 0; 00774 PX_DEPRECATED virtual PxF32 getClothInterCollisionStiffness() const = 0; 00775 00785 PX_DEPRECATED virtual void setClothInterCollisionNbIterations(PxU32 nbIterations) = 0; 00791 PX_DEPRECATED virtual PxU32 getClothInterCollisionNbIterations() const = 0; 00793 00794 #endif // PX_USE_CLOTH_API 00795 00796 /************************************************************************************************/ 00797 00801 00818 virtual void setSimulationEventCallback(PxSimulationEventCallback* callback, PX_DEPRECATED PxClientID client = PX_DEFAULT_CLIENT) = 0; 00819 00830 virtual PxSimulationEventCallback* 00831 getSimulationEventCallback(PX_DEPRECATED PxClientID client = PX_DEFAULT_CLIENT) const = 0; 00832 00840 virtual void setContactModifyCallback(PxContactModifyCallback* callback) = 0; 00841 00849 virtual void setCCDContactModifyCallback(PxCCDContactModifyCallback* callback) = 0; 00850 00858 virtual PxContactModifyCallback* 00859 getContactModifyCallback() const = 0; 00860 00868 virtual PxCCDContactModifyCallback* 00869 getCCDContactModifyCallback() const = 0; 00870 00887 virtual void setBroadPhaseCallback(PxBroadPhaseCallback* callback, PX_DEPRECATED PxClientID client = PX_DEFAULT_CLIENT) = 0; 00888 00900 virtual PxBroadPhaseCallback* getBroadPhaseCallback(PX_DEPRECATED PxClientID client = PX_DEFAULT_CLIENT) const = 0; 00901 00903 /************************************************************************************************/ 00904 00908 00925 virtual void setFilterShaderData(const void* data, PxU32 dataSize) = 0; 00926 00936 virtual const void* getFilterShaderData() const = 0; 00937 00945 virtual PxU32 getFilterShaderDataSize() const = 0; 00946 00954 virtual PxSimulationFilterShader 00955 getFilterShader() const = 0; 00956 00964 virtual PxSimulationFilterCallback* 00965 getFilterCallback() const = 0; 00966 00996 virtual void resetFiltering(PxActor& actor) = 0; 00997 01012 virtual void resetFiltering(PxRigidActor& actor, PxShape*const* shapes, PxU32 shapeCount) = 0; 01013 01015 /************************************************************************************************/ 01016 01051 virtual void simulate(PxReal elapsedTime, physx::PxBaseTask* completionTask = NULL, 01052 void* scratchMemBlock = 0, PxU32 scratchMemBlockSize = 0, bool controlSimulation = true) = 0; 01053 01054 01065 virtual void advance(physx::PxBaseTask* completionTask = 0) = 0; 01066 01084 virtual void collide(PxReal elapsedTime, physx::PxBaseTask* completionTask = 0, void* scratchMemBlock = 0, 01085 PxU32 scratchMemBlockSize = 0, bool controlSimulation = true) = 0; 01086 01098 virtual bool checkResults(bool block = false) = 0; 01099 01107 virtual bool fetchCollision(bool block = false) = 0; 01108 01130 virtual bool fetchResults(bool block = false, PxU32* errorState = 0) = 0; 01131 01132 01148 virtual bool fetchResultsStart(const PxContactPairHeader*& contactPairs, PxU32& nbContactPairs, bool block = false) = 0; 01149 01150 01159 virtual void processCallbacks(physx::PxBaseTask* continuation) = 0; 01160 01161 01173 virtual void fetchResultsFinish(PxU32* errorState = 0) = 0; 01174 01175 01186 virtual void flushSimulation(bool sendPendingReports = false) = 0; 01187 01197 virtual void setGravity(const PxVec3& vec) = 0; 01198 01206 virtual PxVec3 getGravity() const = 0; 01207 01213 virtual void setBounceThresholdVelocity(const PxReal t) = 0; 01214 01220 virtual PxReal getBounceThresholdVelocity() const = 0; 01221 01222 01231 virtual void setCCDMaxPasses(PxU32 ccdMaxPasses) = 0; 01232 01241 virtual PxU32 getCCDMaxPasses() const = 0; 01242 01248 virtual PxReal getFrictionOffsetThreshold() const = 0; 01249 01254 virtual void setFrictionType(PxFrictionType::Enum frictionType) = 0; 01255 01260 virtual PxFrictionType::Enum getFrictionType() const = 0; 01261 01263 /************************************************************************************************/ 01264 01279 virtual bool setVisualizationParameter(PxVisualizationParameter::Enum param, PxReal value) = 0; 01280 01289 virtual PxReal getVisualizationParameter(PxVisualizationParameter::Enum paramEnum) const = 0; 01290 01291 01298 virtual void setVisualizationCullingBox(const PxBounds3& box) = 0; 01299 01306 virtual PxBounds3 getVisualizationCullingBox() const = 0; 01307 01319 virtual const PxRenderBuffer& getRenderBuffer() = 0; 01320 01330 virtual void getSimulationStatistics(PxSimulationStatistics& stats) const = 0; 01331 01332 01334 /************************************************************************************************/ 01335 01339 01345 virtual PxPruningStructureType::Enum getStaticStructure() const = 0; 01346 01352 virtual PxPruningStructureType::Enum getDynamicStructure() const = 0; 01353 01369 virtual void flushQueryUpdates() = 0; 01370 01382 PX_DEPRECATED virtual PxBatchQuery* createBatchQuery(const PxBatchQueryDesc& desc) = 0; 01383 01391 PX_DEPRECATED virtual PxVolumeCache* createVolumeCache(PxU32 maxStaticShapes = 32, PxU32 maxDynamicShapes = 8) = 0; 01392 01400 virtual void setDynamicTreeRebuildRateHint(PxU32 dynamicTreeRebuildRateHint) = 0; 01401 01409 virtual PxU32 getDynamicTreeRebuildRateHint() const = 0; 01410 01419 virtual void forceDynamicTreeRebuild(bool rebuildStaticStructure, bool rebuildDynamicStructure) = 0; 01420 01443 virtual bool raycast( 01444 const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, 01445 PxRaycastCallback& hitCall, PxHitFlags hitFlags = PxHitFlags(PxHitFlag::eDEFAULT), 01446 const PxQueryFilterData& filterData = PxQueryFilterData(), PxQueryFilterCallback* filterCall = NULL, 01447 const PxQueryCache* cache = NULL) const = 0; 01448 01476 virtual bool sweep(const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance, 01477 PxSweepCallback& hitCall, PxHitFlags hitFlags = PxHitFlags(PxHitFlag::eDEFAULT), 01478 const PxQueryFilterData& filterData = PxQueryFilterData(), PxQueryFilterCallback* filterCall = NULL, 01479 const PxQueryCache* cache = NULL, const PxReal inflation = 0.f) const = 0; 01480 01481 01501 virtual bool overlap(const PxGeometry& geometry, const PxTransform& pose, PxOverlapCallback& hitCall, 01502 const PxQueryFilterData& filterData = PxQueryFilterData(), PxQueryFilterCallback* filterCall = NULL 01503 ) const = 0; 01504 01505 01512 virtual PxU32 getSceneQueryStaticTimestamp() const = 0; 01514 01515 /************************************************************************************************/ 01519 01525 virtual PxBroadPhaseType::Enum getBroadPhaseType() const = 0; 01526 01533 virtual bool getBroadPhaseCaps(PxBroadPhaseCaps& caps) const = 0; 01534 01540 virtual PxU32 getNbBroadPhaseRegions() const = 0; 01541 01550 virtual PxU32 getBroadPhaseRegions(PxBroadPhaseRegionInfo* userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; 01551 01568 virtual PxU32 addBroadPhaseRegion(const PxBroadPhaseRegion& region, bool populateRegion=false) = 0; 01569 01583 virtual bool removeBroadPhaseRegion(PxU32 handle) = 0; 01584 01586 01587 /************************************************************************************************/ 01588 01592 01598 virtual PxTaskManager* getTaskManager() const = 0; 01599 01600 01619 virtual void lockRead(const char* file=NULL, PxU32 line=0) = 0; 01620 01626 virtual void unlockRead() = 0; 01627 01653 virtual void lockWrite(const char* file=NULL, PxU32 line=0) = 0; 01654 01660 virtual void unlockWrite() = 0; 01661 01662 01676 virtual void setNbContactDataBlocks(PxU32 numBlocks) = 0; 01677 01678 01688 virtual PxU32 getNbContactDataBlocksUsed() const = 0; 01689 01699 virtual PxU32 getMaxNbContactDataBlocksUsed() const = 0; 01700 01701 01707 virtual PxU32 getContactReportStreamBufferSize() const = 0; 01708 01709 01717 virtual void setSolverBatchSize(PxU32 solverBatchSize) = 0; 01718 01726 virtual PxU32 getSolverBatchSize() const = 0; 01727 01728 01730 01738 virtual PxReal getWakeCounterResetValue() const = 0; 01739 01756 virtual void shiftOrigin(const PxVec3& shift) = 0; 01757 01762 virtual PxPvdSceneClient* getScenePvdClient() = 0; 01763 01764 void* userData; 01765 }; 01766 01767 #if !PX_DOXYGEN 01768 } // namespace physx 01769 #endif 01770 01772 #endif
Copyright © 2008-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com