From 928d45c3fbfb6b00d8e0b79b63934ebd080b9456 Mon Sep 17 00:00:00 2001 From: ccolin Date: Sun, 3 Jan 2021 12:30:16 +0100 Subject: refactor drawing code --- src/opengl_widget.hh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/opengl_widget.hh') diff --git a/src/opengl_widget.hh b/src/opengl_widget.hh index 785a17f..1bc2bbc 100644 --- a/src/opengl_widget.hh +++ b/src/opengl_widget.hh @@ -13,6 +13,12 @@ #define FOV 70 +class Painter { +public: + virtual void draw(QOpenGLExtraFunctions *f) const = 0; +}; + + class OpenGLWidget : public QOpenGLWidget, public QOpenGLExtraFunctions { Q_OBJECT @@ -25,8 +31,12 @@ class OpenGLWidget : public QOpenGLWidget, public QOpenGLExtraFunctions { GLuint skybox_tex; GLuint skybox_vao; GLuint skybox_vbo; + OpenGLMesh *ground; void loadSkybox(); + void loadGround(); + + const Painter *painter = nullptr; protected: virtual void mousePressEvent(QMouseEvent *e); @@ -44,6 +54,8 @@ public: void initializeGL() override; void resizeGL(int w, int h) override; void paintGL() override; + void setPainter(const Painter *p); + QOpenGLShaderProgram *getMainProgram(); signals: void initialized(); -- cgit v1.2.3-70-g09d2