Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
Loading...
Searching...
No Matches
PhysicsObject.h
Go to the documentation of this file.
1#ifndef ULT_PHYSICS_OBJECT_H_INCLUDED
2#define ULT_PHYSICS_OBJECT_H_INCLUDED
3
4#include "../Math/Matrix4x4.h"
5#include "../Math/Vector3D.h"
6
7namespace Ult
8{
9
15{
16public:
21 mMass(1.0f),
22 mMassInv(1.0f),
23 mVolume(0.0f),
24 mLift(0.0f),
25 mSpeed(0.0f)
26 {}
27
31 {}
32
37 virtual void Update(float dt) = 0;
38
40 virtual float GetDragArea() = 0;
42 virtual float GetDragCoefficient() = 0;
44 virtual float GetLiftCoefficient() = 0;
46 virtual float GetVolumeUnderHeight(float height) = 0;
47
49 virtual void SetMass(const float m) { mMass = m; mMassInv = 1.0f/m; }
51 virtual float GetMass() const { return mMass; }
53 virtual float GetMassInv() const { return mMassInv; }
54
56 virtual float GetVolume() const { return mVolume; }
57
59 virtual void SetLift(const float lVal, const Vector3D& lVec) {
60 mLift = lVal;
61 mLiftVector = lVec;
62 }
63
64 virtual float GetLift() const { return mLift; }
66 virtual Vector3D GetLiftVec() const { return mLiftVector; }
67
69 virtual float GetSpeed() const { return mSpeed; }
70
72 virtual Vector3D GetOldPosition() const { return mOldPosition; }
74 virtual void SetPosition(const Vector3D& pos) { mPosition = pos; }
76 virtual Vector3D GetPosition() { return mPosition; }
77
79 virtual void SetForce(const Vector3D& f) { mForce = f; }
81 virtual Vector3D GetForce() const { return mForce; }
83 virtual void AddForce(const Vector3D& f) { mForce += f; }
84
86 virtual void SetVelocity(const Vector3D& v) { mVelocity = v; }
88 virtual Vector3D GetVelocity() const { return mVelocity; }
90 virtual void AddVelocity(const Vector3D& v) { mVelocity += v; }
91
93 virtual Vector3D GetAcceleration() const { return mAcceleration; }
94
100
101protected:
102 float mMass;
103 float mMassInv;
104 float mVolume;
105 float mLift;
106 float mSpeed;
107
114};
115
116} // namespace Ult
117
118#endif // ULT_PHYSICS_OBJECT_H_INCLUDED
119
Definition Matrix4x4.h:14
virtual float GetLiftCoefficient()=0
virtual float GetMassInv() const
Definition PhysicsObject.h:53
virtual Vector3D GetOldPosition() const
Definition PhysicsObject.h:72
virtual Vector3D GetAcceleration() const
Definition PhysicsObject.h:93
float mSpeed
Definition PhysicsObject.h:106
Vector3D mPosition
Definition PhysicsObject.h:109
Vector3D mVelocity
Definition PhysicsObject.h:111
virtual void SetLift(const float lVal, const Vector3D &lVec)
Definition PhysicsObject.h:59
virtual float GetVolumeUnderHeight(float height)=0
Vector3D mOldPosition
Definition PhysicsObject.h:108
float mVolume
Definition PhysicsObject.h:104
virtual float GetSpeed() const
Definition PhysicsObject.h:69
virtual void Update(float dt)=0
virtual Vector3D GetForce() const
Definition PhysicsObject.h:81
virtual float GetLift() const
Definition PhysicsObject.h:64
Vector3D mLiftVector
Definition PhysicsObject.h:113
virtual float GetVolume() const
Definition PhysicsObject.h:56
virtual void AddVelocity(const Vector3D &v)
Definition PhysicsObject.h:90
virtual ~PhysicsObject()
Definition PhysicsObject.h:30
virtual float GetDragArea()=0
virtual Vector3D GetVelocity() const
Definition PhysicsObject.h:88
virtual void SetMass(const float m)
Definition PhysicsObject.h:49
virtual void AddForce(const Vector3D &f)
Definition PhysicsObject.h:83
virtual void SetPosition(const Vector3D &pos)
Definition PhysicsObject.h:74
Vector3D mAcceleration
Definition PhysicsObject.h:112
virtual Vector3D GetLiftVec() const
Definition PhysicsObject.h:66
Vector3D mForce
Definition PhysicsObject.h:110
virtual Matrix4x4 GetTransformation()=0
float mMassInv
Definition PhysicsObject.h:103
virtual void SetVelocity(const Vector3D &v)
Definition PhysicsObject.h:86
virtual void SetForce(const Vector3D &f)
Definition PhysicsObject.h:79
virtual float GetMass() const
Definition PhysicsObject.h:51
PhysicsObject()
Definition PhysicsObject.h:20
float mMass
Definition PhysicsObject.h:102
virtual Vector3D GetPosition()
Definition PhysicsObject.h:76
virtual float GetDragCoefficient()=0
float mLift
Definition PhysicsObject.h:105
Definition Vector3D.h:12
Definition Archive.h:13