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-2012 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 "PxPhysX.h" 00038 #include "foundation/PxFlags.h" 00039 00040 #ifndef PX_DOXYGEN 00041 namespace physx 00042 { 00043 #endif 00044 00045 class PxActor; 00046 class PxShape; 00047 00048 00054 struct PxPairFlag 00055 { 00056 enum Enum 00057 { 00063 eRESOLVE_CONTACTS = (1<<0), 00064 00072 eMODIFY_CONTACTS = (1<<1), 00073 00086 eNOTIFY_TOUCH_FOUND = (1<<2), 00087 00104 eNOTIFY_TOUCH_PERSISTS = (1<<3), 00105 00120 eNOTIFY_TOUCH_LOST = (1<<4), 00121 00129 eNOTIFY_THRESHOLD_FORCE_FOUND = (1<<5), 00130 00141 eNOTIFY_THRESHOLD_FORCE_PERSISTS = (1<<6), 00142 00153 eNOTIFY_THRESHOLD_FORCE_LOST = (1<<7), 00154 00162 eNOTIFY_CONTACT_POINTS = (1<<8), 00163 00173 eSWEPT_INTEGRATION_LINEAR = (1<<9), 00174 00178 eCONTACT_DEFAULT = eRESOLVE_CONTACTS, 00179 00183 eTRIGGER_DEFAULT = eNOTIFY_TOUCH_FOUND | eNOTIFY_TOUCH_LOST 00184 }; 00185 }; 00186 00192 typedef PxFlags<PxPairFlag::Enum, PxU16> PxPairFlags; 00193 PX_FLAGS_OPERATORS(PxPairFlag::Enum, PxU16); 00194 00195 00196 00202 struct PxFilterFlag 00203 { 00204 enum Enum 00205 { 00217 eKILL = (1<<0), 00218 00230 eSUPPRESS = (1<<1), 00231 00237 eCALLBACK = (1<<2), 00238 00248 eNOTIFY = (1<<3) | eCALLBACK, 00249 00261 eDEFAULT = 0 00262 }; 00263 }; 00264 00270 typedef PxFlags<PxFilterFlag::Enum, PxU16> PxFilterFlags; 00271 PX_FLAGS_OPERATORS(PxFilterFlag::Enum, PxU16); 00272 00273 00279 struct PxFilterData 00280 { 00281 PX_INLINE PxFilterData(const PxEmpty&) 00282 { 00283 } 00284 00288 PX_INLINE PxFilterData() 00289 { 00290 word0 = word1 = word2 = word3 = 0; 00291 } 00292 00296 PX_INLINE PxFilterData(PxU32 w0, PxU32 w1, PxU32 w2, PxU32 w3) : word0(w0), word1(w1), word2(w2), word3(w3) {} 00297 00301 PX_INLINE void setToDefault() 00302 { 00303 *this = PxFilterData(); 00304 } 00305 00306 PxU32 word0; 00307 PxU32 word1; 00308 PxU32 word2; 00309 PxU32 word3; 00310 }; 00311 00312 00318 struct PxFilterObjectType 00319 { 00320 enum Enum 00321 { 00326 eRIGID_STATIC, 00327 00332 eRIGID_DYNAMIC, 00333 00338 ePARTICLE_SYSTEM, 00339 00344 ePARTICLE_FLUID, 00345 00350 eARTICULATION, 00351 00352 //brief internal use only! 00353 eMAX_TYPE_COUNT = 16, 00354 00355 //brief internal use only! 00356 eUNDEFINED = eMAX_TYPE_COUNT-1 00357 }; 00358 }; 00359 00360 00361 // For internal use only 00362 struct PxFilterObjectFlags 00363 { 00364 enum Enum 00365 { 00366 eKINEMATIC = (1<<4), 00367 eTRIGGER = (1<<5) 00368 }; 00369 }; 00370 00371 00377 typedef PxU32 PxFilterObjectAttributes; 00378 00379 00388 PX_INLINE PxFilterObjectType::Enum PxGetFilterObjectType(PxFilterObjectAttributes attr) 00389 { 00390 return static_cast<PxFilterObjectType::Enum>( (attr & (PxFilterObjectType::eMAX_TYPE_COUNT-1)) ); 00391 } 00392 00393 00402 PX_INLINE bool PxFilterObjectIsKinematic(PxFilterObjectAttributes attr) 00403 { 00404 return ((attr & PxFilterObjectFlags::eKINEMATIC) != 0); 00405 } 00406 00407 00416 PX_INLINE bool PxFilterObjectIsTrigger(PxFilterObjectAttributes attr) 00417 { 00418 return ((attr & PxFilterObjectFlags::eTRIGGER) != 0); 00419 } 00420 00421 00475 typedef PxFilterFlags (*PxSimulationFilterShader) 00476 (PxFilterObjectAttributes attributes0, PxFilterData filterData0, 00477 PxFilterObjectAttributes attributes1, PxFilterData filterData1, 00478 PxPairFlags& pairFlags, const void* constantBlock, PxU32 constantBlockSize); 00479 00480 00481 00500 class PxSimulationFilterCallback 00501 { 00502 public: 00503 00527 virtual PxFilterFlags pairFound( PxU32 pairID, 00528 PxFilterObjectAttributes attributes0, PxFilterData filterData0, PxActor* a0, PxShape* s0, 00529 PxFilterObjectAttributes attributes1, PxFilterData filterData1, PxActor* a1, PxShape* s1, 00530 PxPairFlags& pairFlags) = 0; 00531 00547 virtual void pairLost( PxU32 pairID, 00548 PxFilterObjectAttributes attributes0, 00549 PxFilterData filterData0, 00550 PxFilterObjectAttributes attributes1, 00551 PxFilterData filterData1, 00552 bool objectDeleted) = 0; 00553 00576 virtual bool statusChange(PxU32& pairID, PxPairFlags& pairFlags, PxFilterFlags& filterFlags) = 0; 00577 00578 protected: 00579 virtual ~PxSimulationFilterCallback() {} 00580 }; 00581 00582 #ifndef PX_DOXYGEN 00583 } // namespace physx 00584 #endif 00585 00587 #endif
Copyright © 2008-2012 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com