src/gl/partrenderer.h

changeset 200
ca23936b455b
parent 199
6988973515d2
child 201
5d201ee4a9c3
equal deleted inserted replaced
199:6988973515d2 200:ca23936b455b
1 #pragma once 1 #pragma once
2 #include <QOpenGLWidget> 2 #include <QOpenGLWidget>
3 #include <QOpenGLFunctions>
4 #include <QQuaternion>
5 #include <QOpenGLVertexArrayObject>
6 #include <QOpenGLBuffer>
7 #include <QOpenGLShader>
8 #include <QOpenGLShaderProgram>
9 #include <glm/glm.hpp>
10 #include "main.h" 3 #include "main.h"
11 #include "gl/common.h" 4 #include "gl/common.h"
12 #include "gl/compiler.h" 5 #include "gl/compiler.h"
6 #include "documentmanager.h"
7 #include "types/boundingbox.h"
13 8
14 class PartRenderer : public QOpenGLWidget 9 class PartRenderer : public QOpenGLWidget
15 { 10 {
16 Q_OBJECT 11 Q_OBJECT
17 public: 12 public:
20 DocumentManager* documents, 15 DocumentManager* documents,
21 const ldraw::ColorTable& colorTable, 16 const ldraw::ColorTable& colorTable,
22 QWidget* parent = nullptr); 17 QWidget* parent = nullptr);
23 ~PartRenderer() override; 18 ~PartRenderer() override;
24 void setRenderPreferences(const gl::RenderPreferences& newPreferences); 19 void setRenderPreferences(const gl::RenderPreferences& newPreferences);
25 ldraw::id_t getHighlightedObject() const; 20 ModelId getHighlightedObject() const;
26 protected: 21 protected:
27 ldraw::id_t pick(QPoint where); 22 ModelId pick(QPoint where);
28 void initializeGL() override; 23 void initializeGL() override;
29 void resizeGL(int width, int height) override; 24 void resizeGL(int width, int height) override;
30 void paintGL() override; 25 void paintGL() override;
31 void mouseMoveEvent(QMouseEvent* event) override; 26 void mouseMoveEvent(QMouseEvent* event) override;
32 void wheelEvent(QWheelEvent* event) override; 27 void wheelEvent(QWheelEvent* event) override;
33 Model* const model; 28 Model* const model;
34 DocumentManager* const documents; 29 DocumentManager* const documents;
35 const ldraw::ColorTable& colorTable; 30 const ldraw::ColorTable& colorTable;
36 BoundingBox boundingBox; 31 BoundingBox boundingBox;
37 gl::ModelShaders shaders; 32 gl::ModelShaders shaders;
38 ldraw::id_t highlighted = ldraw::NULL_ID; 33 ModelId highlighted = {0};
39 std::optional<glm::vec3> screenToModelCoordinates(const QPoint& point, const geom::Plane& plane) const; 34 std::optional<glm::vec3> screenToModelCoordinates(const QPoint& point, const geom::Plane& plane) const;
40 QPointF modelToScreenCoordinates(const glm::vec3& point) const; 35 QPointF modelToScreenCoordinates(const glm::vec3& point) const;
41 geom::Line<3> cameraLine(const QPoint& point) const; 36 geom::Line<3> cameraLine(const QPoint& point) const;
42 glm::vec3 unproject(const glm::vec3& win) const; 37 glm::vec3 unproject(const glm::vec3& win) const;
43 glm::mat4 projectionMatrix; 38 glm::mat4 projectionMatrix;

mercurial