2023-05-02 13:02:56 +05:00
|
|
|
#include <QtWidgets/QOpenGLWidget>
|
2023-05-03 15:57:59 +05:00
|
|
|
#include "obj.h"
|
2023-05-04 14:37:43 +05:00
|
|
|
#include <QKeyEvent>
|
2023-05-02 13:02:56 +05:00
|
|
|
|
|
|
|
class OPGLWidget : public QOpenGLWidget
|
|
|
|
{
|
2023-05-04 13:17:42 +05:00
|
|
|
Q_OBJECT
|
2023-05-02 13:02:56 +05:00
|
|
|
public:
|
|
|
|
OPGLWidget(QWidget *parent) : QOpenGLWidget(parent) {}
|
2023-05-04 13:17:42 +05:00
|
|
|
public slots:
|
2023-05-02 14:16:05 +05:00
|
|
|
void paintGL();
|
2023-05-04 13:21:34 +05:00
|
|
|
void update_camera();
|
2023-05-04 13:17:42 +05:00
|
|
|
protected:
|
2023-05-02 14:16:05 +05:00
|
|
|
void initializeGL();
|
|
|
|
void resizeGL(int w, int h);
|
2023-05-02 15:44:33 +05:00
|
|
|
void reorient();
|
|
|
|
|
2023-05-04 14:37:43 +05:00
|
|
|
void keyPressEvent(QKeyEvent *event);
|
|
|
|
void keyReleaseEvent(QKeyEvent *event);
|
|
|
|
|
2023-05-03 13:19:03 +05:00
|
|
|
int mtl_idx = -1;
|
2023-05-03 16:28:08 +05:00
|
|
|
float loc[3] = {0, 0, 10};
|
|
|
|
float f[3] = {0, 0, -1};
|
2023-05-04 14:37:43 +05:00
|
|
|
float up[3] = {0, 1, 0};
|
|
|
|
float right[3] = {1, 0, 0};
|
|
|
|
float vel[3] = {0, 0, 0};
|
|
|
|
float speed = 0;
|
2023-05-03 15:57:59 +05:00
|
|
|
ObjectLoader obj;
|
2023-05-04 14:37:43 +05:00
|
|
|
bool key_states[6] = {false, false, false, false, false, false};
|
2023-05-02 13:02:56 +05:00
|
|
|
};
|