87 lines
2.2 KiB
C++
87 lines
2.2 KiB
C++
#ifndef BACKPLOTWIDGET_H
|
|
#define BACKPLOTWIDGET_H
|
|
|
|
#include <QWidget>
|
|
|
|
#include <Qt3DExtras/qtorusmesh.h>
|
|
#include <Qt3DRender/qmesh.h>
|
|
#include <Qt3DRender/qtechnique.h>
|
|
#include <Qt3DRender/qmaterial.h>
|
|
#include <Qt3DRender/qeffect.h>
|
|
#include <Qt3DRender/qtexture.h>
|
|
#include <Qt3DRender/qrenderpass.h>
|
|
#include <Qt3DRender/qsceneloader.h>
|
|
|
|
#include <Qt3DCore/qtransform.h>
|
|
#include <Qt3DCore/qaspectengine.h>
|
|
|
|
#include <Qt3DRender/qrenderaspect.h>
|
|
#include <Qt3DExtras/qforwardrenderer.h>
|
|
|
|
#include <Qt3DExtras/qt3dwindow.h>
|
|
#include <QHBoxLayout>
|
|
#include <QPhongMaterial>
|
|
|
|
#include "orbitcameracontroller.h"
|
|
|
|
class BackPlotWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
Qt3DExtras::Qt3DWindow view;
|
|
OrbitCameraController *camController;
|
|
Qt3DCore::QEntity* rootEntity = nullptr;
|
|
Qt3DExtras::QPhongMaterial* axisMaterial;
|
|
Qt3DExtras::QPhongMaterial* rapidMaterial;
|
|
Qt3DExtras::QPhongMaterial* pathMaterial;
|
|
QWidget *containerWdiget;
|
|
|
|
Qt3DCore::QEntity* toolEntity;
|
|
Qt3DCore::QTransform *toolTransform;
|
|
std::vector<Qt3DCore::QEntity*> pathEntitys;
|
|
|
|
Qt3DCore::QTransform *touchoffTransform;
|
|
|
|
QVector3D limits;
|
|
QVector3D touchoffPosition;
|
|
|
|
QHBoxLayout hLayout;
|
|
|
|
static constexpr int NO_FIELD = std::numeric_limits<int>::min();
|
|
|
|
public:
|
|
|
|
typedef int ViewPos;
|
|
static constexpr ViewPos VIEW_TOP = 0;
|
|
static constexpr ViewPos VIEW_FRONT = 1;
|
|
static constexpr ViewPos VIEW_LEFT = 2;
|
|
static constexpr ViewPos VIEW_RIGHT = 3;
|
|
|
|
private:
|
|
|
|
static void drawBox(const QVector3D& bottomCloseLeft, const QVector3D& topFarRight, Qt3DRender::QMaterial* material, Qt3DCore::QEntity* parent);
|
|
static void drawLine(const QVector3D& start, const QVector3D& end, Qt3DRender::QMaterial* material, Qt3DCore::QEntity* parent);
|
|
static QList<int> getFields(QByteArray command);
|
|
QByteArray removeComments(const QByteArray& program);
|
|
|
|
void reset();
|
|
|
|
protected:
|
|
virtual void resizeEvent(QResizeEvent *event) override;
|
|
|
|
public slots:
|
|
void positionUpdate(std::vector<int> position);
|
|
void touchoffUpdate(std::vector<int> position);
|
|
void programChanged(const QByteArray program);
|
|
void showView(ViewPos view);
|
|
|
|
public:
|
|
explicit BackPlotWidget(QWidget *parent = nullptr, double xLimits = 190, double yLimits = 92, double zLimits = 85);
|
|
|
|
signals:
|
|
|
|
};
|
|
|
|
#endif // BACKPLOTWIDGET_H
|
|
|