aboutsummaryrefslogtreecommitdiffstats
path: root/tools/shapegen/shapemanager.h
blob: 38f39b8988a2347ab1bef6335fd7c6235268a772 (plain)
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
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#ifndef SHAPEMANAGER_H
#define SHAPEMANAGER_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists purely as an
// implementation detail.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#include <QtCore/qobject.h>
#include <QtCore/qlist.h>
#include <QtGui/qimage.h>
#include <QtGui/qvector3d.h>

class ShapeManager : public QObject
{
    Q_OBJECT
public:
    explicit ShapeManager(QObject *parent = nullptr);

    enum class SortingMode : quint8
    {
        Random,
        DistanceClosestFirst,
        DistanceClosestLast
    };

    void setImage(const QString &filename);
    void setDepth(float depth);
    void setAmount(int amount);
    void setScale(float scale);
    void setSortingMode(SortingMode mode);
    void setSortingPosition(const QVector3D &position);

    bool loadImage();
    bool generateData();
    bool saveShapeData(const QString &filename);
    void dumpOutput();

private:
    QString m_imageFilename;
    QImage m_image;
    float m_depth = 0.0f;
    int m_amount = -1;
    QString m_cborFilename;
    QList<QVector3D> m_data;
    QList<QVector3D> m_outputData;
    float m_scale = 1.0f;
    SortingMode m_sortingMode = SortingMode::Random;
    QVector3D m_sortingPosition;
};

#endif // SHAPEMANAGER_H