LibrePCB Developers Documentation
OpenGlView Class Referencefinal

OpenGL 3D viewer widget. More...

#include <openglview.h>

Inherits QOpenGLWidget, and QOpenGLFunctions.

+ Collaboration diagram for OpenGlView:

Classes

struct  TransformData
 

Public Member Functions

 OpenGlView (QWidget *parent=nullptr) noexcept
 
 OpenGlView (const OpenGlView &other)=delete
 
virtual ~OpenGlView () noexcept
 
qint64 getIdleTimeMs () const noexcept
 
void addObject (std::shared_ptr< OpenGlObject > obj) noexcept
 
void removeObject (std::shared_ptr< OpenGlObject > obj) noexcept
 
void setObjects (const QVector< std::shared_ptr< OpenGlObject >> &objs) noexcept
 
void zoomIn () noexcept
 
void zoomOut () noexcept
 
void zoomAll () noexcept
 
void startSpinning () noexcept
 
void stopSpinning (QString errorMsg) noexcept
 
OpenGlViewoperator= (const OpenGlView &rhs)=delete
 

Protected Member Functions

void mousePressEvent (QMouseEvent *e) override
 
void mouseMoveEvent (QMouseEvent *e) override
 
void wheelEvent (QWheelEvent *e) override
 
void smoothTo (qreal fov, const QPointF &center, const QMatrix4x4 &transform) noexcept
 
void initializeGL () override
 
void resizeGL (int w, int h) override
 
void paintGL () override
 

Private Member Functions

void zoom (const QPointF &center, qreal factor) noexcept
 
QPointF toNormalizedPos (const QPointF &pos) const noexcept
 
QPointF toModelPos (const QPointF &pos) const noexcept
 

Private Attributes

QScopedPointer< QVBoxLayout > mLayout
 
QScopedPointer< QLabel > mErrorLabel
 
bool mInitialized
 
QOpenGLShaderProgram mProgram
 
qreal mProjectionAspectRatio
 
qreal mProjectionFov
 
QPointF mProjectionCenter
 
QMatrix4x4 mTransform
 
QPoint mMousePressPosition
 
QMatrix4x4 mMousePressTransform
 
QPointF mMousePressCenter
 
qint64 mIdleTimeMs
 
QScopedPointer< WaitingSpinnerWidgetmWaitingSpinner
 
TransformData mAnimationDataStart
 
TransformData mAnimationDataDelta
 
QScopedPointer< QVariantAnimation > mAnimation
 
QVector< std::shared_ptr< OpenGlObject > > mObjects
 

Static Private Attributes

static constexpr qreal sCameraPosZ = 5.0
 
static constexpr qreal sInitialFov = 15.0
 
static constexpr qreal sZoomStepFactor = 1.3
 

Detailed Description

OpenGL 3D viewer widget.

Constructor & Destructor Documentation

◆ OpenGlView() [1/2]

OpenGlView ( QWidget *  parent = nullptr)
explicitnoexcept

◆ OpenGlView() [2/2]

OpenGlView ( const OpenGlView other)
delete

◆ ~OpenGlView()

~OpenGlView ( )
virtualnoexcept

Member Function Documentation

◆ getIdleTimeMs()

qint64 getIdleTimeMs ( ) const
inlinenoexcept
+ Here is the call graph for this function:

◆ addObject()

void addObject ( std::shared_ptr< OpenGlObject obj)
noexcept
+ Here is the caller graph for this function:

◆ removeObject()

void removeObject ( std::shared_ptr< OpenGlObject obj)
noexcept
+ Here is the caller graph for this function:

◆ setObjects()

void setObjects ( const QVector< std::shared_ptr< OpenGlObject >> &  objs)
noexcept
+ Here is the caller graph for this function:

◆ zoomIn()

void zoomIn ( )
noexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ zoomOut()

void zoomOut ( )
noexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ zoomAll()

void zoomAll ( )
noexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ startSpinning()

void startSpinning ( )
noexcept
+ Here is the caller graph for this function:

◆ stopSpinning()

void stopSpinning ( QString  errorMsg)
noexcept
+ Here is the caller graph for this function:

◆ operator=()

OpenGlView& operator= ( const OpenGlView rhs)
delete
+ Here is the caller graph for this function:

◆ mousePressEvent()

void mousePressEvent ( QMouseEvent *  e)
overrideprotected
+ Here is the caller graph for this function:

◆ mouseMoveEvent()

void mouseMoveEvent ( QMouseEvent *  e)
overrideprotected
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wheelEvent()

void wheelEvent ( QWheelEvent *  e)
overrideprotected
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ smoothTo()

void smoothTo ( qreal  fov,
const QPointF &  center,
const QMatrix4x4 &  transform 
)
protectednoexcept
+ Here is the caller graph for this function:

◆ initializeGL()

void initializeGL ( )
overrideprotected
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resizeGL()

void resizeGL ( int  w,
int  h 
)
overrideprotected
+ Here is the caller graph for this function:

◆ paintGL()

void paintGL ( )
overrideprotected
+ Here is the caller graph for this function:

◆ zoom()

void zoom ( const QPointF &  center,
qreal  factor 
)
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toNormalizedPos()

QPointF toNormalizedPos ( const QPointF &  pos) const
privatenoexcept
+ Here is the caller graph for this function:

◆ toModelPos()

QPointF toModelPos ( const QPointF &  pos) const
privatenoexcept
+ Here is the caller graph for this function:

Member Data Documentation

◆ mLayout

QScopedPointer<QVBoxLayout> mLayout
private

◆ mErrorLabel

QScopedPointer<QLabel> mErrorLabel
private

◆ mInitialized

bool mInitialized
private

◆ mProgram

QOpenGLShaderProgram mProgram
private

◆ mProjectionAspectRatio

qreal mProjectionAspectRatio
private

◆ mProjectionFov

qreal mProjectionFov
private

◆ mProjectionCenter

QPointF mProjectionCenter
private

◆ mTransform

QMatrix4x4 mTransform
private

◆ mMousePressPosition

QPoint mMousePressPosition
private

◆ mMousePressTransform

QMatrix4x4 mMousePressTransform
private

◆ mMousePressCenter

QPointF mMousePressCenter
private

◆ mIdleTimeMs

qint64 mIdleTimeMs
private

◆ mWaitingSpinner

QScopedPointer<WaitingSpinnerWidget> mWaitingSpinner
private

◆ mAnimationDataStart

TransformData mAnimationDataStart
private

◆ mAnimationDataDelta

TransformData mAnimationDataDelta
private

◆ mAnimation

QScopedPointer<QVariantAnimation> mAnimation
private

◆ mObjects

QVector<std::shared_ptr<OpenGlObject> > mObjects
private

◆ sCameraPosZ

constexpr qreal sCameraPosZ = 5.0
staticprivate

◆ sInitialFov

constexpr qreal sInitialFov = 15.0
staticprivate

◆ sZoomStepFactor

constexpr qreal sZoomStepFactor = 1.3
staticprivate

The documentation for this class was generated from the following files: