-
Notifications
You must be signed in to change notification settings - Fork 13
/
animation.h
110 lines (91 loc) · 2.63 KB
/
animation.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
*
* Copyright (C) 2015 Miroslav Krajicek (https://github.com/kaajo).
* All Rights Reserved.
*
* This file is part of WebCamCap.
*
* WebCamCap is free software: you can redistribute it and/or modify
* it under the terms of the GNU LGPL version 3 as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* WebCamCap is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU LGPL version 3
* along with WebCamCap. If not, see <http://www.gnu.org/licenses/lgpl-3.0.txt>.
*
*/
#ifndef ANIMATION_H
#define ANIMATION_H
#include "webcamcapprimitives_global.h"
#include "frame.h"
#include <QVector3D>
#include <QString>
#include <QVector>
#include <QObject>
#include <QVariantMap>
/**
* @author Miroslav Krajicek
* @brief The Animation class stores captured frames from scene for edit/export.
*/
class WEBCAMCAPPRIMITIVESSHARED_EXPORT Animation : public QObject
{
Q_OBJECT
QString m_name;
long int m_elapsedMilliSecondsTime = 0;
QVector<Frame> m_frames;
QVector3D m_roomDimensions;
public:
/**
* @brief Animation default constructor
* @param roomDims dimensions are captured normalized so before exporting,
* they need to be multiplied again by room dimensions
* @param name
* @param parent
*/
explicit Animation(QVector3D roomDims, QString name = "name", QObject *parent = 0);
/**
* @brief This function computes AVERAGE FPS of animation.
* It is not guaranteed that all frames will be captured in same or almost same time.
* @return average FPS of animation
*/
float fps();
/**
* @brief
* @return elapsed time in seconds
*/
float length();
/**
* @brief
* @return elapsed time in milliseconds
*/
float lengthMS();
/**
* @brief Exports #Animation into specified folder.
* @param folder
* @return true if exporting was successful
*/
bool save(QString file);
QVariantMap toVariantMap();
void fromVariantMap(QVariantMap map);
QString name() const;
void setName(const QString &name);
/**
* @brief Usefull for animation replay
* @return
*/
QVector3D roomDimensions() const;
QVector<Frame> &frames();
public slots:
/**
* @brief Adds next frame to end of animation.
* @param frame
*/
void addFrame(Frame frame);
private:
};
#endif // ANIMATION_H