PxFiltering.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_FILTERING 00032 #define PX_PHYSICS_NX_FILTERING 00033 00037 #include "PxPhysXConfig.h" 00038 #include "foundation/PxFlags.h" 00039 00040 #if !PX_DOXYGEN 00041 namespace physx 00042 { 00043 #endif 00044 00045 class PxActor; 00046 class PxShape; 00047 00048 static const PxU32 INVALID_FILTER_PAIR_INDEX = 0xffffffff; 00049 00050 00056 struct PxPairFlag 00057 { 00058 enum Enum 00059 { 00065 eSOLVE_CONTACT = (1<<0), 00066 00074 eMODIFY_CONTACTS = (1<<1), 00075 00090 eNOTIFY_TOUCH_FOUND = (1<<2), 00091 00110 eNOTIFY_TOUCH_PERSISTS = (1<<3), 00111 00128 eNOTIFY_TOUCH_LOST = (1<<4), 00129 00148 eNOTIFY_TOUCH_CCD = (1<<5), 00149 00159 eNOTIFY_THRESHOLD_FORCE_FOUND = (1<<6), 00160 00173 eNOTIFY_THRESHOLD_FORCE_PERSISTS = (1<<7), 00174 00187 eNOTIFY_THRESHOLD_FORCE_LOST = (1<<8), 00188 00198 eNOTIFY_CONTACT_POINTS = (1<<9), 00199 00206 eDETECT_DISCRETE_CONTACT = (1<<10), 00207 00208 00222 eDETECT_CCD_CONTACT = (1<<11), 00223 00236 ePRE_SOLVER_VELOCITY = (1<<12), 00237 00246 ePOST_SOLVER_VELOCITY = (1<<13), 00247 00262 eCONTACT_EVENT_POSE = (1<<14), 00263 00264 eNEXT_FREE = (1<<15), 00265 00269 eCONTACT_DEFAULT = eSOLVE_CONTACT | eDETECT_DISCRETE_CONTACT, 00270 00274 eTRIGGER_DEFAULT = eNOTIFY_TOUCH_FOUND | eNOTIFY_TOUCH_LOST | eDETECT_DISCRETE_CONTACT 00275 }; 00276 }; 00277 00283 typedef PxFlags<PxPairFlag::Enum, PxU16> PxPairFlags; 00284 PX_FLAGS_OPERATORS(PxPairFlag::Enum, PxU16) 00285 00286 00287 00288 00293 struct PxFilterFlag 00294 { 00295 enum Enum 00296 { 00308 eKILL = (1<<0), 00309 00323 eSUPPRESS = (1<<1), 00324 00330 eCALLBACK = (1<<2), 00331 00341 eNOTIFY = (1<<3) | eCALLBACK, 00342 00354 eDEFAULT = 0 00355 }; 00356 }; 00357 00363 typedef PxFlags<PxFilterFlag::Enum, PxU16> PxFilterFlags; 00364 PX_FLAGS_OPERATORS(PxFilterFlag::Enum, PxU16) 00365 00366 00367 00372 struct PxFilterData 00373 { 00374 //= ATTENTION! ===================================================================================== 00375 // Changing the data layout of this class breaks the binary serialization format. See comments for 00376 // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData 00377 // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION 00378 // accordingly. 00379 //================================================================================================== 00380 00381 PX_INLINE PxFilterData(const PxEMPTY) 00382 { 00383 } 00384 00388 PX_INLINE PxFilterData() 00389 { 00390 word0 = word1 = word2 = word3 = 0; 00391 } 00392 00396 PX_INLINE PxFilterData(PxU32 w0, PxU32 w1, PxU32 w2, PxU32 w3) : word0(w0), word1(w1), word2(w2), word3(w3) {} 00397 00401 PX_INLINE void setToDefault() 00402 { 00403 *this = PxFilterData(); 00404 } 00405 00409 PX_INLINE bool operator == (const PxFilterData& a) const 00410 { 00411 return a.word0 == word0 && a.word1 == word1 && a.word2 == word2 && a.word3 == word3; 00412 } 00413 00417 PX_INLINE bool operator != (const PxFilterData& a) const 00418 { 00419 return !(a == *this); 00420 } 00421 00422 PxU32 word0; 00423 PxU32 word1; 00424 PxU32 word2; 00425 PxU32 word3; 00426 }; 00427 00428 00434 struct PxFilterObjectType 00435 { 00436 enum Enum 00437 { 00442 eRIGID_STATIC, 00443 00448 eRIGID_DYNAMIC, 00449 00455 ePARTICLE_SYSTEM PX_DEPRECATED, 00456 00462 ePARTICLE_FLUID PX_DEPRECATED, 00463 00468 eARTICULATION, 00469 00474 eCLOTH, 00475 00476 //brief internal use only! 00477 eMAX_TYPE_COUNT = 16, 00478 00479 //brief internal use only! 00480 eUNDEFINED = eMAX_TYPE_COUNT-1 00481 }; 00482 }; 00483 00484 00485 // For internal use only 00486 struct PxFilterObjectFlag 00487 { 00488 enum Enum 00489 { 00490 eKINEMATIC = (1<<4), 00491 eTRIGGER = (1<<5) 00492 }; 00493 }; 00494 00495 00501 typedef PxU32 PxFilterObjectAttributes; 00502 00503 00512 PX_INLINE PxFilterObjectType::Enum PxGetFilterObjectType(PxFilterObjectAttributes attr) 00513 { 00514 return static_cast<PxFilterObjectType::Enum>( (attr & (PxFilterObjectType::eMAX_TYPE_COUNT-1)) ); 00515 } 00516 00517 00526 PX_INLINE bool PxFilterObjectIsKinematic(PxFilterObjectAttributes attr) 00527 { 00528 return ((attr & PxFilterObjectFlag::eKINEMATIC) != 0); 00529 } 00530 00531 00540 PX_INLINE bool PxFilterObjectIsTrigger(PxFilterObjectAttributes attr) 00541 { 00542 return ((attr & PxFilterObjectFlag::eTRIGGER) != 0); 00543 } 00544 00545 00600 typedef PxFilterFlags (*PxSimulationFilterShader) 00601 (PxFilterObjectAttributes attributes0, PxFilterData filterData0, 00602 PxFilterObjectAttributes attributes1, PxFilterData filterData1, 00603 PxPairFlags& pairFlags, const void* constantBlock, PxU32 constantBlockSize); 00604 00605 00606 00629 class PxSimulationFilterCallback 00630 { 00631 public: 00632 00656 virtual PxFilterFlags pairFound( PxU32 pairID, 00657 PxFilterObjectAttributes attributes0, PxFilterData filterData0, const PxActor* a0, const PxShape* s0, 00658 PxFilterObjectAttributes attributes1, PxFilterData filterData1, const PxActor* a1, const PxShape* s1, 00659 PxPairFlags& pairFlags) = 0; 00660 00676 virtual void pairLost( PxU32 pairID, 00677 PxFilterObjectAttributes attributes0, 00678 PxFilterData filterData0, 00679 PxFilterObjectAttributes attributes1, 00680 PxFilterData filterData1, 00681 bool objectRemoved) = 0; 00682 00705 virtual bool statusChange(PxU32& pairID, PxPairFlags& pairFlags, PxFilterFlags& filterFlags) = 0; 00706 00707 protected: 00708 virtual ~PxSimulationFilterCallback() {} 00709 }; 00710 00711 00712 struct PxFilterInfo 00713 { 00714 PX_FORCE_INLINE PxFilterInfo() : filterFlags(0), pairFlags(0), filterPairIndex(INVALID_FILTER_PAIR_INDEX) {} 00715 PX_FORCE_INLINE PxFilterInfo(PxFilterFlags filterFlags_) : filterFlags(filterFlags_), pairFlags(0), filterPairIndex(INVALID_FILTER_PAIR_INDEX) {} 00716 00717 PxFilterFlags filterFlags; 00718 PxPairFlags pairFlags; 00719 PxU32 filterPairIndex; 00720 }; 00721 00722 #if !PX_DOXYGEN 00723 } // namespace physx 00724 #endif 00725 00727 #endif
Copyright © 2008-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com