#ifndef DRONE_CONTROLLER_HH #define DRONE_CONTROLLER_HH #include "opengl_mesh.hh" #include #include #include template static T lerp(T a, T b, double factor) { return a + (factor * (b - a)); } struct Waypoint { int frame; QVector3D pos; Waypoint(unsigned frame, QVector3D pos); Waypoint(const QJsonObject &json); }; class Drone { static OpenGLMesh *mesh; static bool mesh_initialized; QVector waypoints; int mesh_id; public: Drone(); Drone(const QJsonObject &json); const QVector getWaypoints() const; void setTo(int frame); }; class DroneController : public QObject { Q_OBJECT int framerate; int frame = 0; int duration = 0; QVector drones; QTimer timer; bool paused = true; public: DroneController(const QJsonObject &json); int getDuration() const; signals: void frameChanged(int frame); void playing(); void pausing(); private slots: void step(); public slots: void play(); void pause(); void suspend(); void resume(); void seek(int frame); }; #endif