00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef PX_VEHICLE_4WDRIVE_H
00031 #define PX_VEHICLE_4WDRIVE_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 class PxVehicleDriveSimData4W : public PxVehicleDriveSimData
00061 {
00062
00063
00064
00065
00066
00067
00068 public:
00069
00070 friend class PxVehicleDrive4W;
00071
00072 PxVehicleDriveSimData4W()
00073 : PxVehicleDriveSimData()
00074 {
00075 }
00076
00081 PX_FORCE_INLINE const PxVehicleDifferential4WData& getDiffData() const
00082 {
00083 return mDiff;
00084 }
00085
00090 PX_FORCE_INLINE const PxVehicleAckermannGeometryData& getAckermannGeometryData() const
00091 {
00092 return mAckermannGeometry;
00093 }
00094
00099 void setDiffData(const PxVehicleDifferential4WData& diff);
00100
00105 void setAckermannGeometryData(const PxVehicleAckermannGeometryData& ackermannData);
00106
00107 private:
00108
00113 PxVehicleDifferential4WData mDiff;
00114
00119 PxVehicleAckermannGeometryData mAckermannGeometry;
00120
00126 bool isValid() const;
00127
00128
00129 public:
00130 PxVehicleDriveSimData4W(const PxEMPTY) : PxVehicleDriveSimData(PxEmpty), mDiff(PxEmpty), mAckermannGeometry(PxEmpty) {}
00131 static void getBinaryMetaData(PxOutputStream& stream);
00132
00133 };
00134 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDriveSimData4W) & 15));
00135
00136
00137
00144 struct PxVehicleDrive4WWheelOrder
00145 {
00146 enum Enum
00147 {
00148 eFRONT_LEFT=0,
00149 eFRONT_RIGHT,
00150 eREAR_LEFT,
00151 eREAR_RIGHT
00152 };
00153 };
00154
00161 struct PxVehicleDrive4WControl
00162 {
00163 enum Enum
00164 {
00165 eANALOG_INPUT_ACCEL=0,
00166 eANALOG_INPUT_BRAKE,
00167 eANALOG_INPUT_HANDBRAKE,
00168 eANALOG_INPUT_STEER_LEFT,
00169 eANALOG_INPUT_STEER_RIGHT,
00170 eMAX_NB_DRIVE4W_ANALOG_INPUTS
00171 };
00172 };
00173
00177 class PxVehicleDrive4W : public PxVehicleDrive
00178 {
00179
00180
00181
00182
00183
00184
00185 public:
00186 friend class PxVehicleUpdate;
00187
00197 static PxVehicleDrive4W* allocate(const PxU32 nbWheels);
00198
00203 void free();
00204
00216 void setup
00217 (PxPhysics* physics, PxRigidDynamic* vehActor,
00218 const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData4W& driveData,
00219 const PxU32 nbNonDrivenWheels);
00220
00233 static PxVehicleDrive4W* create
00234 (PxPhysics* physics, PxRigidDynamic* vehActor,
00235 const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData4W& driveData,
00236 const PxU32 nbNonDrivenWheels);
00237
00245 void setToRestState();
00246
00251 PxVehicleDriveSimData4W mDriveSimData;
00252
00253 private:
00254
00258 bool isValid() const;
00259
00260
00261 protected:
00262 PxVehicleDrive4W();
00263 ~PxVehicleDrive4W(){}
00264 virtual bool isKindOf(const char* name) const { return !::strcmp("PxVehicleDrive4W", name) || PxBase::isKindOf(name); }
00265 public:
00266 static PxVehicleDrive4W* createObject(PxU8*& address, PxDeserializationContext& context);
00267 static void getBinaryMetaData(PxOutputStream& stream);
00268 PxVehicleDrive4W(PxBaseFlags baseFlags) : PxVehicleDrive(baseFlags), mDriveSimData(PxEmpty) {}
00269 virtual const char* getConcreteTypeName() const { return "PxVehicleDrive4W"; }
00270
00271 };
00272 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDrive4W) & 15));
00273
00274 #if !PX_DOXYGEN
00275 }
00276 #endif
00277
00279 #endif //PX_VEHICLE_4WDRIVE_H