#ifndef __OGL_CAMERA_WIDGET_HEADER__ #define __OGL_CAMERA_WIDGET_HEADER__ #include "../guiClass.h" #include #include #include #include #include #include #include #include //class Bubble; class MainWindow; //QT_FORWARD_DECLARE_CLASS(QOpenGLTexture) //QT_FORWARD_DECLARE_CLASS(QOpenGLShader) //QT_FORWARD_DECLARE_CLASS(QOpenGLShaderProgram) class OglCameraWidget : public QOpenGLWidget, protected QOpenGLFunctions { //Q_OBJECT public: OglCameraWidget( QWidget *parent, bool button, const QColor &background ); ~OglCameraWidget(); public slots: void setScaling(int scale); void setLogo(); void setTexture(); void setShowBubbles(bool); void setTransparent(bool transparent); void setYaw(float Yaw){ m_fYaw = Yaw; }; void setPitch(float Pitch){ m_fPitch = Pitch; }; void setRoll(float Roll){ m_fRoll = Roll; }; private slots: void handleButtonPress(); void keyPressEvent(QKeyEvent *event); void mouseMoveEvent(QMouseEvent *event); void wheelEvent(QWheelEvent *event); protected: void resizeGL(int w, int h) Q_DECL_OVERRIDE; void paintGL() Q_DECL_OVERRIDE; void initializeGL() Q_DECL_OVERRIDE; private: void paintTexturedCube(); void paintQtLogo(); void createGeometry(); //void createBubbles(int number); void quad(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4); void extrude(qreal x1, qreal y1, qreal x2, qreal y2); QWidget *m_pParent; QPoint m_slastPos; qreal m_fYaw, m_fPitch, m_fRoll; qreal m_fScale; QVector m_vertices; QVector m_normals; bool m_qtLogo; int m_frames; QTime m_time; QOpenGLShader *m_vshader1; QOpenGLShader *m_fshader1; QOpenGLShader *m_vshader2; QOpenGLShader *m_fshader2; QOpenGLShaderProgram *m_program1; QOpenGLShaderProgram *m_program2; QOpenGLTexture *m_texture; QOpenGLBuffer m_vbo1; QOpenGLBuffer m_vbo2; int m_vertexAttr1; int m_normalAttr1; int m_matrixUniform1; int m_vertexAttr2; int m_normalAttr2; int m_texCoordAttr2; int m_matrixUniform2; int m_textureUniform2; bool m_transparent; QPushButton *m_btn; bool m_hasButton; QColor m_background; }; #endif