2021-01-02 01:16:06 +01:00
|
|
|
#ifndef DRONE_HH
|
|
|
|
#define DRONE_HH
|
|
|
|
|
|
|
|
#include "opengl_mesh.hh"
|
|
|
|
#include "waypoint.hh"
|
|
|
|
|
|
|
|
#include <QVector>
|
|
|
|
#include <QVector3D>
|
|
|
|
#include <QJsonObject>
|
|
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
static T lerp(T a, T b, double factor) {
|
|
|
|
return a + (factor * (b - a));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class Drone {
|
|
|
|
static OpenGLMesh *mesh;
|
|
|
|
static bool mesh_initialized;
|
|
|
|
|
|
|
|
QVector<Waypoint> waypoints;
|
|
|
|
QVector3D pos;
|
|
|
|
int id;
|
2021-01-04 14:49:26 +01:00
|
|
|
double speed = 0;
|
2021-01-02 01:16:06 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
Drone(int id);
|
|
|
|
Drone(const QJsonObject &json);
|
|
|
|
const QVector<Waypoint> getWaypoints() const;
|
|
|
|
void setTo(int frame);
|
2021-01-03 12:30:16 +01:00
|
|
|
const QVector3D getPos() const;
|
2021-01-02 01:16:06 +01:00
|
|
|
int getId() const;
|
2021-01-04 14:49:26 +01:00
|
|
|
double getSpeed() const;
|
2021-01-03 12:30:16 +01:00
|
|
|
const OpenGLMesh *getMesh() const;
|
2021-01-02 01:16:06 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|