20#ifndef LIBREPCB_EDITOR_OPENGLVIEW_H
21#define LIBREPCB_EDITOR_OPENGLVIEW_H
28#include <QtOpenGLWidgets>
40class WaitingSpinnerWidget;
49class OpenGlView final :
public QOpenGLWidget,
protected QOpenGLFunctions {
54 explicit OpenGlView(QWidget* parent =
nullptr)
noexcept;
62 void addObject(std::shared_ptr<OpenGlObject> obj)
noexcept;
63 void removeObject(std::shared_ptr<OpenGlObject> obj)
noexcept;
64 void setObjects(
const QVector<std::shared_ptr<OpenGlObject>>& objs)
noexcept;
78 void smoothTo(qreal fov, const QPointF& center,
79 const QMatrix4x4& transform) noexcept;
81 void resizeGL(
int w,
int h) override;
85 void zoom(const QPointF& center, qreal factor) noexcept;
87 QPointF
toModelPos(const QPointF& pos) const noexcept;
OpenGL 3D viewer widget.
Definition openglview.h:49
QVector< std::shared_ptr< OpenGlObject > > mObjects
Definition openglview.h:115
static constexpr qreal sCameraPosZ
Definition openglview.h:118
void zoomAll() noexcept
Definition openglview.cpp:136
QOpenGLShaderProgram mProgram
Definition openglview.h:93
OpenGlView(const OpenGlView &other)=delete
void resizeGL(int w, int h) override
Definition openglview.cpp:263
void setObjects(const QVector< std::shared_ptr< OpenGlObject > > &objs) noexcept
Definition openglview.cpp:122
void addObject(std::shared_ptr< OpenGlObject > obj) noexcept
Definition openglview.cpp:112
qreal mProjectionAspectRatio
Definition openglview.h:94
void removeObject(std::shared_ptr< OpenGlObject > obj) noexcept
Definition openglview.cpp:117
void mousePressEvent(QMouseEvent *e) override
Definition openglview.cpp:159
virtual ~OpenGlView() noexcept
Definition openglview.cpp:102
void mouseMoveEvent(QMouseEvent *e) override
Definition openglview.cpp:166
TransformData mAnimationDataDelta
Definition openglview.h:111
void zoomOut() noexcept
Definition openglview.cpp:132
QMatrix4x4 mTransform
Definition openglview.h:97
void paintGL() override
Definition openglview.cpp:267
void smoothTo(qreal fov, const QPointF ¢er, const QMatrix4x4 &transform) noexcept
Definition openglview.cpp:210
void wheelEvent(QWheelEvent *e) override
Definition openglview.cpp:203
void stopSpinning(QString errorMsg) noexcept
Definition openglview.cpp:145
bool mInitialized
Definition openglview.h:92
QMatrix4x4 mMousePressTransform
Definition openglview.h:99
qint64 mIdleTimeMs
Definition openglview.h:101
void zoomIn() noexcept
Definition openglview.cpp:128
QScopedPointer< WaitingSpinnerWidget > mWaitingSpinner
Definition openglview.h:102
QPoint mMousePressPosition
Definition openglview.h:98
void startSpinning() noexcept
Definition openglview.cpp:141
QScopedPointer< QLabel > mErrorLabel
Definition openglview.h:91
QScopedPointer< QVariantAnimation > mAnimation
Definition openglview.h:112
static constexpr qreal sZoomStepFactor
Definition openglview.h:120
void initializeGL() override
Definition openglview.cpp:229
QPointF mMousePressCenter
Definition openglview.h:100
QPointF mProjectionCenter
Definition openglview.h:96
QScopedPointer< QVBoxLayout > mLayout
Definition openglview.h:90
TransformData mAnimationDataStart
Definition openglview.h:110
qreal mProjectionFov
Definition openglview.h:95
qint64 getIdleTimeMs() const noexcept
Definition openglview.h:59
void zoom(const QPointF ¢er, qreal factor) noexcept
Definition openglview.cpp:300
QPointF toModelPos(const QPointF &pos) const noexcept
Definition openglview.cpp:319
QPointF toNormalizedPos(const QPointF &pos) const noexcept
Definition openglview.cpp:313
static constexpr qreal sInitialFov
Definition openglview.h:119
Definition occmodel.cpp:76