mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 22:11:36 +00:00
Implemented: Application icons; OpenSceneGraph to handle OpenGL with Qt; devicePixelRatio() for handing render on highDPI displays; Sample 3D with handler; MouseHandler not yet working as expected (WIP)
This commit is contained in:
@@ -6,18 +6,38 @@
|
||||
#include <QOpenGLContext>
|
||||
#include <QMatrix4x4>
|
||||
|
||||
#include <osg/ref_ptr>
|
||||
#include <osgViewer/GraphicsWindow>
|
||||
#include <osgViewer/Viewer>
|
||||
#include <osg/Group>
|
||||
|
||||
class IfcViewerWidget : public QOpenGLWidget
|
||||
{
|
||||
|
||||
public:
|
||||
IfcViewerWidget(QWidget *parent = nullptr);
|
||||
IfcViewerWidget(qreal dpiScale, QWidget *parent = nullptr);
|
||||
|
||||
protected:
|
||||
void initializeGL() override;
|
||||
void resizeGL(int w, int h) override;
|
||||
void paintGL() override;
|
||||
virtual void initializeGL() override; // to set up resources, state
|
||||
virtual void resizeGL(int w, int h) override; // to set up viewport, projection, etc.
|
||||
virtual void paintGL() override; // to render OpenGL scene
|
||||
|
||||
virtual void mousePressEvent(QMouseEvent *event) override;
|
||||
virtual void mouseMoveEvent(QMouseEvent *event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
virtual void wheelEvent(QWheelEvent *event) override;
|
||||
virtual bool event(QEvent* event) override;
|
||||
|
||||
private:
|
||||
qreal m_dpiScale;
|
||||
QMatrix4x4 m_projection;
|
||||
osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> m_graphicsWindow;
|
||||
osg::ref_ptr<osgViewer::Viewer> m_viewer;
|
||||
osg::ref_ptr<osg::Group> root; // OSG root node
|
||||
|
||||
osgGA::EventQueue* getEventQueue() const;
|
||||
unsigned int getMouseButtonNum(QMouseEvent* event);
|
||||
void buildSceneData();
|
||||
};
|
||||
|
||||
#endif // IFCVIEWERWIDGET_H
|
||||
#endif // IFCVIEWERWIDGET_H
|
||||
|
||||
Reference in New Issue
Block a user