| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#pragma once |
| 6 |
|
| 7 |
#include <Jolt/ObjectStream/SerializableObject.h> |
| 8 |
#include <Jolt/Core/StreamIn.h> |
| 9 |
#include <Jolt/Core/StreamOut.h> |
| 10 |
#ifdef JPH_DEBUG_RENDERER |
| 11 |
#include <Jolt/Renderer/DebugRenderer.h> |
| 12 |
#endif |
| 13 |
|
| 14 |
JPH_NAMESPACE_BEGIN |
| 15 |
|
| 16 |
class PhysicsSystem; |
| 17 |
class VehicleController; |
| 18 |
class VehicleConstraint; |
| 19 |
class WheelSettings; |
| 20 |
class Wheel; |
| 21 |
class StateRecorder; |
| 22 |
|
| 23 |
|
| 24 |
class JPH_EXPORT VehicleControllerSettings : public SerializableObject, public RefTarget<VehicleControllerSettings> |
| 25 |
{ |
| 26 |
JPH_DECLARE_SERIALIZABLE_ABSTRACT(JPH_EXPORT, VehicleControllerSettings) |
| 27 |
|
| 28 |
public: |
| 29 |
|
| 30 |
virtual void SaveBinaryState(StreamOut &inStream) const = 0; |
| 31 |
|
| 32 |
|
| 33 |
virtual void RestoreBinaryState(StreamIn &inStream) = 0; |
| 34 |
|
| 35 |
|
| 36 |
virtual VehicleController * ConstructController(VehicleConstraint &inConstraint) const = 0; |
| 37 |
}; |
| 38 |
|
| 39 |
|
| 40 |
class JPH_EXPORT VehicleController : public NonCopyable |
| 41 |
{ |
| 42 |
public: |
| 43 |
JPH_OVERRIDE_NEW_DELETE |
| 44 |
|
| 45 |
|
| 46 |
explicit VehicleController(VehicleConstraint &inConstraint) : mConstraint(inConstraint) { } |
| 47 |
virtual ~VehicleController() = default; |
| 48 |
|
| 49 |
|
| 50 |
VehicleConstraint & GetConstraint() { return mConstraint; } |
| 51 |
const VehicleConstraint & GetConstraint() const { return mConstraint; } |
| 52 |
|
| 53 |
|
| 54 |
virtual Ref<VehicleControllerSettings> GetSettings() const = 0; |
| 55 |
|
| 56 |
protected: |
| 57 |
|
| 58 |
friend class VehicleConstraint; |
| 59 |
|
| 60 |
|
| 61 |
virtual Wheel * ConstructWheel(const WheelSettings &inWheel) const = 0; |
| 62 |
|
| 63 |
|
| 64 |
virtual bool AllowSleep() const = 0; |
| 65 |
|
| 66 |
|
| 67 |
virtual void PreCollide(float inDeltaTime, PhysicsSystem &inPhysicsSystem) = 0; |
| 68 |
|
| 69 |
|
| 70 |
virtual void PostCollide(float inDeltaTime, PhysicsSystem &inPhysicsSystem) = 0; |
| 71 |
|
| 72 |
|
| 73 |
virtual bool SolveLongitudinalAndLateralConstraints(float inDeltaTime) = 0; |
| 74 |
|
| 75 |
|
| 76 |
virtual void SaveState(StateRecorder &inStream) const = 0; |
| 77 |
virtual void RestoreState(StateRecorder &inStream) = 0; |
| 78 |
|
| 79 |
#ifdef JPH_DEBUG_RENDERER |
| 80 |
|
| 81 |
virtual void Draw(DebugRenderer *inRenderer) const = 0; |
| 82 |
#endif |
| 83 |
|
| 84 |
VehicleConstraint & mConstraint; |
| 85 |
}; |
| 86 |
|
| 87 |
JPH_NAMESPACE_END |