PxVehicleDriveNW.h
Go to the documentation of this file.
1 //
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions
4 // are met:
5 // * Redistributions of source code must retain the above copyright
6 // notice, this list of conditions and the following disclaimer.
7 // * Redistributions in binary form must reproduce the above copyright
8 // notice, this list of conditions and the following disclaimer in the
9 // documentation and/or other materials provided with the distribution.
10 // * Neither the name of NVIDIA CORPORATION nor the names of its
11 // contributors may be used to endorse or promote products derived
12 // from this software without specific prior written permission.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
15 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 //
26 // Copyright (c) 2008-2018 NVIDIA Corporation. All rights reserved.
27 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
28 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
29 
30 #ifndef PX_VEHICLE_NWDRIVE_H
31 #define PX_VEHICLE_NWDRIVE_H
32 
36 #include "vehicle/PxVehicleDrive.h"
39 
40 #if !PX_DOXYGEN
41 namespace physx
42 {
43 #endif
44 
45 struct PxFilterData;
46 class PxGeometry;
47 class PxPhysics;
48 class PxBatchQuery;
50 class PxShape;
51 class PxMaterial;
52 class PxRigidDynamic;
53 
60 {
61 //= ATTENTION! =====================================================================================
62 // Changing the data layout of this class breaks the binary serialization format. See comments for
63 // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
64 // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
65 // accordingly.
66 //==================================================================================================
67 public:
68 
69  friend class PxVehicleDriveNW;
70 
73  {
74  }
75 
80  {
81  return mDiff;
82  }
83 
88  void setDiffData(const PxVehicleDifferentialNWData& diff);
89 
90 private:
91 
97 
103  bool isValid() const;
104 
105 //serialization
106 public:
108  static void getBinaryMetaData(PxOutputStream& stream);
109 //~serialization
110 };
112 
113 
120 {
121  enum Enum
122  {
123  eANALOG_INPUT_ACCEL=0,
128  eMAX_NB_DRIVENW_ANALOG_INPUTS
129  };
130 };
131 
136 {
137 //= ATTENTION! =====================================================================================
138 // Changing the data layout of this class breaks the binary serialization format. See comments for
139 // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
140 // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
141 // accordingly.
142 //==================================================================================================
143 public:
144 
145  friend class PxVehicleUpdate;
146 
156  static PxVehicleDriveNW* allocate(const PxU32 nbWheels);
157 
162  void free();
163 
174  void setup
175  (PxPhysics* physics, PxRigidDynamic* vehActor,
176  const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimDataNW& driveData,
177  const PxU32 nbWheels);
178 
190  static PxVehicleDriveNW* create
191  (PxPhysics* physics, PxRigidDynamic* vehActor,
192  const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimDataNW& driveData,
193  const PxU32 nbWheels);
194 
202  void setToRestState();
203 
209 
210 private:
211 
215  bool isValid() const;
216 
217 //serialization
218 public:
219  PxVehicleDriveNW(PxBaseFlags baseFlags) : PxVehicleDrive(baseFlags), mDriveSimData(PxEmpty) {}
222  static PxVehicleDriveNW* createObject(PxU8*& address, PxDeserializationContext& context);
223  static void getBinaryMetaData(PxOutputStream& stream);
224  virtual const char* getConcreteTypeName() const { return "PxVehicleDriveNW"; }
225  virtual bool isKindOf(const char* name) const { return !::strcmp("PxVehicleDriveNW", name) || PxBase::isKindOf(name); }
226 //~serialization
227 };
228 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDriveNW) & 15));
229 
230 
231 
232 #if !PX_DOXYGEN
233 } // namespace physx
234 #endif
235 
237 #endif //PX_VEHICLE_NWDRIVE_H
Definition: GuContactBuffer.h:37
Friction for each combination of driving surface type and tire type.
Definition: PxVehicleTireFriction.h:62
const PxVehicleDifferentialNWData & getDiffData() const
Return the data describing the differential of a vehicle with up to PX_MAX_NB_WHEELS driven wheels...
Definition: PxVehicleDriveNW.h:79
PxRigidDynamic represents a dynamic rigid simulation object in the physics SDK.
Definition: PxRigidDynamic.h:83
PxFilterData is user-definable data which gets passed into the collision filtering shader and/or call...
Definition: PxFiltering.h:366
Definition: PxVehicleDriveNW.h:124
Abstract class for collision shapes.
Definition: PxShape.h:142
Batched queries object. This is used to perform several queries at the same time. ...
Definition: PxBatchQuery.h:57
PxVehicleDifferentialNWData mDiff
Differential simulation data.
Definition: PxVehicleDriveNW.h:96
virtual bool isKindOf(const char *superClass) const
Returns whether a given type name matches with the type of this instance.
Definition: PxBase.h:178
Data structure with instanced dynamics data and configuration data of a vehicle with up to PX_MAX_NB_...
Definition: PxVehicleDriveNW.h:135
A geometry object.
Definition: PxGeometry.h:75
Output stream class for I/O.
Definition: PxIO.h:114
Data structure describing non-wheel configuration data of a vehicle that has engine, gears, clutch, and auto-box.
Definition: PxVehicleDrive.h:57
~PxVehicleDriveNW()
Definition: PxVehicleDriveNW.h:221
PxVehicleDriveSimDataNW(const PxEMPTY)
Definition: PxVehicleDriveNW.h:107
Data structure describing configuration data of a vehicle with up to 20 wheels.
Definition: PxVehicleWheels.h:59
Data structure describing configuration data of a vehicle with up to PX_MAX_NB_WHEELS driven equally ...
Definition: PxVehicleDriveNW.h:59
A complete vehicle with instance dynamics data and configuration data for wheels and engine...
Definition: PxVehicleDrive.h:497
PxVehicleDriveSimDataNW()
Definition: PxVehicleDriveNW.h:71
uint8_t PxU8
Definition: PxSimpleTypes.h:75
Definition: PxVehicleDriveNW.h:125
Enum
Definition: PxVehicleDriveNW.h:121
#define PX_COMPILE_TIME_ASSERT(exp)
Definition: PxPreprocessor.h:447
PxVehicleDriveSimDataNW mDriveSimData
Simulation data that describes the configuration of the vehicle's drive model.
Definition: PxVehicleDriveNW.h:208
PxEMPTY
Definition: Px.h:70
Binary deserialization context class.
Definition: PxSerialFramework.h:174
bool isValid() const
Test if the instanced dynamics and configuration data has legal values.
Material class to represent a set of surface properties.
Definition: PxMaterial.h:130
Abstract singleton factory class used for instancing objects in the Physics SDK.
Definition: PxPhysics.h:71
Definition: PxVehicleComponents.h:535
The control inputs for a PxVehicleDriveNW.
Definition: PxVehicleDriveNW.h:119
static void getBinaryMetaData(PxOutputStream &stream)
uint32_t PxU32
Definition: Px.h:48
PxVehicleDriveNW(PxBaseFlags baseFlags)
Definition: PxVehicleDriveNW.h:219
Definition: PxVehicleDriveNW.h:126
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition: PxVehicleDriveNW.h:225
virtual const char * getConcreteTypeName() const
Returns string name of dynamic type.
Definition: PxVehicleDriveNW.h:224
Definition: PxVehicleDriveNW.h:127
Definition: Px.h:72