src/gl/partrenderer.h

changeset 189
815fbaae9cb2
parent 120
8c9fff699241
child 199
6988973515d2
equal deleted inserted replaced
188:64ea7282611e 189:815fbaae9cb2
9 #include <glm/glm.hpp> 9 #include <glm/glm.hpp>
10 #include "main.h" 10 #include "main.h"
11 #include "gl/common.h" 11 #include "gl/common.h"
12 #include "gl/compiler.h" 12 #include "gl/compiler.h"
13 13
14 class PartRenderer : public QOpenGLWidget, protected QOpenGLFunctions 14 class PartRenderer : public QOpenGLWidget
15 { 15 {
16 Q_OBJECT 16 Q_OBJECT
17 public: 17 public:
18 PartRenderer( 18 PartRenderer(
19 Model* model, 19 Model* model,
31 void mouseMoveEvent(QMouseEvent* event) override; 31 void mouseMoveEvent(QMouseEvent* event) override;
32 void wheelEvent(QWheelEvent* event) override; 32 void wheelEvent(QWheelEvent* event) override;
33 Model* const model; 33 Model* const model;
34 DocumentManager* const documents; 34 DocumentManager* const documents;
35 const ldraw::ColorTable& colorTable; 35 const ldraw::ColorTable& colorTable;
36 gl::Compiler* const compiler; 36 BoundingBox boundingBox;
37 gl::ModelShaders shaders;
37 ldraw::id_t highlighted = ldraw::NULL_ID; 38 ldraw::id_t highlighted = ldraw::NULL_ID;
38 std::optional<glm::vec3> screenToModelCoordinates(const QPoint& point, const geom::Plane& plane) const; 39 std::optional<glm::vec3> screenToModelCoordinates(const QPoint& point, const geom::Plane& plane) const;
39 QPointF modelToScreenCoordinates(const glm::vec3& point) const; 40 QPointF modelToScreenCoordinates(const glm::vec3& point) const;
40 geom::Line<3> cameraLine(const QPoint& point) const; 41 geom::Line<3> cameraLine(const QPoint& point) const;
41 glm::vec3 unproject(const glm::vec3& win) const; 42 glm::vec3 unproject(const glm::vec3& win) const;
51 void modelMatrixChanged(const glm::mat4& newMatrix); 52 void modelMatrixChanged(const glm::mat4& newMatrix);
52 void viewMatrixChanged(const glm::mat4& newMatrix); 53 void viewMatrixChanged(const glm::mat4& newMatrix);
53 void renderPreferencesChanged(); 54 void renderPreferencesChanged();
54 private: 55 private:
55 void setFragmentStyle(gl::FragmentStyle fragStyle); 56 void setFragmentStyle(gl::FragmentStyle fragStyle);
56 void renderAllArrays();
57 void renderScene(); 57 void renderScene();
58 void updateViewMatrix(); 58 void updateViewMatrix();
59 void updateModelMatrix(); 59 void updateModelMatrix();
60 void setupBackgroundColor();
61 Q_SLOT void build(); 60 Q_SLOT void build();
62 double zoom = 1.0; 61 double zoom = 1.0;
63 bool initialized = false; 62 bool initialized = false;
64 bool needBuild = true; 63 bool needBuild = true;
65 void renderVao(const gl::ArrayClass arrayClass); 64 void renderVao(const gl::ArrayClass arrayClass);

mercurial