20#ifndef LIBREPCB_EDITOR_OPENGLVIEW_H
21#define LIBREPCB_EDITOR_OPENGLVIEW_H
30#if QT_VERSION_MAJOR >= 6
31#include <QtOpenGLWidgets>
43class WaitingSpinnerWidget;
52class OpenGlView final :
public QOpenGLWidget,
protected QOpenGLFunctions {
57 explicit OpenGlView(QWidget* parent =
nullptr)
noexcept;
65 void addObject(std::shared_ptr<OpenGlObject> obj)
noexcept;
66 void removeObject(std::shared_ptr<OpenGlObject> obj)
noexcept;
67 void setObjects(
const QVector<std::shared_ptr<OpenGlObject>>& objs)
noexcept;
81 void smoothTo(qreal fov, const QPointF& center,
82 const QMatrix4x4& transform) noexcept;
84 void resizeGL(
int w,
int h) override;
88 void zoom(const QPointF& center, qreal factor) noexcept;
90 QPointF
toModelPos(const QPointF& pos) const noexcept;
OpenGL 3D viewer widget.
Definition: openglview.h:52
QVector< std::shared_ptr< OpenGlObject > > mObjects
Definition: openglview.h:118
static constexpr qreal sCameraPosZ
Definition: openglview.h:121
void zoomAll() noexcept
Definition: openglview.cpp:137
QOpenGLShaderProgram mProgram
Definition: openglview.h:96
OpenGlView(const OpenGlView &other)=delete
void resizeGL(int w, int h) override
Definition: openglview.cpp:269
void setObjects(const QVector< std::shared_ptr< OpenGlObject > > &objs) noexcept
Definition: openglview.cpp:123
void addObject(std::shared_ptr< OpenGlObject > obj) noexcept
Definition: openglview.cpp:113
qreal mProjectionAspectRatio
Definition: openglview.h:97
void removeObject(std::shared_ptr< OpenGlObject > obj) noexcept
Definition: openglview.cpp:118
void mousePressEvent(QMouseEvent *e) override
Definition: openglview.cpp:160
virtual ~OpenGlView() noexcept
Definition: openglview.cpp:103
void mouseMoveEvent(QMouseEvent *e) override
Definition: openglview.cpp:167
TransformData mAnimationDataDelta
Definition: openglview.h:114
void zoomOut() noexcept
Definition: openglview.cpp:133
QMatrix4x4 mTransform
Definition: openglview.h:100
void paintGL() override
Definition: openglview.cpp:273
OpenGlView(QWidget *parent=nullptr) noexcept
Definition: openglview.cpp:59
void smoothTo(qreal fov, const QPointF ¢er, const QMatrix4x4 &transform) noexcept
Definition: openglview.cpp:216
void wheelEvent(QWheelEvent *e) override
Definition: openglview.cpp:204
void stopSpinning(QString errorMsg) noexcept
Definition: openglview.cpp:146
bool mInitialized
Definition: openglview.h:95
QMatrix4x4 mMousePressTransform
Definition: openglview.h:102
qint64 mIdleTimeMs
Definition: openglview.h:104
void zoomIn() noexcept
Definition: openglview.cpp:129
QScopedPointer< WaitingSpinnerWidget > mWaitingSpinner
Definition: openglview.h:105
QPoint mMousePressPosition
Definition: openglview.h:101
void startSpinning() noexcept
Definition: openglview.cpp:142
QScopedPointer< QLabel > mErrorLabel
Definition: openglview.h:94
QScopedPointer< QVariantAnimation > mAnimation
Definition: openglview.h:115
static constexpr qreal sZoomStepFactor
Definition: openglview.h:123
void initializeGL() override
Definition: openglview.cpp:235
QPointF mMousePressCenter
Definition: openglview.h:103
QPointF mProjectionCenter
Definition: openglview.h:99
QScopedPointer< QVBoxLayout > mLayout
Definition: openglview.h:93
TransformData mAnimationDataStart
Definition: openglview.h:113
qreal mProjectionFov
Definition: openglview.h:98
qint64 getIdleTimeMs() const noexcept
Definition: openglview.h:62
void zoom(const QPointF ¢er, qreal factor) noexcept
Definition: openglview.cpp:301
QPointF toModelPos(const QPointF &pos) const noexcept
Definition: openglview.cpp:320
QPointF toNormalizedPos(const QPointF &pos) const noexcept
Definition: openglview.cpp:314
static constexpr qreal sInitialFov
Definition: openglview.h:122
Definition: occmodel.cpp:77