PhysX SDK 3.2 API Reference: PxContactModifyCallback.h Source File

PhysX SDK 3.2 API

PxContactModifyCallback.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_CONTACT_MODIFY_CALLBACK
00032 #define PX_CONTACT_MODIFY_CALLBACK
00033 
00037 #include "PxPhysX.h"
00038 #include "PxShape.h"
00039 #include "PxContact.h"
00040 #include "foundation/PxTransform.h"
00041 
00042 #ifndef PX_DOXYGEN
00043 namespace physx
00044 {
00045 #endif
00046 
00047 class PxShape;
00048 
00053 struct PxContactPointAux
00054 {
00059     PxVec3  targetVelocity;
00060 
00065     PxReal  maxImpulse;
00066 };
00067 
00080 class PxContactSet
00081 {
00082 public:
00083     PX_FORCE_INLINE     const PxVec3& getPoint(PxU32 i) const           { return mContacts[i].point;        }
00084     PX_FORCE_INLINE     void setPoint(PxU32 i, const PxVec3& p)         { mContacts[i].point = p; }
00085 
00086     PX_FORCE_INLINE     const PxVec3& getNormal(PxU32 i) const          { return mContacts[i].normal;   }
00087     PX_FORCE_INLINE     void setNormal(PxU32 i, const PxVec3& n)        { mContacts[i].normal = n;}
00088 
00089     PX_FORCE_INLINE     PxReal getSeparation(PxU32 i) const             { return mContacts[i].separation;   }
00090     PX_FORCE_INLINE     void setSeparation(PxU32 i, PxReal s)           { mContacts[i].separation = s; }
00091 
00092     PX_FORCE_INLINE     const PxVec3& getTargetVelocity(PxU32 i) const  { return mAux[i].targetVelocity;    }
00093     PX_FORCE_INLINE     void setTargetVelocity(PxU32 i, const PxVec3& v){ mAux[i].targetVelocity = v;}
00094 
00095     PX_FORCE_INLINE     PxU32 getInternalFaceIndex0(PxU32 i)            { return mContacts[i].internalFaceIndex0; }
00096     PX_FORCE_INLINE     PxU32 getInternalFaceIndex1(PxU32 i)            { return mContacts[i].internalFaceIndex1; }
00097 
00098 
00099     // maxImpulse must be nonnegative. Set to zero to ignore this contact
00100 
00101     PX_FORCE_INLINE     PxReal getMaxImpulse(PxU32 i) const             { return mAux[i].maxImpulse;    }
00102     PX_FORCE_INLINE     void setMaxImpulse(PxU32 i, PxReal s)           { mAux[i].maxImpulse = s; }
00103 
00104     PX_FORCE_INLINE     void ignore(PxU32 i)                            { mAux[i].maxImpulse = 0; }
00105     PX_FORCE_INLINE     PxU32 size() const                              { return mCount; }
00106 
00107 protected:
00108     PxU32                   mCount;
00109     PxContactPoint*         mContacts;
00110     PxContactPointAux*      mAux;
00111 };
00112 
00113 
00114 
00121 class PxContactModifyPair
00122 {
00123 public:
00130     const PxShape*          shape[2];
00131 
00140     PxTransform             transform[2];
00141 
00146     PxContactSet            contacts;
00147 };
00148 
00149 
00168 class PxContactModifyCallback
00169 {
00170 public:
00171 
00182     virtual void onContactModify(PxContactModifyPair* const pairs, PxU32 count) = 0;
00183 
00184 protected:
00185     virtual ~PxContactModifyCallback(){}
00186 };
00187 
00188 #ifndef PX_DOXYGEN
00189 } // namespace physx
00190 #endif
00191 
00193 #endif


Copyright © 2008-2012 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com