LibrePCB Developers Documentation
Loading...
Searching...
No Matches
OpenGlSceneBuilder Class Referencefinal

Asynchronously generates a 3D board scene for OpenGL rendering. More...

#include <openglscenebuilder.h>

Inherits QObject.

+ Collaboration diagram for OpenGlSceneBuilder:

Public Types

typedef std::tuple< qreal, qreal, qreal > Color
 
typedef QMap< Color, QVector< QVector3D > > StepModel
 

Signals

void started ()
 
void finished (QString errorMsg)
 
void objectAdded (std::shared_ptr< librepcb::editor::OpenGlObject > obj)
 
void objectRemoved (std::shared_ptr< librepcb::editor::OpenGlObject > obj)
 
void objectUpdated (std::shared_ptr< librepcb::editor::OpenGlObject > obj)
 

Public Member Functions

 OpenGlSceneBuilder (QObject *parent=nullptr) noexcept
 
 OpenGlSceneBuilder (const OpenGlSceneBuilder &other)=delete
 
 ~OpenGlSceneBuilder () noexcept
 
void start (std::shared_ptr< SceneData3D > data) noexcept
 Start building scene asynchronously.
 
bool isBusy () const noexcept
 Check if there is currently a build in progress.
 
void waitForFinished () noexcept
 Wait (block) until the build is finished.
 
void cancel () noexcept
 Cancel the build.
 
OpenGlSceneBuilderoperator= (const OpenGlSceneBuilder &rhs)=delete
 

Private Member Functions

void run (std::shared_ptr< SceneData3D > data) noexcept
 
ClipperLib::Paths getPaths (const std::shared_ptr< SceneData3D > &data, const QStringList layers) const
 
QVector< QVector3D > extrude (const ClipperLib::Paths &paths, qreal z, qreal height, qreal scaleFactor, bool faces=true, bool edges=true, bool closed=true) const
 
void publishTriangleData (const QString &id, const QColor &color, const QVector< QVector3D > &triangles)
 
void publishDevice (const SceneData3D::DeviceData &obj, const QByteArray &stepContent, qreal z, qreal scaleFactor, qreal alpha)
 

Static Private Member Functions

static QVector< QVector3D > tesselate (const ClipperLib::Path &path, qreal z, qreal scaleFactor)
 

Private Attributes

const PositiveLength mMaxArcTolerance
 
QFuture< void > mFuture
 
bool mAbort
 
QHash< QString, std::shared_ptr< OpenGlTriangleObject > > mBoardObjects
 
QHash< Uuid, QMap< Color, std::shared_ptr< OpenGlTriangleObject > > > mDevices
 
QHash< QByteArray, StepModelmStepModels
 Cache.
 

Detailed Description

Asynchronously generates a 3D board scene for OpenGL rendering.

Member Typedef Documentation

◆ Color

typedef std::tuple<qreal, qreal, qreal> Color

◆ StepModel

typedef QMap<Color, QVector<QVector3D> > StepModel

Constructor & Destructor Documentation

◆ OpenGlSceneBuilder() [1/2]

OpenGlSceneBuilder ( QObject *  parent = nullptr)
noexcept

◆ OpenGlSceneBuilder() [2/2]

OpenGlSceneBuilder ( const OpenGlSceneBuilder other)
delete

◆ ~OpenGlSceneBuilder()

~OpenGlSceneBuilder ( )
noexcept
+ Here is the call graph for this function:

Member Function Documentation

◆ start()

void start ( std::shared_ptr< SceneData3D data)
noexcept

Start building scene asynchronously.

+ Here is the call graph for this function:

◆ isBusy()

bool isBusy ( ) const
noexcept

Check if there is currently a build in progress.

Return values
trueBuild in progress.
falseIdle.

◆ waitForFinished()

void waitForFinished ( )
noexcept

Wait (block) until the build is finished.

◆ cancel()

void cancel ( )
noexcept

Cancel the build.

+ Here is the caller graph for this function:

◆ operator=()

OpenGlSceneBuilder & operator= ( const OpenGlSceneBuilder rhs)
delete

◆ started

void started ( )
signal
+ Here is the caller graph for this function:

◆ finished

void finished ( QString  errorMsg)
signal
+ Here is the caller graph for this function:

◆ objectAdded

void objectAdded ( std::shared_ptr< librepcb::editor::OpenGlObject obj)
signal
+ Here is the caller graph for this function:

◆ objectRemoved

void objectRemoved ( std::shared_ptr< librepcb::editor::OpenGlObject obj)
signal
+ Here is the caller graph for this function:

◆ objectUpdated

void objectUpdated ( std::shared_ptr< librepcb::editor::OpenGlObject obj)
signal
+ Here is the caller graph for this function:

◆ run()

void run ( std::shared_ptr< SceneData3D data)
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPaths()

ClipperLib::Paths getPaths ( const std::shared_ptr< SceneData3D > &  data,
const QStringList  layers 
) const
private
+ Here is the call graph for this function:

◆ extrude()

QVector< QVector3D > extrude ( const ClipperLib::Paths &  paths,
qreal  z,
qreal  height,
qreal  scaleFactor,
bool  faces = true,
bool  edges = true,
bool  closed = true 
) const
private
+ Here is the call graph for this function:

◆ tesselate()

QVector< QVector3D > tesselate ( const ClipperLib::Path &  path,
qreal  z,
qreal  scaleFactor 
)
staticprivate
+ Here is the caller graph for this function:

◆ publishTriangleData()

void publishTriangleData ( const QString &  id,
const QColor &  color,
const QVector< QVector3D > &  triangles 
)
private
+ Here is the call graph for this function:

◆ publishDevice()

void publishDevice ( const SceneData3D::DeviceData obj,
const QByteArray &  stepContent,
qreal  z,
qreal  scaleFactor,
qreal  alpha 
)
private
+ Here is the call graph for this function:

Member Data Documentation

◆ mMaxArcTolerance

const PositiveLength mMaxArcTolerance
private

◆ mFuture

QFuture<void> mFuture
private

◆ mAbort

bool mAbort
private

◆ mBoardObjects

QHash<QString, std::shared_ptr<OpenGlTriangleObject> > mBoardObjects
private

◆ mDevices

QHash<Uuid, QMap<Color, std::shared_ptr<OpenGlTriangleObject> > > mDevices
private

◆ mStepModels

QHash<QByteArray, StepModel> mStepModels
private

Cache.


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