-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglwidget.h
More file actions
executable file
·93 lines (83 loc) · 2.51 KB
/
Copy pathglwidget.h
File metadata and controls
executable file
·93 lines (83 loc) · 2.51 KB
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
#ifndef GLWIDGET_H
#define GLWIDGET_H
#include <QGLWidget>
#include <QTimer>
#include <QTime>
#include <QFont>
#include "camera.h"
#include "obj.h"
#include "particles/particleemitter.h"
#include "particles/rain.h"
class QGLShaderProgram;
class QGLFramebufferObject;
class GLWidget : public QGLWidget
{
Q_OBJECT
public:
GLWidget(QWidget *parent = 0);
~GLWidget();
void updateCamera();
public slots:
void fileOpen();
void toggleRotate();
void toggleVboDraw();
protected:
void initializeGL();
void renderScene(int width, int height);
void paintGL();
void resizeGL(int width, int height);
void paintText();
void wheelEvent(QWheelEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void applyPerspectiveCamera(float width, float height);
void addObjects();
void renderTexturedQuad(int width, int height);
void applyOrthogonalCamera(float width, float height);
Vector3 m_cameraTarget;
protected slots:
void tick();
private:
//camera m_camera;
OrbitCamera m_camera;
Vector2 m_prevMousePos;
QTimer m_timer;
QTime m_clock;
GLuint m_skybox;
GLuint m_cubeMap;
float m_fps;
float m_prevFps;
float m_increment;
float m_prevTime;
void loadCubeMap();
QList<QFile *> m_fileList;
void createSobelKernel(GLfloat* kernel, GLfloat* offsets);
QHash<QString, QGLShaderProgram *> m_shaderPrograms; // hash map of all shader programs
QHash<QString, QGLFramebufferObject *> m_framebufferObjects; // hash map of all framebuffer objects
QGLShaderProgram * newShaderProgram(const QGLContext *context, QString vertShader, QString fragShader);
QGLShaderProgram * newFragShaderProgram(const QGLContext *context, QString fragShader);
void renderGround();
void createFramebufferObjects(int width, int height);
void createShaderPrograms();
OBJ m_obj;
QVector<OBJ> objects; //NEW added for scene
int m_numObjs; //NEW added for scene
QFont m_font;
QString m_defaultModel;
bool m_captureMouse;
bool m_shouldRotate;
bool m_useVbo;
unsigned int m_numTrees;
float m_treeRadius;
ParticleEmitter m_fire;
Rain m_rain;
GLuint groundTex;
QVector<float> m_treeAngles;
QVector<float> m_treeSizes;
GLuint loadTexture(const QString &filename);
GLuint m_groundID;
QImage m_groundTexture;
void bindGroundTexture();
void releaseGroundTexture();
};
#endif // GLWIDGET_H