73 Qgs3DAxis( Qt3DExtras::Qt3DWindow *parentWindow, Qt3DCore::QEntity *parent3DScene,
88 QVector3D from3DTo2DLabelPosition(
const QVector3D &sourcePos,
89 Qt3DRender::QCamera *sourceCamera, Qt3DRender::QViewport *sourceViewport,
90 Qt3DRender::QCamera *destCamera, Qt3DRender::QViewport *destViewport,
91 const QSize &destSize );
96 void onAxisSettingsChanged( );
100 void onCameraUpdate( );
101 void onAxisViewportSizeUpdate(
int val = 0 );
104 void onTouchedByRay(
const Qt3DRender::QAbstractRayCaster::Hits &hits );
107 void onAxisHorizPositionChanged( Qt::AnchorPoint pos );
108 void onAxisVertPositionChanged( Qt::AnchorPoint pos );
109 void onCameraViewChange(
float pitch,
float yaw );
111 void onCameraViewChangeHome() { onCameraViewChange( 45.0f, 45.0f ); }
112 void onCameraViewChangeTop() { onCameraViewChange( 0.0f, 90.0f ); }
113 void onCameraViewChangeNorth() { onCameraViewChange( 90.0f, 180.0f ); }
114 void onCameraViewChangeEast() { onCameraViewChange( 90.0f, 90.0f ); }
115 void onCameraViewChangeSouth() { onCameraViewChange( 90.0f, 0.0f ); }
116 void onCameraViewChangeWest() { onCameraViewChange( 90.0f, -90.0f ); }
117 void onCameraViewChangeBottom() { onCameraViewChange( 180.0f, 0.0f ); }
119 void onTextXChanged(
const QString &text );
120 void onTextYChanged(
const QString &text );
121 void onTextZChanged(
const QString &text );
125 void createAxisScene();
126 void createAxis( Qt::Axis axis );
128 void setEnableCube(
bool show );
129 void setEnableAxis(
bool show );
130 void updateAxisLabelPosition();
132 Qt3DRender::QViewport *constructAxisViewport( Qt3DCore::QEntity *parent3DScene );
133 Qt3DRender::QViewport *constructLabelViewport( Qt3DCore::QEntity *parent3DScene,
const QRectF &parentViewportSize );
135 Qt3DExtras::QText2DEntity *addCubeText(
const QString &text,
float textHeight,
float textWidth,
const QFont &f,
const QMatrix4x4 &rotation,
const QVector3D &translation );
138 void init3DObjectPicking( );
139 bool eventFilter( QObject *watched, QEvent *event )
override;
140 void createKeyboardShortCut();
143 void displayMenuAt(
const QPoint &position );
146 Qt3DExtras::Qt3DWindow *mParentWindow =
nullptr;
150 float mCylinderLength = 40.0f;
153 Qt3DCore::QEntity *mAxisSceneEntity =
nullptr;
154 Qt3DRender::QLayer *mAxisSceneLayer =
nullptr;
155 Qt3DRender::QCamera *mAxisCamera =
nullptr;
156 Qt3DRender::QViewport *mAxisViewport =
nullptr;
158 Qt3DCore::QEntity *mAxisRoot =
nullptr;
159 Qt3DCore::QEntity *mCubeRoot =
nullptr;
160 QList<Qt3DExtras::QText2DEntity *> mCubeLabels;
162 Qt3DExtras::QText2DEntity *mTextX =
nullptr;
163 Qt3DExtras::QText2DEntity *mTextY =
nullptr;
164 Qt3DExtras::QText2DEntity *mTextZ =
nullptr;
165 QVector3D mTextCoordX;
166 QVector3D mTextCoordY;
167 QVector3D mTextCoordZ;
168 Qt3DCore::QTransform *mTextTransformX =
nullptr;
169 Qt3DCore::QTransform *mTextTransformY =
nullptr;
170 Qt3DCore::QTransform *mTextTransformZ =
nullptr;
172 QVector3D mPreviousVector;
173 double mAxisScaleFactor = 1.0;
175 Qt3DRender::QCamera *mTwoDLabelCamera =
nullptr;
176 Qt3DCore::QEntity *mTwoDLabelSceneEntity =
nullptr;
177 Qt3DRender::QViewport *mTwoDLabelViewport =
nullptr;
180 Qt3DRender::QScreenRayCaster *mScreenRayCaster =
nullptr;
181 bool mIsDragging =
false;
182 bool mHasClicked =
false;
183 QPoint mLastClickedPos;
184 Qt::MouseButton mLastClickedButton;
185 QCursor mPreviousCursor = Qt::ArrowCursor;
186 QMenu *mMenu =
nullptr;
211 void setVertices(
const QList<QVector3D> &vertices );
214#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
215 Qt3DRender::QGeometry *mGeom =
nullptr;
216 Qt3DRender::QAttribute *mPositionAttribute =
nullptr;
217 Qt3DRender::QBuffer *mVertexBuffer =
nullptr;
219 Qt3DCore::QGeometry *mGeom =
nullptr;
220 Qt3DCore::QAttribute *mPositionAttribute =
nullptr;
221 Qt3DCore::QBuffer *mVertexBuffer =
nullptr;