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