81 QVector3D from3DTo2DLabelPosition(
const QVector3D &sourcePos,
82 Qt3DRender::QCamera *sourceCamera, Qt3DRender::QViewport *sourceViewport,
83 Qt3DRender::QCamera *destCamera, Qt3DRender::QViewport *destViewport,
84 const QSize &destSize );
89 void onAxisSettingsChanged( );
93 void onCameraUpdate( );
94 void onAxisViewportSizeUpdate(
int val = 0 );
97 void onTouchedByRay(
const Qt3DRender::QAbstractRayCaster::Hits &hits );
100 void onAxisHorizPositionChanged( Qt::AnchorPoint pos );
101 void onAxisVertPositionChanged( Qt::AnchorPoint pos );
102 void onCameraViewChange(
float pitch,
float yaw );
104 void onCameraViewChangeHome() { onCameraViewChange( 45.0f, 45.0f ); }
105 void onCameraViewChangeTop() { onCameraViewChange( 0.0f, 90.0f ); }
106 void onCameraViewChangeNorth() { onCameraViewChange( 90.0f, 180.0f ); }
107 void onCameraViewChangeEast() { onCameraViewChange( 90.0f, 90.0f ); }
108 void onCameraViewChangeSouth() { onCameraViewChange( 90.0f, 0.0f ); }
109 void onCameraViewChangeWest() { onCameraViewChange( 90.0f, -90.0f ); }
110 void onCameraViewChangeBottom() { onCameraViewChange( 180.0f, 0.0f ); }
112 void onTextXChanged(
const QString &text );
113 void onTextYChanged(
const QString &text );
114 void onTextZChanged(
const QString &text );
118 void createAxisScene();
119 void createAxis( Qt::Axis axis );
121 void setEnableCube(
bool show );
122 void setEnableAxis(
bool show );
123 void updateAxisLabelPosition();
125 Qt3DRender::QViewport *constructAxisViewport( Qt3DCore::QEntity *parent3DScene );
126 Qt3DRender::QViewport *constructLabelViewport( Qt3DCore::QEntity *parent3DScene,
const QRectF &parentViewportSize );
128 Qt3DExtras::QText2DEntity *addCubeText(
const QString &text,
float textHeight,
float textWidth,
const QFont &f,
const QMatrix4x4 &rotation,
const QVector3D &translation );
131 void init3DObjectPicking( );
132 bool eventFilter( QObject *watched, QEvent *event )
override;
133 void createKeyboardShortCut();
136 void displayMenuAt(
const QPoint &position );
143 float mCylinderLength = 40.0f;
146 Qt3DCore::QEntity *mAxisSceneEntity =
nullptr;
147 Qt3DRender::QLayer *mAxisSceneLayer =
nullptr;
148 Qt3DRender::QCamera *mAxisCamera =
nullptr;
149 Qt3DRender::QViewport *mAxisViewport =
nullptr;
151 Qt3DCore::QEntity *mAxisRoot =
nullptr;
152 Qt3DCore::QEntity *mCubeRoot =
nullptr;
153 QList<Qt3DExtras::QText2DEntity *> mCubeLabels;
155 Qt3DExtras::QText2DEntity *mTextX =
nullptr;
156 Qt3DExtras::QText2DEntity *mTextY =
nullptr;
157 Qt3DExtras::QText2DEntity *mTextZ =
nullptr;
158 QVector3D mTextCoordX;
159 QVector3D mTextCoordY;
160 QVector3D mTextCoordZ;
161 Qt3DCore::QTransform *mTextTransformX =
nullptr;
162 Qt3DCore::QTransform *mTextTransformY =
nullptr;
163 Qt3DCore::QTransform *mTextTransformZ =
nullptr;
165 QVector3D mPreviousVector;
166 double mAxisScaleFactor = 1.0;
168 Qt3DRender::QCamera *mTwoDLabelCamera =
nullptr;
169 Qt3DCore::QEntity *mTwoDLabelSceneEntity =
nullptr;
170 Qt3DRender::QViewport *mTwoDLabelViewport =
nullptr;
173 Qt3DRender::QScreenRayCaster *mScreenRayCaster =
nullptr;
174 bool mIsDragging =
false;
175 bool mHasClicked =
false;
176 QPoint mLastClickedPos;
177 Qt::MouseButton mLastClickedButton;
178 QCursor mPreviousCursor = Qt::ArrowCursor;
179 QMenu *mMenu =
nullptr;