src/gl/partrenderer.h

Sat, 14 Dec 2019 22:36:06 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Sat, 14 Dec 2019 22:36:06 +0200
changeset 19
ed9685f44ab3
parent 18
918b6c0f8b5b
child 21
0133e565e072
permissions
-rw-r--r--

added missing files

17
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 #pragma once
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 #include <QOpenGLWidget>
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3 #include <QOpenGLFunctions>
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4 #include <QQuaternion>
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
5 #include "main.h"
18
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
6 #include "gl/common.h"
17
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8 class PartRenderer : public QOpenGLWidget, protected QOpenGLFunctions
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9 {
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
10 public:
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
11 PartRenderer(QWidget* parent = nullptr);
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
12 protected:
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13 void initializeGL() override;
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 void resizeGL(int width, int height) override;
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
15 void paintGL() override;
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
16 void mouseMoveEvent(QMouseEvent* event) override;
18
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
17 private slots:
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
18 void setRenderStyle(const gl::RenderStyle newStyle);
17
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
19 private:
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 QPointF lastMousePosition;
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
21 bool initialized = false;
18
Teemu Piippo <teemu@hecknology.net>
parents: 17
diff changeset
22 gl::RenderStyle renderStyle = gl::RenderStyle::Normal;
17
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
23 QQuaternion rotation;
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
24 void initializeLighting();
a5111f4e6412 added teapot rendering
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
25 };

mercurial