PxVehicleDriveTank.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 #ifndef PX_VEHICLE_DRIVE_TANK_H
00031 #define PX_VEHICLE_DRIVE_TANK_H
00032 
00036 #include "vehicle/PxVehicleDrive.h"
00037 #include "vehicle/PxVehicleWheels.h"
00038 #include "vehicle/PxVehicleComponents.h"
00039 
00040 
00041 #if !PX_DOXYGEN
00042 namespace physx
00043 {
00044 #endif
00045 
00046 struct PxFilterData;
00047 class PxGeometry;
00048 class PxPhysics;
00049 class PxBatchQuery;
00050 class PxVehicleDrivableSurfaceToTireFrictionPairs;
00051 class PxShape;
00052 class PxMaterial;
00053 class PxRigidDynamic;
00054 
00060 struct PxVehicleDriveTankWheelOrder
00061 {
00062     enum Enum
00063     {
00064         eFRONT_LEFT=0,
00065         eFRONT_RIGHT,
00066         e1ST_FROM_FRONT_LEFT,
00067         e1ST_FROM_FRONT_RIGHT,
00068         e2ND_FROM_FRONT_LEFT,
00069         e2ND_FROM_FRONT_RIGHT,
00070         e3RD_FROM_FRONT_LEFT,
00071         e3RD_FROM_FRONT_RIGHT,
00072         e4TH_FROM_FRONT_LEFT,
00073         e4TH_FROM_FRONT_RIGHT,
00074         e5TH_FROM_FRONT_LEFT,
00075         e5TH_FROM_FRONT_RIGHT,
00076         e6TH_FROM_FRONT_LEFT,
00077         e6TH_FROM_FRONT_RIGHT,
00078         e7TH_FROM_FRONT_LEFT,
00079         e7TH_FROM_FRONT_RIGHT,
00080         e8TH_FROM_FRONT_LEFT,
00081         e8TH_FROM_FRONT_RIGHT,
00082         e9TH_FROM_FRONT_LEFT,
00083         e9TH_FROM_FRONT_RIGHT
00084     };
00085 };
00086 
00087 
00106 struct PxVehicleDriveTankControl
00107 {
00108     enum Enum
00109     {
00110         eANALOG_INPUT_ACCEL=0,
00111         eANALOG_INPUT_BRAKE_LEFT,   
00112         eANALOG_INPUT_BRAKE_RIGHT,  
00113         eANALOG_INPUT_THRUST_LEFT,  
00114         eANALOG_INPUT_THRUST_RIGHT, 
00115         eMAX_NB_DRIVETANK_ANALOG_INPUTS
00116     };
00117 };
00118 
00138 struct PxVehicleDriveTankControlModel
00139 {
00140     enum Enum
00141     {
00142         eSTANDARD=0,
00143         eSPECIAL
00144     };
00145 };
00146 
00147 
00151 class PxVehicleDriveTank : public PxVehicleDrive
00152 {
00153 //= ATTENTION! =====================================================================================
00154 // Changing the data layout of this class breaks the binary serialization format.  See comments for 
00155 // PX_BINARY_SERIAL_VERSION.  If a modification is required, please adjust the getBinaryMetaData 
00156 // function.  If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
00157 // accordingly.
00158 //==================================================================================================
00159 public:
00160 
00161     friend class PxVehicleUpdate;
00162 
00163 
00175     static PxVehicleDriveTank* allocate(const PxU32 nbWheels);
00176 
00181     void free();
00182 
00196     void setup
00197         (PxPhysics* physics, PxRigidDynamic* vehActor, 
00198          const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData& driveData,
00199          const PxU32 nbDrivenWheels);
00200 
00212     static PxVehicleDriveTank* create
00213         (PxPhysics* physics, PxRigidDynamic* vehActor, 
00214          const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData& driveData,
00215          const PxU32 nbDrivenWheels);
00216 
00223     void setDriveModel(const PxVehicleDriveTankControlModel::Enum driveModel)
00224     {
00225         mDriveModel=driveModel;
00226     }
00227 
00231     PxVehicleDriveTankControlModel::Enum getDriveModel() const {return mDriveModel;}
00232 
00240     void setToRestState();
00241 
00246     PxVehicleDriveSimData mDriveSimData;
00247 
00248 private:
00252     bool isValid() const;
00253 
00258     PxVehicleDriveTankControlModel::Enum mDriveModel;
00259 
00260     PxU32 mPad[3];
00261 
00262 //serialization
00263 public:
00264                                             PxVehicleDriveTank(PxBaseFlags baseFlags) : PxVehicleDrive(baseFlags)           {}
00265     static      PxVehicleDriveTank*         createObject(PxU8*& address, PxDeserializationContext& context);
00266     static      void                        getBinaryMetaData(PxOutputStream& stream);
00267     virtual     const char*                 getConcreteTypeName()       const   {   return "PxVehicleDriveTank";    }
00268     virtual     bool                        isKindOf(const char* name)  const   {   return !::strcmp("PxVehicleDriveTank", name) || PxBase::isKindOf(name); }
00269 protected:
00270                                             PxVehicleDriveTank();
00271                                             ~PxVehicleDriveTank(){}
00272 //~serialization
00273 };
00274 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDriveTank) & 15));
00275 
00276 #if !PX_DOXYGEN
00277 } // namespace physx
00278 #endif
00279 
00281 #endif //PX_VEHICLE_DRIVE_TANK_H


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