79 QVector3D from3DTo2DLabelPosition(
const QVector3D &sourcePos, Qt3DRender::QCamera *sourceCamera, Qt3DRender::QCamera *destCamera );
85 void onAxisSettingsChanged( );
89 void onCameraUpdate( );
90 void onAxisViewportSizeUpdate(
int val = 0 );
93 void onTouchedByRay(
const Qt3DRender::QAbstractRayCaster::Hits &hits );
96 void onAxisHorizPositionChanged( Qt::AnchorPoint pos );
97 void onAxisVertPositionChanged( Qt::AnchorPoint pos );
98 void onCameraViewChange(
float pitch,
float yaw );
100 void onCameraViewChangeHome() { onCameraViewChange( 45.0f, 45.0f ); }
101 void onCameraViewChangeTop() { onCameraViewChange( 0.0f, 90.0f ); }
102 void onCameraViewChangeNorth() { onCameraViewChange( 90.0f, 180.0f ); }
103 void onCameraViewChangeEast() { onCameraViewChange( 90.0f, 90.0f ); }
104 void onCameraViewChangeSouth() { onCameraViewChange( 90.0f, 0.0f ); }
105 void onCameraViewChangeWest() { onCameraViewChange( 90.0f, -90.0f ); }
106 void onCameraViewChangeBottom() { onCameraViewChange( 180.0f, 0.0f ); }
110 void createAxisScene();
111 void createAxis( Qt::Axis axis );
113 void setEnableCube(
bool show );
114 void setEnableAxis(
bool show );
115 void updateAxisLabelPosition();
116 void updateAxisLabelText( Qt3DExtras::QText2DEntity *textEntity,
const QString &text );
117 QFont createFont(
int pointSize );
119 Qt3DRender::QViewport *constructAxisScene( Qt3DCore::QEntity *parent3DScene );
120 void constructLabelsScene( Qt3DCore::QEntity *parent3DScene );
122 Qt3DExtras::QText2DEntity *addCubeText(
const QString &text,
float textHeight,
float textWidth,
const QFont &font,
const QMatrix4x4 &rotation,
const QVector3D &translation );
125 void init3DObjectPicking( );
126 bool eventFilter( QObject *watched, QEvent *event )
override;
127 void createKeyboardShortCut();
130 void displayMenuAt(
const QPoint &position );
137 float mCylinderLength = 40.0f;
140 Qt3DRender::QViewport *mViewport =
nullptr;
142 Qt3DCore::QEntity *mAxisSceneEntity =
nullptr;
143 Qt3DRender::QLayer *mAxisObjectLayer =
nullptr;
144 Qt3DRender::QCamera *mAxisCamera =
nullptr;
146 Qt3DCore::QEntity *mAxisRoot =
nullptr;
147 Qt3DCore::QEntity *mCubeRoot =
nullptr;
148 QList<Qt3DExtras::QText2DEntity *> mCubeLabels;
150 Qt3DExtras::QText2DEntity *mTextX =
nullptr;
151 Qt3DExtras::QText2DEntity *mTextY =
nullptr;
152 Qt3DExtras::QText2DEntity *mTextZ =
nullptr;
153 QVector3D mTextCoordX;
154 QVector3D mTextCoordY;
155 QVector3D mTextCoordZ;
156 Qt3DCore::QTransform *mTextTransformX =
nullptr;
157 Qt3DCore::QTransform *mTextTransformY =
nullptr;
158 Qt3DCore::QTransform *mTextTransformZ =
nullptr;
160 QVector3D mPreviousVector;
161 double mAxisScaleFactor = 1.0;
163 Qt3DRender::QCamera *mTwoDLabelCamera =
nullptr;
164 Qt3DCore::QEntity *mTwoDLabelSceneEntity =
nullptr;
167 Qt3DRender::QScreenRayCaster *mScreenRayCaster =
nullptr;
168 bool mIsDragging =
false;
169 bool mHasClicked =
false;
170 QPoint mLastClickedPos;
171 Qt::MouseButton mLastClickedButton;
172 QCursor mPreviousCursor = Qt::ArrowCursor;
173 Qt3DRender::QPickingSettings::PickMethod mDefaultPickingMethod;
174 QMenu *mMenu =
nullptr;