PxVehicleDriveTank.h

Go to the documentation of this file.
00001 //
00002 // Redistribution and use in source and binary forms, with or without
00003 // modification, are permitted provided that the following conditions
00004 // are met:
00005 //  * Redistributions of source code must retain the above copyright
00006 //    notice, this list of conditions and the following disclaimer.
00007 //  * Redistributions in binary form must reproduce the above copyright
00008 //    notice, this list of conditions and the following disclaimer in the
00009 //    documentation and/or other materials provided with the distribution.
00010 //  * Neither the name of NVIDIA CORPORATION nor the names of its
00011 //    contributors may be used to endorse or promote products derived
00012 //    from this software without specific prior written permission.
00013 //
00014 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
00015 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00017 // PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00018 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00019 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00020 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00021 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00022 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00023 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00024 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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_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-2018 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com