summaryrefslogtreecommitdiffhomepage
path: root/pose-widget/pose-widget.hpp
blob: 49044d9397638e958ab4ca199d9f6c7229ad74c5 (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
/* Copyright (c) 2013, 2015 Stanislaw Halik <sthalik@misaki.pl>
 *
 * 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 "api/plugin-api.hpp"
#include "compat/euler.hpp"

#include "export.hpp"

#include <QWidget>
#include <QImage>
#include <QCheckBox>

//#define TEST
namespace pose_widget_impl {

using namespace euler;

struct OTR_POSE_WIDGET_EXPORT pose_widget final : QWidget
{
public:
    pose_widget(QWidget *parent = nullptr);
    void present(double xAngle, double yAngle, double zAngle, double x, double y, double z);
    QSize sizeHint() const override;
    QCheckBox mirror{QCheckBox{"Mirror", this}};
private:
    void resizeEvent(QResizeEvent *event) override;
    void paintEvent(QPaintEvent*) override;

    Pose_ R, T;
    QImage front{QImage{":/images/side1.png"}.convertToFormat(QImage::Format_ARGB32)};
    QImage back {QImage{":/images/side6.png"}.convertToFormat(QImage::Format_ARGB32)
                                             .mirrored(true,false)};
    QImage shine {QImage{front.width(), front.height(), QImage::Format_ARGB32}};
    QImage shadow{QImage{front.width(), front.height(), QImage::Format_ARGB32}};
};

}

using pose_widget = pose_widget_impl::pose_widget;