-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglwidget.h
119 lines (98 loc) · 2.49 KB
/
glwidget.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
111
112
113
114
115
116
117
118
119
#ifndef GLWIDGET_H
#define GLWIDGET_H
#include <QGLWidget>
#include <QtOpenGL>
#include <boost/smart_ptr.hpp>
#include "OMFContainer.h"
#include "OMFHeader.h"
typedef boost::shared_ptr<OMFHeader> header_ptr;
void angleToRGB(float angle, GLfloat *color);
void HSLToRGB(float h, float s, float l, GLfloat *color);
class GLWidget : public QGLWidget
{
Q_OBJECT
public:
GLWidget(QWidget *parent = 0);
~GLWidget();
QSize minimumSizeHint() const;
QSize sizeHint() const;
public slots:
void setXRotation(int angle);
void setYRotation(int angle);
void setZRotation(int angle);
void setXCom(float val);
void setYCom(float val);
void setZCom(float val);
void setXLoc(float val);
void setYLoc(float val);
void setZLoc(float val);
void setXSliceLow(int low);
void setYSliceLow(int low);
void setZSliceLow(int low);
void setXSliceHigh(int high);
void setYSliceHigh(int high);
void setZSliceHigh(int high);
void updateCOM();
void updateExtent();
void updateData(array_ptr data);
void updateHeader(header_ptr header, array_ptr data);
// void updateTopOverlay(QString newstring);
void toggleDisplay(int cubes);
void setBackgroundColor(QColor color);
signals:
void xRotationChanged(int angle);
void yRotationChanged(int angle);
void zRotationChanged(int angle);
void COMChanged(float val);
protected:
void initializeGL();
void paintGL();
void resizeGL(int width, int height);
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event);
private:
int valuedim; // scalar or vector
int xRot;
int yRot;
int zRot;
float xLoc;
float yLoc;
float zLoc;
float zoom;
QPoint lastPos;
QColor qtGreen;
QColor qtPurple;
QColor backgroundColor;
GLuint cone, cube, vector;
int drawCubes;
// For storing the magnetization vectors
// we only need float32 since double precision
// is not necessary for rendering
int numSpins;
float locations[1000][3];
float spins[1000][3];
// center of mass coordinates
float xcom;
float ycom;
float zcom;
// max extent
float xmax, xmin;
float ymax, ymin;
float zmax, zmin;
// Max Values
float maxmag, minmag;
// slice variables
int xSliceLow, xSliceHigh;
int ySliceLow, ySliceHigh;
int zSliceLow, zSliceHigh;
// pointer to relevant data
array_ptr dataPtr;
bool usePtr;
bool displayOn;
// bool topOverlayOn;
// Overpainting
// void drawInstructions(QPainter *painter);
// QString topOverlayText;
};
#endif