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-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_JOINTCONSTRAINT_H
00032 #define PX_JOINTCONSTRAINT_H
00033 
00037 #include "foundation/PxTransform.h"
00038 #include "PxRigidActor.h"
00039 #include "PxConstraint.h"
00040 #include "common/PxBase.h"
00041 
00042 #if !PX_DOXYGEN
00043 namespace physx
00044 {
00045 #endif
00046 
00047 class PxRigidActor;
00048 class PxScene;
00049 class PxPhysics;
00050 class PxConstraint;
00051 
00057 struct PxJointConcreteType
00058 {
00059     enum Enum
00060     {
00061         eSPHERICAL = PxConcreteType::eFIRST_PHYSX_EXTENSION,
00062         eREVOLUTE,
00063         ePRISMATIC,
00064         eFIXED,
00065         eDISTANCE,
00066         eD6,
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(PxFixedJoint,        PxJointConcreteType::eFIXED)
00075 PX_DEFINE_TYPEINFO(PxPrismaticJoint,    PxJointConcreteType::ePRISMATIC)
00076 PX_DEFINE_TYPEINFO(PxRevoluteJoint,     PxJointConcreteType::eREVOLUTE)
00077 PX_DEFINE_TYPEINFO(PxSphericalJoint,    PxJointConcreteType::eSPHERICAL)
00078 
00085 struct PxJointActorIndex
00086 {
00087     enum Enum
00088     {
00089         eACTOR0,
00090         eACTOR1,
00091         COUNT
00092     };
00093 };
00094 
00099 class PxJoint : public PxBase
00100 {
00101 //= ATTENTION! =====================================================================================
00102 // Changing the data layout of this class breaks the binary serialization format.  See comments for 
00103 // PX_BINARY_SERIAL_VERSION.  If a modification is required, please adjust the getBinaryMetaData 
00104 // function.  If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
00105 // accordingly.
00106 //==================================================================================================
00107 public:
00108 
00120     virtual void                setActors(PxRigidActor* actor0, PxRigidActor* actor1)           = 0;
00121 
00131     virtual void                getActors(PxRigidActor*& actor0, PxRigidActor*& actor1) const   = 0;
00132 
00144     virtual void                setLocalPose(PxJointActorIndex::Enum actor, const PxTransform& localPose) = 0;
00145 
00156     virtual PxTransform         getLocalPose(PxJointActorIndex::Enum actor) const = 0;
00157 
00158 
00166     virtual PxTransform         getRelativeTransform()              const   = 0;
00167 
00175     virtual PxVec3              getRelativeLinearVelocity()         const   = 0;
00176 
00183     virtual PxVec3              getRelativeAngularVelocity()        const   = 0;
00184 
00185 
00198     virtual void                setBreakForce(PxReal force, PxReal torque)                      = 0;
00199 
00208     virtual void                getBreakForce(PxReal& force, PxReal& torque)            const   = 0;
00209 
00217     virtual void                setConstraintFlags(PxConstraintFlags flags)                     = 0;
00218 
00227     virtual void                setConstraintFlag(PxConstraintFlag::Enum flag, bool value)      = 0;
00228 
00229 
00237     virtual PxConstraintFlags   getConstraintFlags()                                    const   = 0;
00238 
00239 
00240 
00248     virtual void                setInvMassScale0(PxReal invMassScale)                           = 0;
00249 
00258     virtual PxReal              getInvMassScale0() const                                        = 0;
00259 
00268     virtual void                setInvInertiaScale0(PxReal invInertiaScale)                     = 0;
00269 
00277     virtual PxReal              getInvInertiaScale0() const                                     = 0;
00278 
00279 
00287     virtual void                setInvMassScale1(PxReal invMassScale)                           = 0;
00288 
00297     virtual PxReal              getInvMassScale1() const                                        = 0;
00298 
00307     virtual void                setInvInertiaScale1(PxReal invInertiaScale)                     = 0;
00308 
00316     virtual PxReal              getInvInertiaScale1() const                                     = 0;
00317 
00318 
00327     virtual PxConstraint*       getConstraint()                                         const   = 0;
00328 
00340     virtual void                setName(const char* name)                                       = 0;
00341 
00350     virtual const char*         getName()                                               const   = 0;
00351 
00358     virtual void                release()                                                       = 0;
00359 
00360 
00361 
00369     virtual PxScene*            getScene()                                              const   = 0;
00370 
00371     void*                       userData;   
00372 
00373     //serialization
00374 
00378     static  void                getBinaryMetaData(PxOutputStream& stream);
00379 
00380     //~serialization
00381                     
00382 protected:
00383     virtual                     ~PxJoint() {}
00384 
00385     //serialization
00386 
00390     PX_INLINE                   PxJoint(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags), userData(NULL) {}
00391     
00395     PX_INLINE                   PxJoint(PxBaseFlags baseFlags)  : PxBase(baseFlags) {}
00396 
00400     virtual bool                isKindOf(const char* name) const { return !::strcmp("PxJoint", name) || PxBase::isKindOf(name); }
00401 
00402     //~serialization
00403 };
00404 
00405 class PxSpring
00406 {
00407 //= ATTENTION! =====================================================================================
00408 // Changing the data layout of this class breaks the binary serialization format.  See comments for 
00409 // PX_BINARY_SERIAL_VERSION.  If a modification is required, please adjust the getBinaryMetaData 
00410 // function.  If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
00411 // accordingly.
00412 //==================================================================================================
00413 public:
00414 
00415     PxReal                  stiffness;          
00416     PxReal                  damping;            
00417 
00418     PxSpring(PxReal stiffness_, PxReal damping_): stiffness(stiffness_), damping(damping_) {}
00419 };
00420 
00421 
00422 #if !PX_DOXYGEN
00423 } // namespace physx
00424 #endif
00425 
00440 PX_C_EXPORT void PX_CALL_CONV PxSetJointGlobalFrame(physx::PxJoint& joint, const physx::PxVec3* wsAnchor, const physx::PxVec3* wsAxis);
00441 
00443 #endif


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