Sun, 26 Jan 2020 01:06:27 +0200
fix default angle
#pragma once #include <QOpenGLWidget> #include <QOpenGLFunctions> #include <QQuaternion> #include <QOpenGLVertexArrayObject> #include <QOpenGLBuffer> #include <QOpenGLShader> #include <QOpenGLShaderProgram> #include <glm/glm.hpp> #include "main.h" #include "gl/common.h" #include "gl/compiler.h" class PartRenderer : public QOpenGLWidget, protected QOpenGLFunctions { Q_OBJECT public: PartRenderer(Model* model, DocumentManager* documents, const ColorTable& colorTable, QWidget* parent = nullptr); ~PartRenderer() override; protected: void initializeGL() override; void resizeGL(int width, int height) override; void paintGL() override; void mouseMoveEvent(QMouseEvent* event) override; void wheelEvent(QWheelEvent* event) override; private slots: void setRenderStyle(const gl::RenderStyle newStyle); private: void renderScene(); void updateViewMatrix(); Model* const model; DocumentManager* const documents; const ColorTable& colorTable; QPointF lastMousePosition; gl::Compiler* compiler; gl::RenderStyle renderStyle = gl::RenderStyle::Normal; glm::mat4 projectionMatrix; glm::mat4 viewMatrix; glm::quat modelQuaternion; static constexpr double MIN_ZOOM = 0.0; static constexpr double MAX_ZOOM = 3.0; double zoom = 1.0; bool initialized = false; void initializeLighting(); void renderVao(const gl::ArrayClass arrayClass); void checkForGLErrors(); glm::mat4 modelMatrix() const; };