summaryrefslogtreecommitdiffhomepage
path: root/filter-accela-hamilton/accela_hamilton.h
blob: ccd74fbf51040db1b5f6b5bf11153e6ba9c42aca (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
62
63
64
65
66
67
68
69
/* Copyright (c) 2012-2015 Stanislaw Halik
 * Copyright (c) 2023-2024 Michael Welter
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 */
#pragma once

#include "ui_accela_hamilton_filtercontrols.h"

#include "accela_hamilton_settings.hpp"
#include "api/plugin-api.hpp"
#include "compat/timer.hpp"
#include "compat/variance.hpp"

#include <QMutex>
#include <QTimer>
#include <QQuaternion>
#include <QVector3D>

//#define DEBUG_ACCELA

struct accela_hamilton : IFilter
{
    accela_hamilton();
    void filter(const double* input, double *output) override;
    void center() override { first_run = true; }
    spline spline_rot, spline_pos;
    module_status initialize() override { return status_ok(); }
private:
    settings_accela_hamilton s;
    QVector3D last_position = {};
    QQuaternion last_rotation = {};
    Timer t;
#if defined DEBUG_ACCELA
    Timer debug_timer;
    double debug_max;
    variance var;
#endif
    bool first_run = true;
};

class dialog_accela_hamilton : public IFilterDialog
{
    Q_OBJECT
public:
    dialog_accela_hamilton();
    void register_filter(IFilter*) override {}
    void unregister_filter() override {}
    void save() override;
    void reload() override;
    bool embeddable() noexcept override { return true; }
    void set_buttons_visible(bool x) override;
private:
    Ui::AccelaUICdialog_accela ui;
    settings_accela_hamilton s;
private slots:
    void doOK();
    void doCancel();
};

class accela_hamiltonDll : public Metadata
{
    Q_OBJECT

    QString name() override { return tr("AccelaHamilton"); }
    QIcon icon() override { return QIcon(":/images/filter-16.png"); }
};