source: trunk/FACT++/gui/Q3DCameraWidget.h @ 14793

Last change on this file since 14793 was 14793, checked in by lyard, 7 years ago
fixed warning multiple-display
File size: 1.5 KB
Line 
1/*
2 * Q3DCameraWidget.h
3 *
4 *  Created on: Aug 26, 2011
5 *      Author: lyard
6 */
7
8#ifndef Q3DCAMERAWIDGET_H_
9#define Q3DCAMERAWIDGET_H_
10
11#include "BasicGlCamera.h"
12#include <QtCore/QTimer>
13#include <iostream>
14
15
16using namespace std;
17
18struct cameraLocation
19{
20    float rotX;
21    float rotY;
22    float position[3];
23
24    cameraLocation() : rotX(0), rotY(0), position({0,0,0})
25    {}
26    cameraLocation(float rx, float ry, float x, float y, float z): rotX(rx), rotY(ry), position({x,y,z})
27    {}
28};
29
30struct float3
31{
32    float data[4];
33    float3()
34    {
35        data[0] = data[1] = data[2] = 0;
36        data[3] = 1.f;
37    }
38    float& operator [] (int index)
39    {
40        return data[index];
41    }
42};
43class Q3DCameraWidget : public BasicGlCamera
44{
45    Q_OBJECT
46
47public:
48    Q3DCameraWidget(QWidget* pparent = 0);
49    ~Q3DCameraWidget();
50    void setData(float* data);
51    void setData(short* data);
52public Q_SLOTS:
53    void timedUpdate();
54
55protected:
56    void paintGL();
57    void initializeGL();
58    void resizeGL(int cWidth, int cHeight);
59    void drawCameraBody();
60    float rotX, rotY;
61    void mousePressEvent(QMouseEvent* event);
62    void mouseDoubleClickEvent(QMouseEvent *cEvent);
63    void mouseMoveEvent(QMouseEvent *cEvent);
64
65private:
66    cameraLocation currentLoc;
67    vector<short> _data;
68    vector<float> _colorR;
69    vector<float> _colorG;
70    vector<float> _colorB;
71    vector<float> _x;
72    vector<float> _y;
73    vector<float> _z;
74    QTimer _timer;
75    bool isPicking;
76    void calculateColorsAndPositions();
77    bool _warningWritten;
78
79};
80
81#endif /* Q3DCAMERAWIDGET_H_ */
Note: See TracBrowser for help on using the repository browser.