58 lines
834 B
C++
58 lines
834 B
C++
#ifndef DRONE_CONTROLLER_HH
|
|
#define DRONE_CONTROLLER_HH
|
|
|
|
#include <QJsonObject>
|
|
#include <QVector3D>
|
|
#include <QTimer>
|
|
|
|
|
|
struct Waypoint {
|
|
int frame;
|
|
QVector3D pos;
|
|
|
|
Waypoint(unsigned frame, QVector3D pos);
|
|
Waypoint(const QJsonObject &json);
|
|
};
|
|
|
|
|
|
class Drone {
|
|
QVector<Waypoint> waypoints;
|
|
|
|
public:
|
|
Drone(const QJsonObject &json);
|
|
const QVector<Waypoint> getWaypoints() const;
|
|
};
|
|
|
|
|
|
class DroneController : public QObject {
|
|
Q_OBJECT
|
|
|
|
int framerate;
|
|
int frame = 0;
|
|
int duration = 0;
|
|
QVector<Drone> drones;
|
|
QTimer timer;
|
|
bool paused = true;
|
|
|
|
public:
|
|
DroneController(const QJsonObject &json);
|
|
~DroneController();
|
|
int getDuration() const;
|
|
|
|
signals:
|
|
void frameChanged(int frame);
|
|
|
|
private slots:
|
|
void step();
|
|
|
|
public slots:
|
|
void play();
|
|
void pause();
|
|
void suspend();
|
|
void resume();
|
|
void seek(int frame);
|
|
};
|
|
|
|
|
|
#endif
|