PxJoint.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-2018 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 #ifndef PX_JOINTCONSTRAINT_H
00031 #define PX_JOINTCONSTRAINT_H
00032 
00036 #include "foundation/PxTransform.h"
00037 #include "PxRigidActor.h"
00038 #include "PxConstraint.h"
00039 #include "common/PxBase.h"
00040 
00041 #if !PX_DOXYGEN
00042 namespace physx
00043 {
00044 #endif
00045 
00046 class PxRigidActor;
00047 class PxScene;
00048 class PxPhysics;
00049 class PxConstraint;
00050 
00056 struct PxJointConcreteType
00057 {
00058     enum Enum
00059     {
00060         eSPHERICAL = PxConcreteType::eFIRST_PHYSX_EXTENSION,
00061         eREVOLUTE,
00062         ePRISMATIC,
00063         eFIXED,
00064         eDISTANCE,
00065         eD6,
00066         eCONTACT,
00067         eLast
00068     };
00069 };
00070 
00071 PX_DEFINE_TYPEINFO(PxJoint,             PxConcreteType::eUNDEFINED)
00072 PX_DEFINE_TYPEINFO(PxD6Joint,           PxJointConcreteType::eD6)
00073 PX_DEFINE_TYPEINFO(PxDistanceJoint,     PxJointConcreteType::eDISTANCE)
00074 PX_DEFINE_TYPEINFO(PxContactJoint,      PxJointConcreteType::eCONTACT)
00075 PX_DEFINE_TYPEINFO(PxFixedJoint,        PxJointConcreteType::eFIXED)
00076 PX_DEFINE_TYPEINFO(PxPrismaticJoint,    PxJointConcreteType::ePRISMATIC)
00077 PX_DEFINE_TYPEINFO(PxRevoluteJoint,     PxJointConcreteType::eREVOLUTE)
00078 PX_DEFINE_TYPEINFO(PxSphericalJoint,    PxJointConcreteType::eSPHERICAL)
00079 
00080 
00087 struct PxJointActorIndex
00088 {
00089     enum Enum
00090     {
00091         eACTOR0,
00092         eACTOR1,
00093         COUNT
00094     };
00095 };
00096 
00101 class PxJoint : public PxBase
00102 {
00103 //= ATTENTION! =====================================================================================
00104 // Changing the data layout of this class breaks the binary serialization format.  See comments for 
00105 // PX_BINARY_SERIAL_VERSION.  If a modification is required, please adjust the getBinaryMetaData 
00106 // function.  If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
00107 // accordingly.
00108 //==================================================================================================
00109 public:
00110 
00121     virtual void                setActors(PxRigidActor* actor0, PxRigidActor* actor1)   = 0;
00122 
00131     virtual void                getActors(PxRigidActor*& actor0, PxRigidActor*& actor1) const   = 0;
00132 
00143     virtual void                setLocalPose(PxJointActorIndex::Enum actor, const PxTransform& localPose) = 0;
00144 
00154     virtual PxTransform         getLocalPose(PxJointActorIndex::Enum actor) const = 0;
00155 
00162     virtual PxTransform         getRelativeTransform()  const   = 0;
00163 
00170     virtual PxVec3              getRelativeLinearVelocity() const   = 0;
00171 
00177     virtual PxVec3              getRelativeAngularVelocity()    const   = 0;
00178 
00189     virtual void                setBreakForce(PxReal force, PxReal torque)  = 0;
00190 
00199     virtual void                getBreakForce(PxReal& force, PxReal& torque)    const   = 0;
00200 
00208     virtual void                setConstraintFlags(PxConstraintFlags flags) = 0;
00209 
00218     virtual void                setConstraintFlag(PxConstraintFlag::Enum flag, bool value)  = 0;
00219 
00227     virtual PxConstraintFlags   getConstraintFlags()    const   = 0;
00228 
00236     virtual void                setInvMassScale0(PxReal invMassScale)   = 0;
00237 
00245     virtual PxReal              getInvMassScale0()  const   = 0;
00246 
00254     virtual void                setInvInertiaScale0(PxReal invInertiaScale) = 0;
00255 
00263     virtual PxReal              getInvInertiaScale0()   const   = 0;
00264 
00272     virtual void                setInvMassScale1(PxReal invMassScale)   = 0;
00273 
00281     virtual PxReal              getInvMassScale1()  const   = 0;
00282 
00290     virtual void                setInvInertiaScale1(PxReal invInertiaScale) = 0;
00291 
00299     virtual PxReal              getInvInertiaScale1()   const   = 0;
00300 
00308     virtual PxConstraint*       getConstraint() const   = 0;
00309 
00320     virtual void                setName(const char* name)   = 0;
00321 
00329     virtual const char*         getName()   const   = 0;
00330 
00336     virtual void                release()   = 0;
00337 
00345     virtual PxScene*            getScene()  const   = 0;
00346 
00347     void*                       userData;   
00348 
00349     //serialization
00350 
00354     static  void                getBinaryMetaData(PxOutputStream& stream);
00355 
00356     //~serialization
00357                     
00358 protected:
00359     virtual                     ~PxJoint() {}
00360 
00361     //serialization
00362 
00366     PX_INLINE                   PxJoint(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags), userData(NULL) {}
00367     
00371     PX_INLINE                   PxJoint(PxBaseFlags baseFlags)  : PxBase(baseFlags) {}
00372 
00376     virtual bool                isKindOf(const char* name) const { return !::strcmp("PxJoint", name) || PxBase::isKindOf(name); }
00377 
00378     //~serialization
00379 };
00380 
00381 class PxSpring
00382 {
00383 //= ATTENTION! =====================================================================================
00384 // Changing the data layout of this class breaks the binary serialization format.  See comments for 
00385 // PX_BINARY_SERIAL_VERSION.  If a modification is required, please adjust the getBinaryMetaData 
00386 // function.  If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
00387 // accordingly.
00388 //==================================================================================================
00389 public:
00390 
00391     PxReal  stiffness;  
00392     PxReal  damping;    
00393 
00394     PxSpring(PxReal stiffness_, PxReal damping_): stiffness(stiffness_), damping(damping_) {}
00395 };
00396 
00397 
00398 #if !PX_DOXYGEN
00399 } // namespace physx
00400 #endif
00401 
00416 PX_C_EXPORT void PX_CALL_CONV PxSetJointGlobalFrame(physx::PxJoint& joint, const physx::PxVec3* wsAnchor, const physx::PxVec3* wsAxis);
00417 
00419 #endif


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