20 DocumentManager* documents, |
20 DocumentManager* documents, |
21 const ldraw::ColorTable& colorTable, |
21 const ldraw::ColorTable& colorTable, |
22 QWidget* parent = nullptr); |
22 QWidget* parent = nullptr); |
23 ~PartRenderer() override; |
23 ~PartRenderer() override; |
24 void setRenderPreferences(const gl::RenderPreferences& newPreferences); |
24 void setRenderPreferences(const gl::RenderPreferences& newPreferences); |
25 void setHighlight(ldraw::Id highlightedId); |
|
26 protected: |
25 protected: |
27 ldraw::Id pick(const QPoint& where); |
26 ldraw::Id pick(const QPoint& where); |
28 void initializeGL() override; |
27 void initializeGL() override; |
29 void resizeGL(int width, int height) override; |
28 void resizeGL(int width, int height) override; |
30 void paintGL() override; |
29 void paintGL() override; |
31 void mouseMoveEvent(QMouseEvent* event) override; |
30 void mouseMoveEvent(QMouseEvent* event) override; |
32 void wheelEvent(QWheelEvent* event) override; |
31 void wheelEvent(QWheelEvent* event) override; |
|
32 Model* const model; |
|
33 DocumentManager* const documents; |
|
34 const ldraw::ColorTable& colorTable; |
|
35 gl::Compiler* const compiler; |
|
36 ldraw::Id highlighted = ldraw::NULL_ID; |
33 private: |
37 private: |
34 void setFragmentStyle(gl::FragmentStyle fragStyle); |
38 void setFragmentStyle(gl::FragmentStyle fragStyle); |
35 void renderAllArrays(); |
39 void renderAllArrays(); |
36 void renderScene(); |
40 void renderScene(); |
37 void updateViewMatrix(); |
41 void updateViewMatrix(); |
38 Model* const model; |
|
39 DocumentManager* const documents; |
|
40 const ldraw::ColorTable& colorTable; |
|
41 QPointF lastMousePosition; |
42 QPointF lastMousePosition; |
42 gl::Compiler* compiler; |
|
43 gl::RenderPreferences renderPreferences; |
43 gl::RenderPreferences renderPreferences; |
44 glm::mat4 projectionMatrix; |
44 glm::mat4 projectionMatrix; |
45 glm::mat4 viewMatrix; |
45 glm::mat4 viewMatrix; |
46 glm::quat modelQuaternion; |
46 glm::quat modelQuaternion; |
47 ldraw::Id highlighted = ldraw::NULL_ID; |
|
48 static constexpr double MIN_ZOOM = 0.0; |
47 static constexpr double MIN_ZOOM = 0.0; |
49 static constexpr double MAX_ZOOM = 3.0; |
48 static constexpr double MAX_ZOOM = 3.0; |
50 double zoom = 1.0; |
49 double zoom = 1.0; |
51 bool initialized = false; |
50 bool initialized = false; |
52 void renderVao(const gl::ArrayClass arrayClass); |
51 void renderVao(const gl::ArrayClass arrayClass); |