80 Qt3DRender::QCamera *
camera()
const {
return mCamera; }
99 void setCameraMovementSpeed(
double movementSpeed );
114 void frameTriggered(
float dt );
117 void resetView(
float distance );
120 void setViewFromTop(
float worldX,
float worldY,
float distance,
float yaw = 0 );
131 void setLookingAtPoint(
const QgsVector3D &point,
float distance,
float pitch,
float yaw );
150 float distance()
const {
return mCameraPose.distanceFromCenterPoint(); }
157 float pitch()
const {
return mCameraPose.pitchAngle(); }
164 float yaw()
const {
return mCameraPose.headingAngle(); }
167 QDomElement writeXml( QDomDocument &doc )
const;
169 void readXml(
const QDomElement &elem );
172 void zoom(
float factor );
174 void tiltUpAroundViewCenter(
float deltaPitch );
176 void rotateAroundViewCenter(
float deltaYaw );
178 void setCameraHeadingAngle(
float angle );
180 void moveView(
float tx,
float ty );
186 void walkView(
double tx,
double ty,
double tz );
194 void rotateCamera(
float diffPitch,
float diffYaw );
201 bool willHandleKeyEvent( QKeyEvent *event );
215 void depthBufferCaptured(
const QImage &depthImage );
223 void updateCameraFromPose();
224 void moveCameraPositionBy(
const QVector3D &posDiff );
226 QWindow *window()
const;
259 void onPositionChanged( Qt3DInput::QMouseEvent *mouse );
260 void onWheel( Qt3DInput::QWheelEvent *wheel );
261 void onMousePressed( Qt3DInput::QMouseEvent *mouse );
262 void onMouseReleased( Qt3DInput::QMouseEvent *mouse );
263 void onKeyPressed( Qt3DInput::QKeyEvent *event );
264 void onKeyReleased( Qt3DInput::QKeyEvent *event );
265 void applyFlyModeKeyMovements();
268 void onKeyPressedFlyNavigation( Qt3DInput::QKeyEvent *event );
269 void onKeyPressedTerrainNavigation( Qt3DInput::QKeyEvent *event );
270 void onPositionChangedFlyNavigation( Qt3DInput::QMouseEvent *mouse );
271 void onPositionChangedTerrainNavigation( Qt3DInput::QMouseEvent *mouse );
273 void handleTerrainNavigationWheelZoom();
279 double sampleDepthBuffer(
const QImage &buffer,
int px,
int py );
283 bool screenPointToWorldPos( QPoint position, Qt3DRender::QCamera *cameraBefore,
double &depth, QVector3D &worldPosition );
290 Qt3DRender::QCamera *mCamera =
nullptr;
297 bool mMousePressed =
false;
298 Qt3DInput::QMouseEvent::Buttons mPressedButton = Qt3DInput::QMouseEvent::Buttons::NoButton;
300 bool mDepthBufferIsReady =
false;
301 QImage mDepthBufferImage;
303 QPoint mMiddleButtonClickPos;
304 bool mRotationCenterCalculated =
false;
305 QVector3D mRotationCenter;
306 double mRotationDistanceFromCenter;
307 double mRotationPitch = 0;
308 double mRotationYaw = 0;
309 std::unique_ptr< Qt3DRender::QCamera > mCameraBeforeRotation;
311 QPoint mDragButtonClickPos;
312 std::unique_ptr< Qt3DRender::QCamera > mCameraBeforeDrag;
313 bool mDragPointCalculated =
false;
314 QVector3D mDragPoint;
317 bool mIsInZoomInState =
false;
318 std::unique_ptr< Qt3DRender::QCamera > mCameraBeforeZoom;
319 bool mZoomPointCalculated =
false;
320 QVector3D mZoomPoint;
322 Qt3DInput::QMouseHandler *mMouseHandler =
nullptr;
323 Qt3DInput::QKeyboardHandler *mKeyboardHandler =
nullptr;
326 double mCameraMovementSpeed = 5.0;
328 QSet< int > mDepressedKeys;
329 bool mCaptureFpsMouseMovements =
false;
330 bool mIgnoreNextMouseMove =
false;
331 QTimer *mFpsNavTimer =
nullptr;
333 double mCumulatedWheelY = 0;
335 friend QgsCameraController4Test;