79 Qt3DRender::QCamera *
camera()
const {
return mCamera; }
98 void setCameraMovementSpeed(
double movementSpeed );
113 void frameTriggered(
float dt );
116 void resetView(
float distance );
119 void setViewFromTop(
float worldX,
float worldY,
float distance,
float yaw = 0 );
130 void setLookingAtPoint(
const QgsVector3D &point,
float distance,
float pitch,
float yaw );
149 float distance()
const {
return mCameraPose.distanceFromCenterPoint(); }
156 float pitch()
const {
return mCameraPose.pitchAngle(); }
163 float yaw()
const {
return mCameraPose.headingAngle(); }
166 QDomElement writeXml( QDomDocument &doc )
const;
168 void readXml(
const QDomElement &elem );
171 void zoom(
float factor );
173 void tiltUpAroundViewCenter(
float deltaPitch );
175 void rotateAroundViewCenter(
float deltaYaw );
177 void setCameraHeadingAngle(
float angle );
179 void moveView(
float tx,
float ty );
185 void walkView(
double tx,
double ty,
double tz );
193 void rotateCamera(
float diffPitch,
float diffYaw );
200 bool willHandleKeyEvent( QKeyEvent *event );
214 void depthBufferCaptured(
const QImage &depthImage );
222 void updateCameraFromPose();
223 void moveCameraPositionBy(
const QVector3D &posDiff );
225 QWindow *window()
const;
228 enum class MouseOperation
241 const QList<MouseOperation> mTranslateOrRotate =
243 MouseOperation::Translation,
244 MouseOperation::RotationCamera,
245 MouseOperation::RotationCenter
249 bool isATranslationRotationSequence( MouseOperation newOperation )
const;
251 void setMouseParameters(
const MouseOperation &newOperation,
const QPoint &clickPoint = QPoint() );
284 void onPositionChanged( Qt3DInput::QMouseEvent *mouse );
285 void onWheel( Qt3DInput::QWheelEvent *wheel );
286 void onMousePressed( Qt3DInput::QMouseEvent *mouse );
287 void onMouseReleased( Qt3DInput::QMouseEvent *mouse );
288 void onKeyPressed( Qt3DInput::QKeyEvent *event );
289 void onKeyReleased( Qt3DInput::QKeyEvent *event );
290 void applyFlyModeKeyMovements();
293 void onKeyPressedFlyNavigation( Qt3DInput::QKeyEvent *event );
294 void onKeyPressedTerrainNavigation( Qt3DInput::QKeyEvent *event );
295 void onPositionChangedFlyNavigation( Qt3DInput::QMouseEvent *mouse );
296 void onPositionChangedTerrainNavigation( Qt3DInput::QMouseEvent *mouse );
298 void handleTerrainNavigationWheelZoom();
304 double sampleDepthBuffer(
const QImage &buffer,
int px,
int py );
308 bool screenPointToWorldPos( QPoint position, Qt3DRender::QCamera *cameraBefore,
double &depth, QVector3D &worldPosition );
315 Qt3DRender::QCamera *mCamera =
nullptr;
326 bool mDepthBufferIsReady =
false;
327 QImage mDepthBufferImage;
329 std::unique_ptr< Qt3DRender::QCamera > mCameraBefore;
331 bool mRotationCenterCalculated =
false;
332 QVector3D mRotationCenter;
333 double mRotationDistanceFromCenter;
334 double mRotationPitch = 0;
335 double mRotationYaw = 0;
337 bool mDragPointCalculated =
false;
338 QVector3D mDragPoint;
341 bool mZoomPointCalculated =
false;
342 QVector3D mZoomPoint;
344 Qt3DInput::QMouseHandler *mMouseHandler =
nullptr;
345 Qt3DInput::QKeyboardHandler *mKeyboardHandler =
nullptr;
348 double mCameraMovementSpeed = 5.0;
350 QSet< int > mDepressedKeys;
351 bool mCaptureFpsMouseMovements =
false;
352 bool mIgnoreNextMouseMove =
false;
353 QTimer *mFpsNavTimer =
nullptr;
355 double mCumulatedWheelY = 0;
357 MouseOperation mCurrentOperation = MouseOperation::None;
359 friend QgsCameraController4Test;